increase base class FrameHandler for iterator stack frame

Signed-off-by: getingke <getingke@huawei.com>
Change-Id: I5643f176c169a2d3a754b6ead66698a0a8e33351
This commit is contained in:
getingke 2021-10-28 16:28:40 +08:00
parent 8b2b159e94
commit bc69122046
14 changed files with 143 additions and 95 deletions

View File

@ -19,6 +19,7 @@
#include "ecmascript/ecma_macros.h"
#include "ecmascript/ecma_vm.h"
#include "ecmascript/global_env.h"
#include "ecmascript/interpreter/frame_handler.h"
#include "ecmascript/interpreter/interpreter.h"
#include "ecmascript/js_object-inl.h"
#include "ecmascript/js_tagged_value-inl.h"
@ -192,8 +193,9 @@ CString ErrorHelper::BuildNativeEcmaStackTrace(JSThread *thread)
{
auto ecmaVm = thread->GetEcmaVM();
CString data;
InterpretedFrameHandler frameHandler(thread);
for (; frameHandler.HasFrame(); frameHandler.PrevFrame()) {
auto sp = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
InterpretedFrameHandler frameHandler(sp);
for (; frameHandler.HasFrame(); frameHandler.PrevInterpretedFrame()) {
if (frameHandler.IsBreakFrame()) {
continue;
}

View File

@ -15,6 +15,7 @@
#ifndef ECMASCRIPT_COMPILER_LLVM_CODEGEN_H
#define ECMASCRIPT_COMPILER_LLVM_CODEGEN_H
#include <iostream>
#include <list>
#include <map>
@ -131,6 +132,7 @@ private:
/* stack map */
uint8_t *stackMapsSection_ {nullptr};
};
class LLVMAssembler {
public:
explicit LLVMAssembler(LLVMModuleRef module, const char* triple);

View File

@ -27,6 +27,7 @@
#include "ecmascript/ic/ic_handler.h"
#include "ecmascript/ic/proto_change_details.h"
#include "ecmascript/ic/property_box.h"
#include "ecmascript/interpreter/frame_handler.h"
#include "ecmascript/jobs/micro_job_queue.h"
#include "ecmascript/jobs/pending_job.h"
#include "ecmascript/js_array.h"
@ -687,7 +688,8 @@ void JSTaggedValue::DumpVal(JSThread *thread, JSTaggedType val)
void JSThread::DumpStack()
{
InterpretedFrameHandler handler(this);
JSTaggedType *sp = const_cast<JSTaggedType *>(this->GetCurrentSPFrame());
InterpretedFrameHandler handler(sp);
handler.DumpStack(std::cout);
}

View File

@ -17,6 +17,7 @@
#include "ecmascript/ecma_class_linker_extension.h"
#include "ecmascript/ecma_exceptions.h"
#include "ecmascript/interpreter/frame_handler.h"
#include "ecmascript/js_method.h"
#include "ecmascript/js_object.h"
#include "ecmascript/js_tagged_value.h"
@ -25,6 +26,7 @@
#include "include/tooling/pt_lang_extension.h"
namespace panda {
using ecmascript::JSTaggedType;
using ecmascript::InterpretedFrameHandler;
using ecmascript::EcmaVM;
using ecmascript::JSThread;
@ -34,8 +36,9 @@ std::pair<Method *, uint32_t> EcmaLanguageContext::GetCatchMethodAndOffset(Metho
Method *catchMethod = method;
uint32_t catchOffset = 0;
auto jsThread = static_cast<JSThread *>(thread);
InterpretedFrameHandler frameHandler(jsThread);
for (; frameHandler.HasFrame(); frameHandler.PrevFrame()) {
auto sp = const_cast<JSTaggedType *>(jsThread->GetCurrentSPFrame());
InterpretedFrameHandler frameHandler(sp);
for (; frameHandler.HasFrame(); frameHandler.PrevInterpretedFrame()) {
if (frameHandler.IsBreakFrame()) {
continue;
}

View File

@ -14,74 +14,51 @@
*/
#include "ecmascript/interpreter/frame_handler.h"
#include "ecmascript/interpreter/interpreter.h"
#include "ecmascript/js_thread.h"
#include "libpandafile/bytecode_instruction-inl.h"
#include "ecmascript/compiler/llvm/llvm_stackmap_parser.h"
namespace panda::ecmascript {
InterpretedFrameHandler::InterpretedFrameHandler(const JSThread *thread)
{
sp_ = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
}
bool InterpretedFrameHandler::HasFrame() const
{
// Breakframe also is a frame
return sp_ != nullptr;
}
bool InterpretedFrameHandler::IsBreakFrame() const
void FrameHandler::PrevFrame()
{
ASSERT(HasFrame());
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
FrameState *state = reinterpret_cast<FrameState *>(sp_) - 1;
return state->sp == nullptr;
auto type = GetFrameType();
switch(type) {
case FrameType::OPTIMIZED_FRAME: {
auto framehandle =
reinterpret_cast<OptimizedFrameHandler *>(this);
framehandle->PrevFrame();
break;
}
case FrameType::OPTIMIZED_ENTRY_FRAME: {
auto framehandle =
reinterpret_cast<OptimizedEntryFrameHandler *>(this);
framehandle->PrevFrame();
break;
}
case FrameType::INTERPRETER_FRAME: {
auto framehandle =
reinterpret_cast<InterpretedFrameHandler *>(this);
framehandle->PrevFrame();
break;
}
default:
UNREACHABLE();
}
}
void InterpretedFrameHandler::PrevFrame()
{
ASSERT(HasFrame());
auto type = GetFrameType();
if (type == FrameType::INTERPRETER_FRAME) {
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
FrameState *state = reinterpret_cast<FrameState *>(sp_) - 1;
sp_ = state->base.prev;
if (sp_ == nullptr) {
return;
}
type = GetFrameType();
}
while (type != FrameType::INTERPRETER_FRAME) {
switch (type) {
case FrameType::OPTIMIZED_FRAME: {
OptimizedFrameStateBase *state = reinterpret_cast<OptimizedFrameStateBase *>(
reinterpret_cast<long long>(sp_) - MEMBER_OFFSET(OptimizedFrameStateBase, prev));
sp_ = reinterpret_cast<JSTaggedType *>(state->prev);
break;
}
case FrameType::OPTIMIZED_ENTRY_FRAME: {
OptimizedEntryFrameState *state = reinterpret_cast<OptimizedEntryFrameState *>(
reinterpret_cast<long long>(sp_) - MEMBER_OFFSET(OptimizedEntryFrameState, base.prev));
sp_ = reinterpret_cast<JSTaggedType *>(state->threadFp);
break;
}
default:
UNREACHABLE();
}
if (sp_ == nullptr) {
return;
}
type = GetFrameType();
}
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
FrameState *state = reinterpret_cast<FrameState *>(sp_) - 1;
sp_ = state->base.prev;
}
FrameType InterpretedFrameHandler::GetFrameType()
void InterpretedFrameHandler::PrevInterpretedFrame()
{
FrameType type = *(reinterpret_cast<FrameType*>(
reinterpret_cast<long long>(sp_) + FrameConst::FRAME_TYPE_OFFSET));
return type;
FrameHandler::PrevFrame();
for(;HasFrame() && GetFrameType() != FrameType::INTERPRETER_FRAME; FrameHandler::PrevFrame());
}
InterpretedFrameHandler InterpretedFrameHandler::GetPrevFrame() const
@ -231,6 +208,13 @@ void InterpretedFrameHandler::DumpPC(std::ostream &os, const uint8_t *pc) const
os << "offset: " << offset << "\n";
}
void OptimizedFrameHandler::PrevFrame()
{
OptimizedFrameStateBase *state = reinterpret_cast<OptimizedFrameStateBase *>(
reinterpret_cast<long long>(sp_) - MEMBER_OFFSET(OptimizedFrameStateBase, prev));
sp_ = reinterpret_cast<JSTaggedType *>(state->prev);
}
void OptimizedFrameHandler::Iterate(const RootVisitor &v0, const RootRangeVisitor &v1) const
{
uintptr_t *current = fp_;
@ -251,6 +235,13 @@ void OptimizedFrameHandler::Iterate(const RootVisitor &v0, const RootRangeVisito
}
}
void OptimizedEntryFrameHandler::PrevFrame()
{
OptimizedEntryFrameState *state = reinterpret_cast<OptimizedEntryFrameState *>(
reinterpret_cast<long long>(sp_) - MEMBER_OFFSET(OptimizedEntryFrameState, base.prev));
sp_ = reinterpret_cast<JSTaggedType *>(state->threadFp);
}
void OptimizedEntryFrameHandler::Iterate(const RootVisitor &v0, const RootRangeVisitor &v1) const
{
uintptr_t *current = fp_;

View File

@ -16,6 +16,7 @@
#ifndef ECMASCRIPT_INTERPRETER_FRAME_HANDLER_H
#define ECMASCRIPT_INTERPRETER_FRAME_HANDLER_H
#include "ecmascript/interpreter/interpreter.h"
#include "ecmascript/js_method.h"
#include "ecmascript/js_tagged_value.h"
#include "ecmascript/mem/heap_roots.h"
@ -27,17 +28,49 @@ class JSThread;
class JSFunction;
class ConstantPool;
class InterpretedFrameHandler {
class FrameHandler {
public:
explicit InterpretedFrameHandler(JSTaggedType *sp) : sp_(sp) {}
explicit InterpretedFrameHandler(const JSThread *thread);
~InterpretedFrameHandler() = default;
explicit FrameHandler(JSTaggedType *sp) : sp_(sp) {}
~FrameHandler() = default;
DEFAULT_COPY_SEMANTIC(FrameHandler);
DEFAULT_MOVE_SEMANTIC(FrameHandler);
bool HasFrame() const
{
// Breakframe also is a frame
return sp_ != nullptr;
}
bool IsBreakFrame() const
{
ASSERT(HasFrame());
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
FrameState *state = reinterpret_cast<FrameState *>(sp_) - 1;
return state->sp == nullptr;
}
void PrevFrame();
FrameType GetFrameType() const
{
ASSERT(HasFrame());
FrameType type = *(reinterpret_cast<FrameType*>(
reinterpret_cast<long long>(sp_) + FrameConst::FRAME_TYPE_OFFSET));
return type;
}
JSTaggedType *GetCurrentSp() { return sp_; }
private:
friend class InterpretedFrameHandler;
friend class OptimizedFrameHandler;
friend class OptimizedEntryFrameHandler;
JSTaggedType *sp_{nullptr};
};
class InterpretedFrameHandler : public FrameHandler {
public:
explicit InterpretedFrameHandler(JSTaggedType *sp) : FrameHandler(sp) {}
DEFAULT_COPY_SEMANTIC(InterpretedFrameHandler);
DEFAULT_MOVE_SEMANTIC(InterpretedFrameHandler);
bool HasFrame() const;
bool IsBreakFrame() const;
void PrevFrame();
void PrevInterpretedFrame();
InterpretedFrameHandler GetPrevFrame() const;
JSTaggedValue GetVRegValue(size_t index) const;
@ -65,27 +98,25 @@ public:
{
DumpPC(std::cout, pc);
}
private:
FrameType GetFrameType();
JSTaggedType *sp_{nullptr};
};
class OptimizedFrameHandler {
class OptimizedFrameHandler : public FrameHandler {
public:
explicit OptimizedFrameHandler(uintptr_t *fp) : fp_(fp) {}
explicit OptimizedFrameHandler(uintptr_t *fp) : FrameHandler(fp), fp_(fp) {}
explicit OptimizedFrameHandler(const JSThread *thread);
~OptimizedFrameHandler() = default;
void PrevFrame();
void Iterate(const RootVisitor &v0, const RootRangeVisitor &v1) const;
private:
uintptr_t *fp_ {nullptr};
};
class OptimizedEntryFrameHandler {
class OptimizedEntryFrameHandler : public FrameHandler {
public:
explicit OptimizedEntryFrameHandler(uintptr_t *fp) : fp_(fp) {}
explicit OptimizedEntryFrameHandler(uintptr_t *fp) : FrameHandler(fp), fp_(fp) {}
explicit OptimizedEntryFrameHandler(const JSThread *thread);
~OptimizedEntryFrameHandler() = default;
void PrevFrame();
void Iterate(const RootVisitor &v0, const RootRangeVisitor &v1) const;
private:
uintptr_t *fp_ {nullptr};

View File

@ -23,6 +23,7 @@
#include "ecmascript/ic/ic_runtime_stub-inl.h"
#include "ecmascript/interpreter/fast_runtime_stub-inl.h"
#include "ecmascript/interpreter/interpreter.h"
#include "ecmascript/interpreter/frame_handler.h"
#include "ecmascript/interpreter/slow_runtime_stub.h"
#include "ecmascript/js_generator_object.h"
#include "ecmascript/js_tagged_value.h"
@ -203,7 +204,7 @@ namespace panda::ecmascript {
#define GET_ACC() (acc) // NOLINT(cppcoreguidelines-macro-usage)
#define SET_ACC(val) (acc = val); // NOLINT(cppcoreguidelines-macro-usage)
JSTaggedType *EcmaInterpreter::GetCurrentInterPreterFrameSp(JSThread *thread)
JSTaggedType *EcmaInterpreter::GetCurrentInterpretedFrameSp(JSThread *thread)
{
JSTaggedType *originalPrevSp = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
auto current = originalPrevSp;
@ -220,7 +221,7 @@ JSTaggedType *EcmaInterpreter::GetCurrentInterPreterFrameSp(JSThread *thread)
JSTaggedValue EcmaInterpreter::ExecuteNative(JSThread *thread, const CallParams& params)
{
INTERPRETER_TRACE(thread, ExecuteNative);
JSTaggedType *sp = GetCurrentInterPreterFrameSp(thread);
JSTaggedType *sp = GetCurrentInterpretedFrameSp(thread);
JSMethod *methodToCall = params.callTarget->GetCallTarget();
ASSERT(methodToCall->GetNumVregs() == 0);
@ -267,7 +268,7 @@ JSTaggedValue EcmaInterpreter::Execute(JSThread *thread, const CallParams& param
}
JSTaggedType *originalPrevSp = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
JSTaggedType *sp = GetCurrentInterPreterFrameSp(thread);
JSTaggedType *sp = GetCurrentInterpretedFrameSp(thread);
JSTaggedType *newSp = sp - FRAME_STATE_SIZE;
// push break state
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
@ -465,8 +466,9 @@ void EcmaInterpreter::ResumeContext(JSThread *thread)
void EcmaInterpreter::NotifyBytecodePcChanged(JSThread *thread)
{
InterpretedFrameHandler frameHandler(thread);
for (; frameHandler.HasFrame(); frameHandler.PrevFrame()) {
JSTaggedType *sp = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
InterpretedFrameHandler frameHandler(sp);
for (; frameHandler.HasFrame(); frameHandler.PrevInterpretedFrame()) {
if (frameHandler.IsBreakFrame()) {
continue;
}
@ -3228,7 +3230,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool
InterpretedFrameHandler frameHandler(sp);
uint32_t pcOffset = panda_file::INVALID_OFFSET;
for (; frameHandler.HasFrame(); frameHandler.PrevFrame()) {
for (; frameHandler.HasFrame(); frameHandler.PrevInterpretedFrame()) {
if (frameHandler.IsBreakFrame()) {
return;
}

View File

@ -66,7 +66,7 @@ public:
static inline JSTaggedValue Execute(JSThread *thread, const CallParams& params);
static inline JSTaggedValue ExecuteNative(JSThread *thread, const CallParams& params);
static inline JSTaggedType *GetCurrentInterPreterFrameSp(JSThread *thread);
static inline JSTaggedType *GetCurrentInterpretedFrameSp(JSThread *thread);
static inline JSTaggedValue GeneratorReEnterInterpreter(JSThread *thread, JSHandle<GeneratorContext> context);
static inline void ChangeGenContext(JSThread *thread, JSHandle<GeneratorContext> context);
static inline void ResumeContext(JSThread *thread);

View File

@ -82,7 +82,8 @@ JSTaggedValue SlowRuntimeHelper::NewObject(JSThread *thread, JSHandle<JSTaggedVa
void SlowRuntimeHelper::SaveFrameToContext(JSThread *thread, JSHandle<GeneratorContext> context)
{
InterpretedFrameHandler frameHandler(thread);
auto sp = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
InterpretedFrameHandler frameHandler(sp);
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
uint32_t nregs = frameHandler.GetSize();
JSHandle<TaggedArray> regsArray = factory->NewTaggedArray(nregs);
@ -122,7 +123,8 @@ JSTaggedValue ConstructGeneric(JSThread *thread, JSHandle<JSFunction> ctor, JSHa
}
// Add the input parameter
InterpretedFrameHandler frameHandler(thread);
auto sp = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
InterpretedFrameHandler frameHandler(sp);
CallParams params;
params.callTarget = ECMAObject::Cast(*ctor);
params.newTarget = newTgt.GetTaggedType();
@ -221,7 +223,8 @@ JSTaggedValue ConstructProxy(JSThread *thread, JSHandle<JSProxy> ctor, JSHandle<
args->Set(thread, i, value);
}
}
InterpretedFrameHandler frameHandler(thread);
auto sp = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
InterpretedFrameHandler frameHandler(sp);
for (array_size_t i = 0; i < argsCount; ++i) {
JSTaggedValue value = frameHandler.GetVRegValue(baseArgLocation + i);
args->Set(thread, i + preArgsSize, value);

View File

@ -23,6 +23,7 @@
#include "ecmascript/ic/profile_type_info.h"
#include "ecmascript/internal_call_params.h"
#include "ecmascript/interpreter/fast_runtime_stub-inl.h"
#include "ecmascript/interpreter/frame_handler.h"
#include "ecmascript/interpreter/slow_runtime_helper.h"
#include "ecmascript/js_arguments.h"
#include "ecmascript/js_array.h"
@ -439,7 +440,8 @@ JSTaggedValue SlowRuntimeStub::CreateObjectWithExcludedKeys(JSThread *thread, ui
JSHandle<JSObject> obj(thread, objVal);
array_size_t numExcludedKeys = 0;
JSHandle<TaggedArray> excludedKeys = factory->NewTaggedArray(numKeys + 1);
InterpretedFrameHandler frameHandler(thread);
auto sp = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
InterpretedFrameHandler frameHandler(sp);
JSTaggedValue excludedKey = frameHandler.GetVRegValue(firstArgRegIdx);
if (!excludedKey.IsUndefined()) {
numExcludedKeys = numKeys + 1;
@ -1732,7 +1734,8 @@ JSTaggedValue SlowRuntimeStub::SuperCall(JSThread *thread, JSTaggedValue func, J
INTERPRETER_TRACE(thread, SuperCall);
[[maybe_unused]] EcmaHandleScope handleScope(thread);
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
InterpretedFrameHandler frameHandler(thread);
auto sp = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
InterpretedFrameHandler frameHandler(sp);
JSHandle<JSTaggedValue> funcHandle(thread, func);
JSHandle<JSTaggedValue> newTargetHandle(thread, newTarget);
@ -1757,7 +1760,8 @@ JSTaggedValue SlowRuntimeStub::SuperCallSpread(JSThread *thread, JSTaggedValue f
{
INTERPRETER_TRACE(thread, SuperCallSpread);
[[maybe_unused]] EcmaHandleScope handleScope(thread);
InterpretedFrameHandler frameHandler(thread);
auto sp = const_cast<JSTaggedType *>(thread->GetCurrentSPFrame());
InterpretedFrameHandler frameHandler(sp);
JSHandle<JSTaggedValue> funcHandle(thread, func);
JSHandle<JSTaggedValue> newTargetHandle(thread, newTarget);

View File

@ -16,6 +16,7 @@
#ifndef ECMASCRIPT_INTERPRETER_SLOW_RUNTIME_STUB_H
#define ECMASCRIPT_INTERPRETER_SLOW_RUNTIME_STUB_H
#include "ecmascript/class_linker/program_object.h"
#include "ecmascript/js_tagged_value.h"
#include "ecmascript/js_thread.h"

View File

@ -19,7 +19,6 @@
#include "ecmascript/compiler/fast_stub_define.h"
#include "ecmascript/ecma_global_storage.h"
#include "ecmascript/global_env_constants.h"
#include "ecmascript/interpreter/frame_handler.h"
#include "ecmascript/mem/heap_roots.h"
#include "include/thread.h"
#include "ecmascript/frames.h"

View File

@ -31,6 +31,7 @@
#include "ecmascript/ic/profile_type_info.h"
#include "ecmascript/ic/property_box.h"
#include "ecmascript/ic/proto_change_details.h"
#include "ecmascript/interpreter/frame_handler.h"
#include "ecmascript/internal_call_params.h"
#include "ecmascript/jobs/micro_job_queue.h"
#include "ecmascript/jobs/pending_job.h"
@ -2090,7 +2091,8 @@ JSHandle<JSObject> ObjectFactory::NewEmptyJSObject()
EcmaString *ObjectFactory::ResolveString(uint32_t stringId)
{
JSMethod *caller = InterpretedFrameHandler(thread_).GetMethod();
auto sp = const_cast<JSTaggedType *>(thread_->GetCurrentSPFrame());
JSMethod *caller = InterpretedFrameHandler(sp).GetMethod();
auto *pf = caller->GetPandaFile();
auto id = panda_file::File::EntityId(stringId);
auto foundStr = pf->GetStringData(id);

View File

@ -53,8 +53,9 @@ CString DebuggerApi::ConvertToString(const std::string &str)
uint32_t DebuggerApi::GetStackDepth(const EcmaVM *ecmaVm)
{
uint32_t count = 0;
InterpretedFrameHandler frameHandler(ecmaVm->GetJSThread());
for (; frameHandler.HasFrame(); frameHandler.PrevFrame()) {
JSTaggedType *sp = const_cast<JSTaggedType *>(ecmaVm->GetJSThread()->GetCurrentSPFrame());
InterpretedFrameHandler frameHandler(sp);
for (; frameHandler.HasFrame(); frameHandler.PrevInterpretedFrame()) {
if (frameHandler.IsBreakFrame()) {
continue;
}
@ -65,8 +66,9 @@ uint32_t DebuggerApi::GetStackDepth(const EcmaVM *ecmaVm)
bool DebuggerApi::StackWalker(const EcmaVM *ecmaVm, std::function<StackState(const InterpretedFrameHandler *)> func)
{
InterpretedFrameHandler frameHandler(ecmaVm->GetJSThread());
for (; frameHandler.HasFrame(); frameHandler.PrevFrame()) {
JSTaggedType *sp = const_cast<JSTaggedType *>(ecmaVm->GetJSThread()->GetCurrentSPFrame());
InterpretedFrameHandler frameHandler(sp);
for (; frameHandler.HasFrame(); frameHandler.PrevInterpretedFrame()) {
if (frameHandler.IsBreakFrame()) {
continue;
}
@ -84,24 +86,28 @@ bool DebuggerApi::StackWalker(const EcmaVM *ecmaVm, std::function<StackState(con
uint32_t DebuggerApi::GetBytecodeOffset(const EcmaVM *ecmaVm)
{
return InterpretedFrameHandler(ecmaVm->GetJSThread()).GetBytecodeOffset();
JSTaggedType *sp = const_cast<JSTaggedType *>(ecmaVm->GetJSThread()->GetCurrentSPFrame());
return InterpretedFrameHandler(sp).GetBytecodeOffset();
}
JSMethod *DebuggerApi::GetMethod(const EcmaVM *ecmaVm)
{
return InterpretedFrameHandler(ecmaVm->GetJSThread()).GetMethod();
JSTaggedType *sp = const_cast<JSTaggedType *>(ecmaVm->GetJSThread()->GetCurrentSPFrame());
return InterpretedFrameHandler(sp).GetMethod();
}
Local<JSValueRef> DebuggerApi::GetVRegValue(const EcmaVM *ecmaVm, size_t index)
{
auto value = InterpretedFrameHandler(ecmaVm->GetJSThread()).GetVRegValue(index);
JSTaggedType *sp = const_cast<JSTaggedType *>(ecmaVm->GetJSThread()->GetCurrentSPFrame());
auto value = InterpretedFrameHandler(sp).GetVRegValue(index);
JSHandle<JSTaggedValue> handledValue(ecmaVm->GetJSThread(), value);
return JSNApiHelper::ToLocal<JSValueRef>(handledValue);
}
void DebuggerApi::SetVRegValue(const EcmaVM *ecmaVm, size_t index, Local<JSValueRef> value)
{
return InterpretedFrameHandler(ecmaVm->GetJSThread()).SetVRegValue(index, JSNApiHelper::ToJSTaggedValue(*value));
JSTaggedType *sp = const_cast<JSTaggedType *>(ecmaVm->GetJSThread()->GetCurrentSPFrame());
return InterpretedFrameHandler(sp).SetVRegValue(index, JSNApiHelper::ToJSTaggedValue(*value));
}
uint32_t DebuggerApi::GetBytecodeOffset(const InterpretedFrameHandler *frameHandler)