Lines Matching full:vm
22 void DebuggerExecutor::Initialize(const EcmaVM *vm) in Initialize() argument
24 [[maybe_unused]] EcmaHandleScope handleScope(vm->GetJSThread()); in Initialize()
25 Local<ObjectRef> globalObj = JSNApi::GetGlobalObject(vm); in Initialize()
26 globalObj->Set(vm, StringRef::NewFromUtf8(vm, "debuggerSetValue"), FunctionRef::New( in Initialize()
27 const_cast<panda::EcmaVM*>(vm), DebuggerExecutor::DebuggerSetValue)); in Initialize()
28 globalObj->Set(vm, StringRef::NewFromUtf8(vm, "debuggerGetValue"), FunctionRef::New( in Initialize()
29 const_cast<panda::EcmaVM*>(vm), DebuggerExecutor::DebuggerGetValue)); in Initialize()
34 EcmaVM *vm = runtimeCallInfo->GetVM(); in DebuggerGetValue() local
37 return JSValueRef::Undefined(vm); in DebuggerGetValue()
40 if (!name->IsString(vm)) { in DebuggerGetValue()
41 return JSValueRef::Undefined(vm); in DebuggerGetValue()
45 auto &frameHandler = vm->GetJsDebuggerManager()->GetEvalFrameHandler(); in DebuggerGetValue()
48 Local<JSValueRef> value = GetValue(vm, frameHandler.get(), Local<StringRef>(name)); in DebuggerGetValue()
53 if (!isThrow->ToBoolean(vm)->Value()) { in DebuggerGetValue()
54 DebuggerApi::ClearException(vm); in DebuggerGetValue()
55 return JSValueRef::Undefined(vm); in DebuggerGetValue()
58 std::string varName = Local<StringRef>(name)->ToString(vm); in DebuggerGetValue()
59 ThrowException(vm, varName + " is not defined"); in DebuggerGetValue()
65 EcmaVM *vm = runtimeCallInfo->GetVM(); in DebuggerSetValue() local
68 return JSValueRef::Undefined(vm); in DebuggerSetValue()
71 if (!name->IsString(vm)) { in DebuggerSetValue()
72 return JSValueRef::Undefined(vm); in DebuggerSetValue()
76 auto &frameHandler = vm->GetJsDebuggerManager()->GetEvalFrameHandler(); in DebuggerSetValue()
79 if (SetValue(vm, frameHandler.get(), Local<StringRef>(name), value)) { in DebuggerSetValue()
83 std::string varName = StringRef::Cast(*name)->ToString(vm); in DebuggerSetValue()
84 ThrowException(vm, varName + " is not defined"); in DebuggerSetValue()
88 Local<JSValueRef> DebuggerExecutor::GetValue(const EcmaVM *vm, const FrameHandler *frameHandler, Lo… in GetValue() argument
91 value = GetLocalValue(vm, frameHandler, name); in GetValue()
95 value = GetLexicalValue(vm, frameHandler, name); in GetValue()
99 value = GetModuleValue(vm, frameHandler, name); in GetValue()
103 value = GetGlobalValue(vm, name); in GetValue()
111 bool DebuggerExecutor::SetValue(const EcmaVM *vm, FrameHandler *frameHandler, in SetValue() argument
114 if (SetLocalValue(vm, frameHandler, name, value)) { in SetValue()
117 if (SetLexicalValue(vm, frameHandler, name, value)) { in SetValue()
120 if (SetModuleValue(vm, frameHandler, name, value)) { in SetValue()
123 if (SetGlobalValue(vm, name, value)) { in SetValue()
130 void DebuggerExecutor::ThrowException(const EcmaVM *vm, const std::string &error) in ThrowException() argument
132 Local<StringRef> msg = StringRef::NewFromUtf8(vm, error.c_str()); in ThrowException()
133 Local<JSValueRef> exception = Exception::ReferenceError(vm, msg); in ThrowException()
134 JSNApi::ThrowException(vm, exception); in ThrowException()
137 Local<JSValueRef> DebuggerExecutor::GetLocalValue(const EcmaVM *vm, const FrameHandler *frameHandle… in GetLocalValue() argument
142 int32_t index = DebuggerApi::GetVregIndex(frameHandler, name->ToString(vm)); in GetLocalValue()
147 result = DebuggerApi::GetVRegValue(vm, frameHandler, index); in GetLocalValue()
151 bool DebuggerExecutor::SetLocalValue(const EcmaVM *vm, FrameHandler *frameHandler, in SetLocalValue() argument
154 std::string varName = name->ToString(vm); in SetLocalValue()
161 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Local()); in SetLocalValue()
165 Local<JSValueRef> DebuggerExecutor::GetLexicalValue(const EcmaVM *vm, const FrameHandler *frameHand… in GetLexicalValue() argument
170 auto [level, slot] = DebuggerApi::GetLevelSlot(frameHandler, name->ToString(vm)); in GetLexicalValue()
175 result = DebuggerApi::GetProperties(vm, frameHandler, level, slot); in GetLexicalValue()
179 bool DebuggerExecutor::SetLexicalValue(const EcmaVM *vm, const FrameHandler *frameHandler, in SetLexicalValue() argument
182 std::string varName = name->ToString(vm); in SetLexicalValue()
188 DebuggerApi::SetProperties(vm, frameHandler, level, slot, value); in SetLexicalValue()
189 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Closure()); in SetLexicalValue()
193 Local<JSValueRef> DebuggerExecutor::GetGlobalValue(const EcmaVM *vm, Local<StringRef> name) in GetGlobalValue() argument
195 return DebuggerApi::GetGlobalValue(vm, name); in GetGlobalValue()
198 bool DebuggerExecutor::SetGlobalValue(const EcmaVM *vm, Local<StringRef> name, Local<JSValueRef> va… in SetGlobalValue() argument
200 std::string varName = name->ToString(vm); in SetGlobalValue()
201 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Global()); in SetGlobalValue()
202 return DebuggerApi::SetGlobalValue(vm, name, value); in SetGlobalValue()
205 Local<JSValueRef> DebuggerExecutor::GetModuleValue(const EcmaVM *vm, const FrameHandler *frameHandl… in GetModuleValue() argument
209 std::string varName = name->ToString(vm); in GetModuleValue()
215 JSThread *thread = vm->GetJSThread(); in GetModuleValue()
216 JSHandle<JSTaggedValue> currentModule(thread, DebuggerApi::GetCurrentModule(vm)); in GetModuleValue()
218 result = DebuggerApi::GetModuleValue(vm, currentModule, varName); in GetModuleValue()
223 bool DebuggerExecutor::SetModuleValue(const EcmaVM *vm, const FrameHandler *frameHandler, in SetModuleValue() argument
226 std::string varName = name->ToString(vm); in SetModuleValue()
232 JSThread *thread = vm->GetJSThread(); in SetModuleValue()
233 JSHandle<JSTaggedValue> currentModule(thread, DebuggerApi::GetCurrentModule(vm)); in SetModuleValue()
236 result = DebuggerApi::SetModuleValue(vm, currentModule, varName, value); in SetModuleValue()
237 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Module()); in SetModuleValue()