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 SetEvaluateToGlobal(vm, globalObj); in Initialize()
29 void DebuggerExecutor::SetEvaluateToGlobal(const EcmaVM *vm, Local<ObjectRef> &globalObj) in SetEvaluateToGlobal() argument
31 auto setStr = StringRef::NewFromUtf8(vm, "debuggerSetValue"); in SetEvaluateToGlobal()
32 auto getStr = StringRef::NewFromUtf8(vm, "debuggerGetValue"); in SetEvaluateToGlobal()
33 if (!globalObj->Has(vm, setStr) || !globalObj->Has(vm, getStr)) { in SetEvaluateToGlobal()
34 globalObj->Set(vm, setStr, FunctionRef::New( in SetEvaluateToGlobal()
35 const_cast<panda::EcmaVM*>(vm), DebuggerExecutor::DebuggerSetValue)); in SetEvaluateToGlobal()
36 globalObj->Set(vm, getStr, FunctionRef::New( in SetEvaluateToGlobal()
37 const_cast<panda::EcmaVM*>(vm), DebuggerExecutor::DebuggerGetValue)); in SetEvaluateToGlobal()
43 EcmaVM *vm = runtimeCallInfo->GetVM(); in DebuggerGetValue() local
46 return JSValueRef::Undefined(vm); in DebuggerGetValue()
49 if (!name->IsString(vm)) { in DebuggerGetValue()
50 return JSValueRef::Undefined(vm); in DebuggerGetValue()
54 auto &frameHandler = vm->GetJsDebuggerManager()->GetEvalFrameHandler(); in DebuggerGetValue()
57 Local<JSValueRef> value = GetValue(vm, frameHandler.get(), Local<StringRef>(name)); in DebuggerGetValue()
62 if (!isThrow->ToBoolean(vm)->Value()) { in DebuggerGetValue()
63 DebuggerApi::ClearException(vm); in DebuggerGetValue()
64 return JSValueRef::Undefined(vm); in DebuggerGetValue()
67 std::string varName = Local<StringRef>(name)->ToString(vm); in DebuggerGetValue()
68 ThrowException(vm, varName + " is not defined"); in DebuggerGetValue()
74 EcmaVM *vm = runtimeCallInfo->GetVM(); in DebuggerSetValue() local
77 return JSValueRef::Undefined(vm); in DebuggerSetValue()
80 if (!name->IsString(vm)) { in DebuggerSetValue()
81 return JSValueRef::Undefined(vm); in DebuggerSetValue()
85 auto &frameHandler = vm->GetJsDebuggerManager()->GetEvalFrameHandler(); in DebuggerSetValue()
88 if (SetValue(vm, frameHandler.get(), Local<StringRef>(name), value)) { in DebuggerSetValue()
92 std::string varName = StringRef::Cast(*name)->ToString(vm); in DebuggerSetValue()
93 ThrowException(vm, varName + " is not defined"); in DebuggerSetValue()
97 Local<JSValueRef> DebuggerExecutor::GetValue(const EcmaVM *vm, const FrameHandler *frameHandler, Lo… in GetValue() argument
100 value = GetLocalValue(vm, frameHandler, name); in GetValue()
104 value = GetLexicalValue(vm, frameHandler, name); in GetValue()
108 value = GetModuleValue(vm, frameHandler, name); in GetValue()
112 value = GetGlobalValue(vm, name); in GetValue()
120 bool DebuggerExecutor::SetValue(const EcmaVM *vm, FrameHandler *frameHandler, in SetValue() argument
123 if (SetLocalValue(vm, frameHandler, name, value)) { in SetValue()
126 if (SetLexicalValue(vm, frameHandler, name, value)) { in SetValue()
129 if (SetModuleValue(vm, frameHandler, name, value)) { in SetValue()
132 if (SetGlobalValue(vm, name, value)) { in SetValue()
139 void DebuggerExecutor::ThrowException(const EcmaVM *vm, const std::string &error) in ThrowException() argument
141 Local<StringRef> msg = StringRef::NewFromUtf8(vm, error.c_str()); in ThrowException()
142 Local<JSValueRef> exception = Exception::ReferenceError(vm, msg); in ThrowException()
143 JSNApi::ThrowException(vm, exception); in ThrowException()
146 Local<JSValueRef> DebuggerExecutor::GetLocalValue(const EcmaVM *vm, const FrameHandler *frameHandle… in GetLocalValue() argument
151 int32_t index = DebuggerApi::GetVregIndex(frameHandler, name->ToString(vm)); in GetLocalValue()
156 result = DebuggerApi::GetVRegValue(vm, frameHandler, index); in GetLocalValue()
160 bool DebuggerExecutor::SetLocalValue(const EcmaVM *vm, FrameHandler *frameHandler, in SetLocalValue() argument
163 std::string varName = name->ToString(vm); in SetLocalValue()
170 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Local()); in SetLocalValue()
174 Local<JSValueRef> DebuggerExecutor::GetLexicalValue(const EcmaVM *vm, const FrameHandler *frameHand… in GetLexicalValue() argument
179 JSThread *thread = vm->GetJSThread(); in GetLexicalValue()
180 auto [level, slot] = DebuggerApi::GetLevelSlot(thread, frameHandler, name->ToString(vm)); in GetLexicalValue()
185 result = DebuggerApi::GetProperties(vm, frameHandler, level, slot); in GetLexicalValue()
189 bool DebuggerExecutor::SetLexicalValue(const EcmaVM *vm, const FrameHandler *frameHandler, in SetLexicalValue() argument
192 std::string varName = name->ToString(vm); in SetLexicalValue()
193 JSThread *thread = vm->GetJSThread(); in SetLexicalValue()
199 DebuggerApi::SetProperties(vm, frameHandler, level, slot, value); in SetLexicalValue()
200 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Closure()); in SetLexicalValue()
204 Local<JSValueRef> DebuggerExecutor::GetGlobalValue(const EcmaVM *vm, Local<StringRef> name) in GetGlobalValue() argument
206 return DebuggerApi::GetGlobalValue(vm, name); in GetGlobalValue()
209 bool DebuggerExecutor::SetGlobalValue(const EcmaVM *vm, Local<StringRef> name, Local<JSValueRef> va… in SetGlobalValue() argument
211 std::string varName = name->ToString(vm); in SetGlobalValue()
212 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Global()); in SetGlobalValue()
213 return DebuggerApi::SetGlobalValue(vm, name, value); in SetGlobalValue()
216 Local<JSValueRef> DebuggerExecutor::GetModuleValue(const EcmaVM *vm, const FrameHandler *frameHandl… in GetModuleValue() argument
220 std::string varName = name->ToString(vm); in GetModuleValue()
222 JSThread *thread = vm->GetJSThread(); in GetModuleValue()
227 JSHandle<JSTaggedValue> currentModule(thread, DebuggerApi::GetCurrentModule(vm)); in GetModuleValue()
229 result = DebuggerApi::GetModuleValue(vm, currentModule, varName); in GetModuleValue()
234 bool DebuggerExecutor::SetModuleValue(const EcmaVM *vm, const FrameHandler *frameHandler, in SetModuleValue() argument
237 std::string varName = name->ToString(vm); in SetModuleValue()
239 JSThread *thread = vm->GetJSThread(); in SetModuleValue()
244 JSHandle<JSTaggedValue> currentModule(thread, DebuggerApi::GetCurrentModule(vm)); in SetModuleValue()
247 result = DebuggerApi::SetModuleValue(vm, currentModule, varName, value); in SetModuleValue()
248 vm->GetJsDebuggerManager()->NotifyScopeUpdated(varName, value, Scope::Type::Module()); in SetModuleValue()