mirror of
https://github.com/openharmony/ark_js_runtime.git
synced 2026-07-25 14:05:38 -04:00
b4b4482475
refactor frame add FrameIterator to visit frame issue:https://gitee.com/openharmony/ark_js_runtime/issues/I5BSW4 Signed-off-by: songzhengchao <songzhengchao@huawei.com> Change-Id: Ieb408a2334098043e504a8527aac008b8d0181a1
31 lines
917 B
C++
31 lines
917 B
C++
#include "ecmascript/frames.h"
|
|
namespace panda::ecmascript {
|
|
|
|
#define IMPLEMENT_GET_FRAME(Frame) \
|
|
template<> \
|
|
Frame* FrameIterator::GetFrame() \
|
|
{ \
|
|
return Frame::GetFrameFromSp(current_); \
|
|
}
|
|
FRAME_LIST(IMPLEMENT_GET_FRAME)
|
|
#undef IMPLEMENT_GET_FRAME
|
|
|
|
void FrameIterator::Advance()
|
|
{
|
|
ASSERT(!done());
|
|
FrameType t = GetFrameType();
|
|
switch (t) {
|
|
#define CASE(FRAME, Type) \
|
|
case FrameType::Type : { \
|
|
auto frame = GetFrame<FRAME>(); \
|
|
current_ = frame->GetPrevFrameFp(); \
|
|
break; \
|
|
}
|
|
FRAME_AND_TYPE_LIST(CASE)
|
|
#undef CASE
|
|
default: {
|
|
UNREACHABLE();
|
|
}
|
|
}
|
|
}
|
|
} // namespace panda::ecmascript
|