Lines Matching full:vm
23 void DebuggerExecutor::Initialize(const EcmaVM *vm) in Initialize() argument
25 [[maybe_unused]] EcmaHandleScope handleScope(vm->GetJSThread()); in Initialize()
26 Local<ObjectRef> globalObj = JSNApi::GetGlobalObject(vm); in Initialize()
27 globalObj->Set(vm, StringRef::NewFromUtf8(vm, "debuggerSetValue"), FunctionRef::New( in Initialize()
28 const_cast<panda::EcmaVM*>(vm), DebuggerExecutor::DebuggerSetValue)); in Initialize()
29 globalObj->Set(vm, StringRef::NewFromUtf8(vm, "debuggerGetValue"), FunctionRef::New( in Initialize()
30 const_cast<panda::EcmaVM*>(vm), DebuggerExecutor::DebuggerGetValue)); in Initialize()
35 EcmaVM *vm = runtimeCallInfo->GetVM(); in DebuggerGetValue() local
38 return JSValueRef::Undefined(vm); in DebuggerGetValue()
41 if (!name->IsString(vm)) { in DebuggerGetValue()
42 return JSValueRef::Undefined(vm); in DebuggerGetValue()
46 auto &frameHandler = vm->GetJsDebuggerManager()->GetEvalFrameHandler(); in DebuggerGetValue()
49 Local<JSValueRef> value = GetValue(vm, frameHandler.get(), Local<StringRef>(name)); in DebuggerGetValue()
54 if (!isThrow->ToBoolean(vm)->Value()) { in DebuggerGetValue()
55 DebuggerApi::ClearException(vm); in DebuggerGetValue()
56 return JSValueRef::Undefined(vm); in DebuggerGetValue()
59 std::string varName = Local<StringRef>(name)->ToString(vm); in DebuggerGetValue()
60 ThrowException(vm, varName + " is not defined"); in DebuggerGetValue()
66 EcmaVM *vm = runtimeCallInfo->GetVM(); in DebuggerSetValue() local
69 return JSValueRef::Undefined(vm); in DebuggerSetValue()
72 if (!name->IsString(vm)) { in DebuggerSetValue()
73 return JSValueRef::Undefined(vm); in DebuggerSetValue()
77 auto &frameHandler = vm->GetJsDebuggerManager()->GetEvalFrameHandler(); in DebuggerSetValue()
80 if (SetValue(vm, frameHandler.get(), Local<StringRef>(name), value)) { in DebuggerSetValue()
84 std::string varName = StringRef::Cast(*name)->ToString(vm); in DebuggerSetValue()
85 ThrowException(vm, varName + " is not defined"); in DebuggerSetValue()
89 Local<JSValueRef> DebuggerExecutor::GetValue(const EcmaVM *vm, const FrameHandler *frameHandler, Lo… in GetValue() argument
92 value = GetLocalValue(vm, frameHandler, name); in GetValue()
96 value = GetLexicalValue(vm, frameHandler, name); in GetValue()
100 value = GetModuleValue(vm, frameHandler, name); in GetValue()
104 value = GetGlobalValue(vm, name); in GetValue()
112 bool DebuggerExecutor::SetValue(const EcmaVM *vm, FrameHandler *frameHandler, in SetValue() argument
115 if (SetLocalValue(vm, frameHandler, name, value)) { in SetValue()
118 if (SetLexicalValue(vm, frameHandler, name, value)) { in SetValue()
121 if (SetModuleValue(vm, frameHandler, name, value)) { in SetValue()
124 if (SetGlobalValue(vm, name, value)) { in SetValue()
131 void DebuggerExecutor::ThrowException(const EcmaVM *vm, const std::string &error) in ThrowException() argument
133 Local<StringRef> msg = StringRef::NewFromUtf8(vm, error.c_str()); in ThrowException()
134 Local<JSValueRef> exception = Exception::ReferenceError(vm, msg); in ThrowException()
135 JSNApi::ThrowException(vm, exception); in ThrowException()
138 Local<JSValueRef> DebuggerExecutor::GetLocalValue(const EcmaVM *vm, const FrameHandler *frameHandle… in GetLocalValue() argument
143 int32_t index = DebuggerApi::GetVregIndex(frameHandler, name->ToString(vm)); in GetLocalValue()
148 result = DebuggerApi::GetVRegValue(vm, frameHandler, index); in GetLocalValue()
152 bool DebuggerExecutor::SetLocalValue(const EcmaVM *vm, FrameHandler *frameHandler, in SetLocalValue() argument
155 std::string varName = name->ToString(vm); in SetLocalValue()
162 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Local()); in SetLocalValue()
166 Local<JSValueRef> DebuggerExecutor::GetLexicalValue(const EcmaVM *vm, const FrameHandler *frameHand… in GetLexicalValue() argument
171 auto [level, slot] = DebuggerApi::GetLevelSlot(frameHandler, name->ToString(vm)); in GetLexicalValue()
176 result = DebuggerApi::GetProperties(vm, frameHandler, level, slot); in GetLexicalValue()
180 bool DebuggerExecutor::SetLexicalValue(const EcmaVM *vm, const FrameHandler *frameHandler, in SetLexicalValue() argument
183 std::string varName = name->ToString(vm); in SetLexicalValue()
189 DebuggerApi::SetProperties(vm, frameHandler, level, slot, value); in SetLexicalValue()
190 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Closure()); in SetLexicalValue()
194 Local<JSValueRef> DebuggerExecutor::GetGlobalValue(const EcmaVM *vm, Local<StringRef> name) in GetGlobalValue() argument
196 return DebuggerApi::GetGlobalValue(vm, name); in GetGlobalValue()
199 bool DebuggerExecutor::SetGlobalValue(const EcmaVM *vm, Local<StringRef> name, Local<JSValueRef> va… in SetGlobalValue() argument
201 std::string varName = name->ToString(vm); in SetGlobalValue()
202 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Global()); in SetGlobalValue()
203 return DebuggerApi::SetGlobalValue(vm, name, value); in SetGlobalValue()
206 Local<JSValueRef> DebuggerExecutor::GetModuleValue(const EcmaVM *vm, const FrameHandler *frameHandl… in GetModuleValue() argument
210 std::string varName = name->ToString(vm); in GetModuleValue()
216 JSThread *thread = vm->GetJSThread(); in GetModuleValue()
217 JSHandle<JSTaggedValue> currentModule(thread, DebuggerApi::GetCurrentModule(vm)); in GetModuleValue()
219 result = DebuggerApi::GetModuleValue(vm, currentModule, varName); in GetModuleValue()
224 bool DebuggerExecutor::SetModuleValue(const EcmaVM *vm, const FrameHandler *frameHandler, in SetModuleValue() argument
227 std::string varName = name->ToString(vm); in SetModuleValue()
233 JSThread *thread = vm->GetJSThread(); in SetModuleValue()
234 JSHandle<JSTaggedValue> currentModule(thread, DebuggerApi::GetCurrentModule(vm)); in SetModuleValue()
236 DebuggerApi::SetModuleValue(vm, currentModule, varName, value); in SetModuleValue()
237 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Module()); in SetModuleValue()