From a0ee78c834c18c7a21f2fc3b57f757c086dbbab3 Mon Sep 17 00:00:00 2001 From: Nazarov Konstantin Date: Thu, 8 Sep 2022 00:00:52 +0300 Subject: [PATCH] fixed naming runtime/interpreter Change-Id: I116f7d2dfdbd3784bc86dca3e68e4930e0f11c59 Signed-off-by: Nazarov Konstantin --- runtime/interpreter/ecma-interpreter-inl.h | 937 ++++++------- runtime/interpreter/fast_runtime_stub-inl.h | 508 +++---- runtime/interpreter/fast_runtime_stub.h | 50 +- runtime/interpreter/interpreter-inl.h | 26 +- runtime/interpreter/interpreter.h | 10 +- runtime/interpreter/js_decode_call_instr.h | 58 +- runtime/interpreter/slow_runtime_helper.cpp | 144 +- runtime/interpreter/slow_runtime_helper.h | 8 +- runtime/interpreter/slow_runtime_stub.cpp | 1338 ++++++++++--------- runtime/interpreter/slow_runtime_stub.h | 63 +- 10 files changed, 1574 insertions(+), 1568 deletions(-) diff --git a/runtime/interpreter/ecma-interpreter-inl.h b/runtime/interpreter/ecma-interpreter-inl.h index 053c1ef86..a20b20ff3 100644 --- a/runtime/interpreter/ecma-interpreter-inl.h +++ b/runtime/interpreter/ecma-interpreter-inl.h @@ -69,25 +69,25 @@ namespace panda::ecmascript { UNUSED_VAR(rhs) #endif -template +template class JSFrameHelper { public: - template + template ALWAYS_INLINE static uint32_t GetNumberActualArgsDyn([[maybe_unused]] InstructionHandler *instr_handler) { - return JSGetNumberActualArgsDyn(instr_handler->GetInst()); + return JSGetNumberActualArgsDyn(instr_handler->GetInst()); } - template + template ALWAYS_INLINE static void CopyArgumentsDyn(InstructionHandler *instr_handler, Frame *new_frame, uint32_t num_vregs, uint32_t num_actual_args) { - uint16_t prev_v0 = instr_handler->GetInst().template GetVReg(); + uint16_t prev_v0 = instr_handler->GetInst().template GetVReg(); Frame *prev_frame = instr_handler->GetFrame(); BytecodeInstruction prev_inst = instr_handler->GetInst(); auto *thread = JSThread::Cast(instr_handler->GetThread()); - JSCopyArgumets(thread, prev_frame, prev_v0, prev_inst, new_frame, num_vregs, num_actual_args); + JSCopyArgumets(thread, prev_frame, prev_v0, prev_inst, new_frame, num_vregs, num_actual_args); } template @@ -99,17 +99,17 @@ public: } }; -template -class InstructionHandler : public interpreter::InstructionHandler { +template +class InstructionHandler : public interpreter::InstructionHandler { public: ALWAYS_INLINE inline InstructionHandler(interpreter::InstructionHandlerState *state) - : interpreter::InstructionHandler(state) + : interpreter::InstructionHandler(state) { } ALWAYS_INLINE JSThread *GetJSThread() const { - return JSThread::Cast(interpreter::InstructionHandler::GetThread()); + return JSThread::Cast(interpreter::InstructionHandler::GetThread()); } ALWAYS_INLINE JSTaggedValue GetRegAsTaggedValue(uint16_t v) @@ -127,18 +127,18 @@ public: return VRegAsTaggedValue(this->GetAcc()); } - JSTaggedType *GetStkArgs(uint16_t firstArgIdx) + JSTaggedType *GetStkArgs(uint16_t first_arg_idx) { static_assert(sizeof(interpreter::VRegister) == sizeof(JSTaggedType)); auto thread = JSThread::Cast(this->GetThread()); - return reinterpret_cast(&thread->GetCurrentFrame()->GetVReg(firstArgIdx)); + return reinterpret_cast(&thread->GetCurrentFrame()->GetVReg(first_arg_idx)); } JSTaggedValue GetThisFunction() { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - auto numVregs = this->GetFrame()->GetMethod()->GetNumVregs(); - return GetRegAsTaggedValue(numVregs); + auto num_vregs = this->GetFrame()->GetMethod()->GetNumVregs(); + return GetRegAsTaggedValue(num_vregs); } JSTaggedValue GetGlobalObject() @@ -174,18 +174,18 @@ public: this->GetAcc() = this->GetFrame()->GetAcc(); } - JSHandle GetMethodName(JSHandle callTarget) + JSHandle GetMethodName(JSHandle call_target) { auto thread = JSThread::Cast(this->GetThread()); - JSHandle thisFunc = JSHandle::Cast(callTarget); - return JSFunctionBase::GetFunctionName(thread, JSHandle(thisFunc)); + JSHandle this_func = JSHandle::Cast(call_target); + return JSFunctionBase::GetFunctionName(thread, JSHandle(this_func)); } - template + template ALWAYS_INLINE void HandleEcmaReturnDyn() { LOG_INST() << "ecma.return.dyn"; - this->template DoReturnDyn(); + this->template DoReturnDyn(); } // Redefine method from base class @@ -196,15 +196,15 @@ public: // Update EcmascirptEnv js_thread->SetEcmascriptEnv(js_thread->GetEcmascriptEnv()->GetPrevEnvironment()); - interpreter::InstructionHandler::HandleReturnStackless(); + interpreter::InstructionHandler::HandleReturnStackless(); } - template + template ALWAYS_INLINE void DoEcmaCallDyn() { this->UpdateBytecodeOffset(); - uint16_t v0 = this->GetInst().template GetVReg(); + uint16_t v0 = this->GetInst().template GetVReg(); uint64_t function = GetRegAsTaggedValue(v0).GetRawData(); JSThread *js_thread = this->GetJSThread(); if (UNLIKELY(!JSTaggedValue(function).IsCallable())) { @@ -221,7 +221,7 @@ public: ASSERT(method->GetNumVregs() == 0); uint32_t num_declared_args = method->GetNumArgs(); - uint32_t num_actual_args = JSGetNumberActualArgsDyn(this->GetInst()); + uint32_t num_actual_args = JSGetNumberActualArgsDyn(this->GetInst()); uint32_t num_args = std::max(num_declared_args, num_actual_args); Frame *prev_frame = this->GetFrame(); @@ -229,7 +229,7 @@ public: Frame *frame = JSFrame::CreateNativeFrame(js_thread, method, js_thread->GetCurrentFrame(), num_args, num_actual_args); - JSCopyArgumets(this->GetJSThread(), prev_frame, v0, prev_inst, frame, 0, num_actual_args); + JSCopyArgumets(this->GetJSThread(), prev_frame, v0, prev_inst, frame, 0, num_actual_args); // Call native method JSTaggedValue ret_value = JSFrame::ExecuteNativeMethod(js_thread, frame, method, num_actual_args); @@ -241,7 +241,7 @@ public: } ASSERT(JSTaggedValue(ret_value).IsException() == false); SetAccFromTaggedValue(ret_value); - this->template MoveToNextInst(); + this->template MoveToNextInst(); return; } @@ -256,7 +256,7 @@ public: if (method->HasCompiledCode()) { // AOT, JIT EcmascriptEnvironment *prev_env = js_thread->GetEcmascriptEnv(); - this->template CallCompiledCode(method); + this->template CallCompiledCode(method); // Restore EcmascriptEnvironment if epilogue was not executed if (UNLIKELY(js_thread->HasPendingException())) { js_thread->SetEcmascriptEnv(prev_env); @@ -265,7 +265,7 @@ public: EcmascriptEnvironment *prev_env = js_thread->GetEcmascriptEnv(); // Call stackless interpreter - this->template CallInterpreterStackless, format, true, false, false, false>(method); + this->template CallInterpreterStackless, FORMAT, true, false, false, false>(method); ConstantPool *constant_pool = ConstantPool::Cast(js_function->GetConstantPool().GetHeapObject()); JSTaggedValue lexical_env = js_function->GetLexicalEnv(); @@ -279,83 +279,83 @@ public: } } - template + template ALWAYS_INLINE void HandleEcmaCall0dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "call0.dyn " << "v" << v0; - this->template DoEcmaCallDyn(); + this->template DoEcmaCallDyn(); } - template + template ALWAYS_INLINE void HandleEcmaCall1dyn() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "call1.dyn " << "v" << v0 << ", v" << v1; - this->template DoEcmaCallDyn(); + this->template DoEcmaCallDyn(); } - template + template ALWAYS_INLINE void HandleEcmaCall2dyn() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); - auto v2 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); + auto v2 = this->GetInst().template GetVReg(); LOG_INST() << "call2.dyn " << "v" << v0 << ", v" << v1 << ", v" << v2; - this->template DoEcmaCallDyn(); + this->template DoEcmaCallDyn(); } - template + template ALWAYS_INLINE void HandleEcmaCall3dyn() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); - auto v2 = this->GetInst().template GetVReg(); - auto v3 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); + auto v2 = this->GetInst().template GetVReg(); + auto v3 = this->GetInst().template GetVReg(); LOG_INST() << "call3.dyn " << "v" << v0 << ", v" << v1 << ", v" << v2 << ", v" << v3; - this->template DoEcmaCallDyn(); + this->template DoEcmaCallDyn(); } - template + template ALWAYS_INLINE void HandleEcmaCallirangedyn() { - auto v0 = this->GetInst().template GetVReg(); - auto num_args = this->GetInst().template GetImm(); + auto v0 = this->GetInst().template GetVReg(); + auto num_args = this->GetInst().template GetImm(); auto func = GetRegAsTaggedValue(v0); LOG_INST() << "calli.rangedyn " << num_args + 3 << ", v" << v0 << " , func:" << func.GetRawData(); - this->template DoEcmaCallDyn(); + this->template DoEcmaCallDyn(); } - template + template ALWAYS_INLINE void HandleEcmaCallithisrangedyn() { - auto v0 = this->GetInst().template GetVReg(); - auto num_args = this->GetInst().template GetImm(); + auto v0 = this->GetInst().template GetVReg(); + auto num_args = this->GetInst().template GetImm(); LOG_INST() << "calli.dyn.this.range " << num_args + 2 << ", v" << v0; - this->template DoEcmaCallDyn(); + this->template DoEcmaCallDyn(); } - template + template ALWAYS_INLINE void HandleEcmaCallspreaddyn() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); - auto v2 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); + auto v2 = this->GetInst().template GetVReg(); LOG_INST() << "callspreaddyn" << " v" << v0 << " v" << v1 << " v" << v2; @@ -365,13 +365,13 @@ public: uint64_t array = GetRegAsTaggedValue(v2).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::CallspreadDyn(this->GetJSThread(), func, obj, array)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaJfalse() { - auto imm = this->GetInst().template GetImm(); + auto imm = this->GetInst().template GetImm(); LOG_INST() << "jfalse" << imm; auto acc = GetAccAsTaggedValue(); @@ -381,14 +381,14 @@ public: this->template JumpToInst(imm); } else { this->template UpdateBranchStatistics(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } } - template + template ALWAYS_INLINE void HandleEcmaJtrue() { - auto imm = this->GetInst().template GetImm(); + auto imm = this->GetInst().template GetImm(); LOG_INST() << "jtrue" << imm; auto acc = GetAccAsTaggedValue(); @@ -398,140 +398,141 @@ public: this->template JumpToInst(imm); } else { this->template UpdateBranchStatistics(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } } - template + template ALWAYS_INLINE void HandleEcmaLdinfinity() { LOG_INST() << "ldinfinity"; INTRINSIC_CALL_SETACC(intrinsics::Ldinfinity()); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdglobalthis() { LOG_INST() << "ldglobalthis"; INTRINSIC_CALL_SETACC(intrinsics::Ldglobalthis(this->GetJSThread())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdundefined() { LOG_INST() << "ldundefined"; INTRINSIC_CALL_SETACC(intrinsics::Ldundefined()); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdnull() { LOG_INST() << "ldnull"; INTRINSIC_CALL_SETACC(intrinsics::Ldnull()); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdsymbol() { LOG_INST() << "ldsymbol"; INTRINSIC_CALL_SETACC(intrinsics::Ldsymbol(this->GetJSThread())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdglobal() { LOG_INST() << "ldglobal"; INTRINSIC_CALL_SETACC(intrinsics::Ldglobal(this->GetJSThread())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdtrue() { LOG_INST() << "ldtrue"; INTRINSIC_CALL_SETACC(intrinsics::Ldtrue()); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdfalse() { LOG_INST() << "ldfalse"; INTRINSIC_CALL_SETACC(intrinsics::Ldfalse()); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdlexenvdyn() { LOG_INST() << "ldlexenvDyn "; INTRINSIC_CALL_SETACC(intrinsics::LdlexenvDyn(this->GetJSThread())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaGetunmappedargs() { LOG_INST() << "getunmappedargs"; - uint32_t actualNumArgs = this->GetFrame()->GetNumActualArgs() - NUM_MANDATORY_JSFUNC_ARGS; // not compile-time - uint32_t startIdx = this->GetFrame()->GetMethod()->GetNumVregs() + NUM_MANDATORY_JSFUNC_ARGS; + uint32_t actual_num_args = + this->GetFrame()->GetNumActualArgs() - NUM_MANDATORY_JSFUNC_ARGS; // not compile-time + uint32_t start_idx = this->GetFrame()->GetMethod()->GetNumVregs() + NUM_MANDATORY_JSFUNC_ARGS; auto thread = JSThread::Cast(this->GetThread()); - JSTaggedValue res = SlowRuntimeStub::GetUnmappedArgs(thread, actualNumArgs, GetStkArgs(startIdx)); + JSTaggedValue res = SlowRuntimeStub::GetUnmappedArgs(thread, actual_num_args, GetStkArgs(start_idx)); INTERPRETER_RETURN_IF_ABRUPT(res); SetAccFromTaggedValue(res); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaAsyncfunctionenter() { LOG_INST() << "asyncfunctionenter"; INTRINSIC_CALL_CHECK_SETACC(intrinsics::AsyncFunctionEnter(this->GetJSThread())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdboolean() { // it38 Unimplement UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaLdnumber() { // it38 Unimplement UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaLdstring() { // it38 Unimplement UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaLdbigint() { // it38 Unimplement UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaTonumber() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::tonumber" << " v" << v0; uint64_t value = GetRegAsTaggedValue(v0).GetRawData(); @@ -540,13 +541,13 @@ public: UPDATE_UNARY_ARITH_PROFILE(value); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaNegdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "negdyn" << " v" << v0; @@ -556,13 +557,13 @@ public: UPDATE_UNARY_ARITH_PROFILE(value); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaNotdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "notdyn" << " v" << v0; @@ -572,13 +573,13 @@ public: UPDATE_UNARY_ARITH_PROFILE(value); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaIncdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "incdyn" << " v" << v0; @@ -588,13 +589,13 @@ public: UPDATE_UNARY_ARITH_PROFILE(value); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDecdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "decdyn" << " v" << v0; @@ -604,10 +605,10 @@ public: UPDATE_UNARY_ARITH_PROFILE(value); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaRethrowdyn() { LOG_INST() << "rethrowdyn"; @@ -615,7 +616,7 @@ public: auto acc = GetAccAsTaggedValue(); if (acc.IsHole()) { - this->template MoveToNextInst(); + this->template MoveToNextInst(); return; } @@ -624,7 +625,7 @@ public: return; } - template + template ALWAYS_INLINE void HandleEcmaThrowdyn() { LOG_INST() << "throwdyn"; @@ -634,17 +635,17 @@ public: this->MoveToExceptionHandler(); } - template + template ALWAYS_INLINE void HandleEcmaTypeofdyn() { LOG_INST() << "typeofdyn"; uint64_t acc = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_SETACC(intrinsics::TypeofDyn(this->GetJSThread(), acc)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaToboolean() { LOG_INST() << "toboolean"; @@ -653,10 +654,10 @@ public: INTRINSIC_CALL_SETACC(intrinsics::Toboolean(GetAccAsTaggedValue().GetRawData())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaNegate() { LOG_INST() << "negate"; @@ -665,50 +666,50 @@ public: UPDATE_UNARY_ARITH_PROFILE(value); INTRINSIC_CALL_SETACC(intrinsics::Negate(value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaIsundefined() { LOG_INST() << "isundefined"; uint64_t value = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_SETACC(intrinsics::IsUndefined(value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaIstrue() { LOG_INST() << "istrue"; uint64_t value = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_SETACC(intrinsics::IsTrue(value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaIsfalse() { LOG_INST() << "isfalse"; uint64_t value = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_SETACC(intrinsics::IsFalse(value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaIscoercible() { LOG_INST() << "iscoercible"; uint64_t value = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_SETACC(intrinsics::IsCoercible(value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaGetpropiterator() { LOG_INST() << "getpropiterator"; @@ -716,36 +717,36 @@ public: uint64_t acc = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::GetPropIterator(this->GetJSThread(), acc)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaResumegenerator() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "resumegenerator" << " v" << v0; uint64_t value = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_SETACC(intrinsics::ResumeGenerator(value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaGetresumemode() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "getresumemode" << " v" << v0; uint64_t value = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_SETACC(intrinsics::GetResumeMode(value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaGetiterator() { LOG_INST() << "getiterator"; @@ -753,10 +754,10 @@ public: uint64_t obj = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::GetIterator(this->GetJSThread(), obj)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaGetasynciterator() { LOG_INST() << "getasynciterator"; @@ -764,10 +765,10 @@ public: uint64_t obj = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::GetAsyncIterator(this->GetJSThread(), obj)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaThrowundefined() { // the instrunction has beed retired @@ -775,10 +776,10 @@ public: UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaThrowconstassignment() { - auto string_id = this->GetInst().template GetId(); + auto string_id = this->GetInst().template GetId(); auto prop = GetConstantPool(this->GetJSThread())->GetObjectFromCache(string_id.AsIndex()); LOG_INST() << "throwconstassignment " << "stringId:" << ConvertToPandaString(EcmaString::Cast(prop.GetHeapObject())); @@ -788,7 +789,7 @@ public: this->MoveToExceptionHandler(); } - template + template ALWAYS_INLINE void HandleEcmaThrowthrownotexists() { LOG_INST() << "throwthrownotexists"; @@ -797,7 +798,7 @@ public: this->MoveToExceptionHandler(); } - template + template ALWAYS_INLINE void HandleEcmaThrowpatternnoncoercible() { LOG_INST() << "throwpatternnoncoercible"; @@ -806,13 +807,13 @@ public: this->MoveToExceptionHandler(); } - template + template ALWAYS_INLINE void HandleEcmaThrowifnotobject() { LOG_INST() << "throwifnotobject"; if (GetAccAsTaggedValue().IsECMAObject()) { - this->template MoveToNextInst(); + this->template MoveToNextInst(); return; } auto thread = JSThread::Cast(this->GetThread()); @@ -820,10 +821,10 @@ public: this->MoveToExceptionHandler(); } - template + template ALWAYS_INLINE void HandleEcmaCloseiterator() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "closeiterator" << " v" << v0; @@ -831,27 +832,27 @@ public: uint64_t acc = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::CloseIterator(this->GetJSThread(), iter, acc)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdobject() { LOG_INST() << "-------------"; UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaLdfunction() { LOG_INST() << "-------------"; UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaAdd2dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::add2dyn" << " v" << v0; uint64_t left = GetRegAsTaggedValue(v0).GetRawData(); @@ -861,13 +862,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(left, right); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaSub2dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::sub2dyn" << " v" << v0; uint64_t left = GetRegAsTaggedValue(v0).GetRawData(); @@ -877,13 +878,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(left, right); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaMul2dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::mul2dyn" << " v" << v0; uint64_t left = GetRegAsTaggedValue(v0).GetRawData(); @@ -893,13 +894,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(left, right); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDiv2dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::div2dyn" << " v" << v0; uint64_t left = GetRegAsTaggedValue(v0).GetRawData(); @@ -909,26 +910,26 @@ public: UPDATE_BINARY_ARITH_PROFILE(left, right); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaMod2dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::mod2dyn" << " v" << v0; uint64_t left = GetRegAsTaggedValue(v0).GetRawData(); uint64_t right = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::Mod2Dyn(this->GetJSThread(), left, right)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaEqdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::eqdyn" << " v" << v0; uint64_t left = GetRegAsTaggedValue(v0).GetRawData(); @@ -937,13 +938,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(left, right); INTRINSIC_CALL_CHECK_SETACC(intrinsics::EqDyn(this->GetJSThread(), left, right)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaNoteqdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "noteqdyn" << " v" << v0; @@ -953,13 +954,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(lhs, rhs); INTRINSIC_CALL_CHECK_SETACC(intrinsics::NotEqDyn(this->GetJSThread(), lhs, rhs)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLessdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::lessdyn" << " v" << v0; uint64_t left = GetRegAsTaggedValue(v0).GetRawData(); @@ -968,13 +969,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(left, right); INTRINSIC_CALL_CHECK_SETACC(intrinsics::LessDyn(this->GetJSThread(), left, right)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLesseqdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::lesseqdyn" << " v" << v0; uint64_t left = GetRegAsTaggedValue(v0).GetRawData(); @@ -983,13 +984,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(left, right); INTRINSIC_CALL_CHECK_SETACC(intrinsics::LessEqDyn(this->GetJSThread(), left, right)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaGreaterdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::greaterdyn" << " v" << v0; uint64_t left = GetRegAsTaggedValue(v0).GetRawData(); @@ -998,13 +999,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(left, right); INTRINSIC_CALL_CHECK_SETACC(intrinsics::GreaterDyn(this->GetJSThread(), left, right)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaGreatereqdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::greatereqdyn" << " v" << v0; uint64_t left = GetRegAsTaggedValue(v0).GetRawData(); @@ -1013,13 +1014,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(left, right); INTRINSIC_CALL_CHECK_SETACC(intrinsics::GreaterEqDyn(this->GetJSThread(), left, right)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaShl2dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "shl2dyn" << " v" << v0; @@ -1030,13 +1031,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(lhs, rhs); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaShr2dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "shr2dyn" << " v" << v0; @@ -1047,13 +1048,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(lhs, rhs); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaAshr2dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "ashr2dyn" << " v" << v0; @@ -1061,13 +1062,13 @@ public: uint64_t rhs = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::Ashr2Dyn(this->GetJSThread(), lhs, rhs)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaAnd2dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "and2dyn" << " v" << v0; @@ -1078,13 +1079,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(lhs, rhs); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaOr2dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "or2dyn" << " v" << v0; @@ -1095,13 +1096,13 @@ public: UPDATE_BINARY_ARITH_PROFILE(lhs, rhs); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaXor2dyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "xor2dyn" << " v" << v0; @@ -1112,14 +1113,14 @@ public: UPDATE_BINARY_ARITH_PROFILE(lhs, rhs); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDelobjprop() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "delobjprop" << " v0" << v0 << " v1" << v1; @@ -1127,10 +1128,10 @@ public: uint64_t prop = GetRegAsTaggedValue(v1).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::Delobjprop(this->GetJSThread(), obj, prop)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDefineglobalvar() { // it38 Unimplement @@ -1138,7 +1139,7 @@ public: UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaDefinelocalvar() { // it38 Unimplement @@ -1146,7 +1147,7 @@ public: UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaDefinefuncexpr() { // it38 Unimplement @@ -1154,24 +1155,24 @@ public: UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaDefinefuncdyn() { - auto method_id = this->GetInst().template GetId(); - auto v0 = this->GetInst().template GetVReg(); + auto method_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "definefuncDyn" << " v" << v0 << std::hex << method_id; uint64_t env = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::DefinefuncDyn(this->GetJSThread(), method_id.AsIndex(), env)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDefinencfuncdyn() { - auto method_id = this->GetInst().template GetId(); - auto v0 = this->GetInst().template GetVReg(); + auto method_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "definencfuncDyn" << " v" << v0 << ", method_id: " << std::hex << method_id; @@ -1180,14 +1181,14 @@ public: INTRINSIC_CALL_CHECK_SETACC( intrinsics::DefineNCFuncDyn(this->GetJSThread(), method_id.AsIndex(), env, home_object)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDefinemethod() { - auto method_id = this->GetInst().template GetId(); - auto v0 = this->GetInst().template GetVReg(); + auto method_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "definemethod" << " v" << v0 << std::hex << method_id; @@ -1197,14 +1198,14 @@ public: SaveAccToFrame(); INTRINSIC_CALL_CHECK_SETACC( intrinsics::DefineMethod(this->GetJSThread(), method_id.AsIndex(), tagged_cur_env, home_object)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaNewobjdynrange() { - auto first_arg_reg_idx = this->GetInst().template GetVReg(); - auto num_args = this->GetInst().template GetImm(); + auto first_arg_reg_idx = this->GetInst().template GetVReg(); + auto num_args = this->GetInst().template GetImm(); LOG_INST() << "newobjDynrange " << num_args << " v" << first_arg_reg_idx; @@ -1212,20 +1213,20 @@ public: // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) INTRINSIC_CALL_CHECK_SETACC(intrinsics::NewobjDynrange(this->GetJSThread(), num_args - 2U, range_args[0], range_args[1], range_args + 2U)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaRefeqdyn() { LOG_INST() << "-------------"; UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaExpdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::expdyn" << " v" << v0; uint64_t base = GetRegAsTaggedValue(v0).GetRawData(); @@ -1233,10 +1234,10 @@ public: SaveAccToFrame(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::ExpDyn(this->GetJSThread(), base, exponent)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCallruntimerange() { // it38 Unimplement @@ -1244,10 +1245,10 @@ public: UNREACHABLE(); } - template + template ALWAYS_INLINE void HandleEcmaIsindyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "isindyn" << " v" << v0; @@ -1255,13 +1256,13 @@ public: uint64_t obj = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::IsinDyn(this->GetJSThread(), prop, obj)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaInstanceofdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "instanceofdyn" << " v" << v0; @@ -1269,13 +1270,13 @@ public: uint64_t target = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::InstanceofDyn(this->GetJSThread(), obj, target)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStrictnoteqdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "strictnoteq" << " v" << v0; @@ -1283,39 +1284,39 @@ public: uint64_t right = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_SETACC(intrinsics::StrictNotEqDyn(left, right)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStricteqdyn() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsics::stricteqdyn" << " v" << v0; uint64_t left = GetRegAsTaggedValue(v0).GetRawData(); uint64_t right = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::StrictEqDyn(left, right)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdlexvardyn() { - auto level = this->GetInst().template GetImm(); - auto slot = this->GetInst().template GetImm(); + auto level = this->GetInst().template GetImm(); + auto slot = this->GetInst().template GetImm(); LOG_INST() << "ldlexvardyn" << " level:" << level << " slot:" << slot; INTRINSIC_CALL_SETACC(intrinsics::LdLexVarDyn(this->GetJSThread(), level, slot)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStlexvardyn() { - auto level = this->GetInst().template GetImm(); - auto slot = this->GetInst().template GetImm(); + auto level = this->GetInst().template GetImm(); + auto slot = this->GetInst().template GetImm(); LOG_INST() << "stlexvardyn" << " level:" << level << " slot:" << slot; @@ -1323,47 +1324,47 @@ public: uint64_t value = GetAccAsTaggedValue().GetRawData(); intrinsics::StLexVarDyn(this->GetJSThread(), level, slot, value); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaNewlexenvdyn() { - auto numVars = this->GetInst().template GetImm(); + auto num_vars = this->GetInst().template GetImm(); LOG_INST() << "newlexenvdyn" - << " imm " << numVars; + << " imm " << num_vars; - INTRINSIC_CALL_CHECK_SETACC(intrinsics::NewlexenvDyn(this->GetJSThread(), numVars)); - this->template MoveToNextInst(); + INTRINSIC_CALL_CHECK_SETACC(intrinsics::NewlexenvDyn(this->GetJSThread(), num_vars)); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCopylexenvdyn() { LOG_INST() << "copylexenvdyn"; INTRINSIC_CALL_CHECK_SETACC(intrinsics::CopylexenvDyn()); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCreateiterresultobj() { - auto done = this->GetInst().template GetImm(); + auto done = this->GetInst().template GetImm(); LOG_INST() << "createiterresultobj" << " done " << std::boolalpha << done; uint64_t value = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::CreateIterResultObj(this->GetJSThread(), value, done)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaSuspendgenerator() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "suspendgenerator" << " v" << v0; @@ -1384,10 +1385,10 @@ public: // return to caller frame } - template + template ALWAYS_INLINE void HandleEcmaSuspendasyncgenerator() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "suspendasyncgenerator" << " v" << v0; @@ -1409,10 +1410,10 @@ public: // return to caller frame } - template + template ALWAYS_INLINE void HandleEcmaAsyncfunctionawait() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "asyncfunctionawait" << " v" << v0; @@ -1421,13 +1422,13 @@ public: uint64_t value = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::AsyncFunctionAwait(this->GetJSThread(), async_func_obj, value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaAsyncfunctionresolve() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "asyncfunctionresolve" << " v" << v0; @@ -1435,13 +1436,13 @@ public: uint64_t value = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::AsyncFunctionResolve(this->GetJSThread(), async_func_obj, value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaAsyncfunctionreject() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "asyncfunctionreject" << " v" << v0; @@ -1449,13 +1450,13 @@ public: uint64_t value = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::AsyncFunctionReject(this->GetJSThread(), async_func_obj, value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaAsyncgeneratorresolve() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "asyncgeneratorresolve" << " v" << v0; @@ -1463,13 +1464,13 @@ public: uint64_t value = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::AsyncGeneratorResolve(this->GetJSThread(), async_func_obj, value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaAsyncgeneratorreject() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "asyncgeneratorreject" << " v" << v0; @@ -1477,14 +1478,14 @@ public: uint64_t value = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::AsyncGeneratorReject(this->GetJSThread(), async_func_obj, value)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaNewobjspreaddyn() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsic::newobjspearddyn" << " v" << v0 << " v" << v1; @@ -1493,19 +1494,19 @@ public: uint64_t array = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::NewobjspreadDyn(this->GetJSThread(), func, new_target, array)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaThrowundefinedifhole() { - auto string_id = this->GetInst().template GetId(); + auto string_id = this->GetInst().template GetId(); auto prop = GetConstantPool(this->GetJSThread())->GetObjectFromCache(string_id.AsIndex()); LOG_INST() << "intrinsic::throwundefinedifhole " << "stringId:" << ConvertToPandaString(EcmaString::Cast(prop.GetHeapObject())); if (!GetAccAsTaggedValue().IsHole()) { - this->template MoveToNextInst(); + this->template MoveToNextInst(); return; } @@ -1514,11 +1515,11 @@ public: this->MoveToExceptionHandler(); } - template + template ALWAYS_INLINE void HandleEcmaStownbyname() { - auto v0 = this->GetInst().template GetVReg(); - auto id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); + auto id = this->GetInst().template GetId(); LOG_INST() << "stownbyname " << "v" << v0 << " stringId:" << id.AsIndex(); @@ -1529,64 +1530,64 @@ public: SaveAccToFrame(); INTRINSIC_CALL_CHECK(intrinsics::StOwnByName(this->GetJSThread(), id.AsIndex(), obj, value)); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCreateemptyarray() { LOG_INST() << "createemptyarray"; INTRINSIC_CALL_SETACC(intrinsics::CreateEmptyArray(this->GetJSThread())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCreateemptyobject() { LOG_INST() << "createemptyobject"; INTRINSIC_CALL_SETACC(intrinsics::CreateEmptyObject(this->GetJSThread())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCreateobjectwithbuffer() { - auto imm = this->GetInst().template GetImm(); + auto imm = this->GetInst().template GetImm(); LOG_INST() << "createobjectwithbuffer" << " imm:" << imm; INTRINSIC_CALL_CHECK_SETACC(intrinsics::CreateObjectWithBuffer(this->GetJSThread(), imm)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCreatearraywithbuffer() { - auto imm = this->GetInst().template GetImm(); + auto imm = this->GetInst().template GetImm(); LOG_INST() << "createarraywithbuffer" << " imm:" << imm; INTRINSIC_CALL_CHECK_SETACC(intrinsics::CreateArrayWithBuffer(this->GetJSThread(), imm)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaImportmodule() { - auto string_id = this->GetInst().template GetId(); + auto string_id = this->GetInst().template GetId(); LOG_INST() << "importmodule " << "stringId:" << std::hex << string_id.AsIndex(); INTRINSIC_CALL_SETACC(intrinsics::ImportModule(this->GetJSThread(), string_id.AsIndex())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStmodulevar() { - auto string_id = this->GetInst().template GetId(); + auto string_id = this->GetInst().template GetId(); LOG_INST() << "stmodulevar " << "stringId:" << string_id; @@ -1595,13 +1596,13 @@ public: SaveAccToFrame(); intrinsics::StModuleVar(this->GetJSThread(), string_id.AsIndex(), value); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCopymodule() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "copymodule " << " v" << v0; @@ -1609,14 +1610,14 @@ public: SaveAccToFrame(); intrinsics::CopyModule(this->GetJSThread(), src_module); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdmodvarbyname() { - auto v0 = this->GetInst().template GetVReg(); - auto string_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); + auto string_id = this->GetInst().template GetId(); LOG_INST() << "ldmodvarbyname " << "string_id:" << string_id.AsIndex(); @@ -1624,53 +1625,53 @@ public: uint64_t module_obj = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_SETACC(intrinsics::LdModvarByName(this->GetJSThread(), string_id.AsIndex(), module_obj)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaGetmethod() { - auto v0 = this->GetInst().template GetVReg(); - auto string_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); + auto string_id = this->GetInst().template GetId(); LOG_INST() << "getmethod v" << v0 << " stringId:" << string_id; uint64_t obj = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::GetMethod(this->GetJSThread(), string_id.AsIndex(), obj)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaGettemplateobject() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsic::gettemplateobject" << " v" << v0; uint64_t literal = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::GetTemplateObject(this->GetJSThread(), literal)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaGetnextpropname() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsic::getnextpropname" << " v" << v0; uint64_t iter = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::GetNextPropName(this->GetJSThread(), iter)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCopydataproperties() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsic::copydataproperties" << " v" << v0 << " v" << v1; @@ -1678,14 +1679,14 @@ public: uint64_t src = GetRegAsTaggedValue(v1).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::CopyDataProperties(this->GetJSThread(), dst, src)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStownbyindex() { - uint32_t idx = this->GetInst().template GetImm(); - auto v0 = this->GetInst().template GetVReg(); + uint32_t idx = this->GetInst().template GetImm(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "stownbyindex" << " v" << v0 << " imm" << idx; @@ -1695,14 +1696,14 @@ public: SaveAccToFrame(); INTRINSIC_CALL_CHECK(intrinsics::StOwnByIndex(this->GetJSThread(), idx, obj, value)); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStownbyvalue() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "stownbyvalue" << " v" << v0 << " v" << v1; @@ -1713,15 +1714,15 @@ public: SaveAccToFrame(); INTRINSIC_CALL_CHECK(intrinsics::StOwnByValue(this->GetJSThread(), receiver, prop_key, value)); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCreateobjectwithexcludedkeys() { - auto num_keys = this->GetInst().template GetImm(); - auto v0 = this->GetInst().template GetVReg(); - uint16_t first_arg_reg_idx = this->GetInst().template GetVReg(); + auto num_keys = this->GetInst().template GetImm(); + auto v0 = this->GetInst().template GetVReg(); + uint16_t first_arg_reg_idx = this->GetInst().template GetVReg(); LOG_INST() << "createobjectwithexcludedkeys " << num_keys << " v" << v0 << std::hex << first_arg_reg_idx; auto obj = GetRegAsTaggedValue(v0); @@ -1731,62 +1732,62 @@ public: INTERPRETER_RETURN_IF_ABRUPT(res); SetAccFromTaggedValue(res); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDefinegeneratorfunc() { - auto v0 = this->GetInst().template GetVReg(); - auto method_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); + auto method_id = this->GetInst().template GetId(); LOG_INST() << "define generator function" << " v" << v0; uint64_t env = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::DefineGeneratorFunc(this->GetJSThread(), method_id.AsIndex(), env)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDefineasyncfunc() { - auto v0 = this->GetInst().template GetVReg(); - auto method_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); + auto method_id = this->GetInst().template GetId(); LOG_INST() << "define async function" << " v" << v0; uint64_t env = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::DefineAsyncFunc(this->GetJSThread(), method_id.AsIndex(), env)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDefineasyncgeneratorfunc() { - auto v0 = this->GetInst().template GetVReg(); - auto method_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); + auto method_id = this->GetInst().template GetId(); LOG_INST() << "define async generator function" << " v" << v0; uint64_t env = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC( intrinsics::DefineAsyncGeneratorFunc(this->GetJSThread(), method_id.AsIndex(), env)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdhole() { LOG_INST() << "intrinsic::ldhole"; INTRINSIC_CALL_SETACC(intrinsics::Ldhole()); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCopyrestargs() { - auto rest_idx = this->GetInst().template GetImm(); + auto rest_idx = this->GetInst().template GetImm(); LOG_INST() << "copyrestargs" << " index: " << rest_idx; @@ -1802,16 +1803,16 @@ public: JSTaggedValue res = SlowRuntimeStub::CopyRestArgs(thread, rest_num_args, GetStkArgs(start_idx)); INTERPRETER_RETURN_IF_ABRUPT(res); SetAccFromTaggedValue(res); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDefinegettersetterbyvalue() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); - auto v2 = this->GetInst().template GetVReg(); - auto v3 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); + auto v2 = this->GetInst().template GetVReg(); + auto v3 = this->GetInst().template GetVReg(); LOG_INST() << "definegettersetterbyvalue" << " v" << v0 << " v" << v1 << " v" << v2 << " v" << v3; @@ -1823,28 +1824,28 @@ public: INTRINSIC_CALL_CHECK_SETACC( intrinsics::DefineGetterSetterByValue(this->GetJSThread(), obj, prop, getter, setter, flag)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdobjbyindex() { - uint32_t idx = this->GetInst().template GetImm(); - auto v0 = this->GetInst().template GetVReg(); + uint32_t idx = this->GetInst().template GetImm(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "ldobjbyindex" << " v" << v0 << " imm" << idx; uint64_t obj = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::LdObjByIndex(this->GetJSThread(), idx, obj)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStobjbyindex() { - uint32_t idx = this->GetInst().template GetImm(); - auto v0 = this->GetInst().template GetVReg(); + uint32_t idx = this->GetInst().template GetImm(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "stobjbyindex" << " v" << v0 << " imm" << idx; @@ -1854,14 +1855,14 @@ public: SaveAccToFrame(); INTRINSIC_CALL_CHECK(intrinsics::StObjByIndex(this->GetJSThread(), idx, obj, value)); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdobjbyvalue() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "Ldobjbyvalue" << " v" << v0 << " v" << v1; @@ -1870,14 +1871,14 @@ public: INTRINSIC_CALL_CHECK_SETACC( intrinsics::LdObjByValue(this->GetJSThread(), receiver, prop_key, this->GetBytecodeOffset())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStobjbyvalue() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "stobjbyvalue" << " v" << v0 << " v" << v1; @@ -1889,14 +1890,14 @@ public: INTRINSIC_CALL_CHECK( intrinsics::StObjByValue(this->GetJSThread(), receiver, prop_key, value, this->GetBytecodeOffset())); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdsuperbyvalue() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "Ldsuperbyvalue" << " v" << v0 << " v" << v1; @@ -1904,14 +1905,14 @@ public: uint64_t prop_key = GetRegAsTaggedValue(v1).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::LdSuperByValue(this->GetJSThread(), receiver, prop_key)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStsuperbyvalue() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "stsuperbyvalue" << " v" << v0 << " v" << v1; @@ -1922,23 +1923,23 @@ public: SaveAccToFrame(); INTRINSIC_CALL_CHECK(intrinsics::StSuperByValue(this->GetJSThread(), receiver, prop_key, value)); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaTryldglobalbyname() { - auto string_id = this->GetInst().template GetId(); + auto string_id = this->GetInst().template GetId(); INTRINSIC_CALL_CHECK_SETACC( intrinsics::TryLdGlobalByName(this->GetJSThread(), string_id.AsIndex(), this->GetBytecodeOffset())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaTrystglobalbyname() { - auto string_id = this->GetInst().template GetId(); + auto string_id = this->GetInst().template GetId(); LOG_INST() << "trystglobalbyname" << " stringId:" << string_id; @@ -1948,41 +1949,41 @@ public: INTRINSIC_CALL_CHECK( intrinsics::TryStGlobalByName(this->GetJSThread(), string_id.AsIndex(), value, this->GetBytecodeOffset())); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdglobalvar() { - auto string_id = this->GetInst().template GetId(); + auto string_id = this->GetInst().template GetId(); LOG_INST() << "ldglobalvar " << " stringId:" << string_id; INTRINSIC_CALL_CHECK_SETACC( intrinsics::LdGlobalVar(this->GetJSThread(), string_id.AsIndex(), this->GetBytecodeOffset())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdobjbyname() { - auto v0 = this->GetInst().template GetVReg(); - auto string_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); + auto string_id = this->GetInst().template GetId(); LOG_INST() << "ldobjbyname v" << v0 << " stringId:" << string_id; uint64_t obj = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC( intrinsics::LdObjByName(this->GetJSThread(), string_id.AsIndex(), obj, this->GetBytecodeOffset())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStobjbyname() { - auto v0 = this->GetInst().template GetVReg(); - auto string_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); + auto string_id = this->GetInst().template GetId(); LOG_INST() << "stobjbyname " << "v" << v0 << " stringId:" << string_id.AsIndex(); @@ -1994,14 +1995,14 @@ public: INTRINSIC_CALL_CHECK( intrinsics::StObjByName(this->GetJSThread(), string_id.AsIndex(), obj, value, this->GetBytecodeOffset())); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdsuperbyname() { - auto v0 = this->GetInst().template GetVReg(); - auto string_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); + auto string_id = this->GetInst().template GetId(); LOG_INST() << "ldsuperbyname" << "v" << v0 << " stringId:" << string_id.AsIndex(); @@ -2009,14 +2010,14 @@ public: uint64_t obj = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::LdSuperByName(this->GetJSThread(), string_id.AsIndex(), obj)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStsuperbyname() { - auto string_id = this->GetInst().template GetId(); - auto v0 = this->GetInst().template GetVReg(); + auto string_id = this->GetInst().template GetId(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "stsuperbyname" << "v" << v0 << " stringId:" << string_id.AsIndex(); @@ -2027,13 +2028,13 @@ public: SaveAccToFrame(); INTRINSIC_CALL_CHECK(intrinsics::StSuperByName(this->GetJSThread(), string_id.AsIndex(), obj, value)); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStglobalvar() { - auto string_id = this->GetInst().template GetId(); + auto string_id = this->GetInst().template GetId(); LOG_INST() << "stglobalvar " << "stringId:" << string_id.AsIndex() << ", "; @@ -2044,13 +2045,13 @@ public: INTRINSIC_CALL_CHECK( intrinsics::StGlobalVar(this->GetJSThread(), string_id.AsIndex(), value, this->GetBytecodeOffset())); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStgloballet() { - auto string_id = this->GetInst().template GetId(); + auto string_id = this->GetInst().template GetId(); LOG_INST() << "stgloballet " << "stringId:" << string_id.AsIndex(); @@ -2060,54 +2061,54 @@ public: SaveAccToFrame(); INTRINSIC_CALL_CHECK(intrinsics::StGlobalLet(this->GetJSThread(), string_id.AsIndex(), value)); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCreategeneratorobj() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "creategeneratorobj" << " v" << v0; uint64_t gen_func = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::CreateGeneratorObj(this->GetJSThread(), gen_func)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaSetgeneratorstate() { - auto v0 = this->GetInst().template GetVReg(); - auto state = this->GetInst().template GetImm(); + auto v0 = this->GetInst().template GetVReg(); + auto state = this->GetInst().template GetImm(); LOG_INST() << "setgeneratorstate" << " v" << v0 << " state" << state; uint64_t gen_func = GetRegAsTaggedValue(v0).GetRawData(); intrinsics::SetGeneratorState(this->GetJSThread(), gen_func, state); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCreateasyncgeneratorobj() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "createasyncgeneratorobj" << " v" << v0; uint64_t gen_func = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::CreateAsyncGeneratorObj(this->GetJSThread(), gen_func)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaStarrayspread() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "ecmascript::starrayspread" << " v" << v0 << " v" << v1 << "acc"; @@ -2119,32 +2120,32 @@ public: INTRINSIC_CALL_CHECK(intrinsics::StArraySpread(this->GetJSThread(), dst, index, src)); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDefineclasswithbuffer() { - auto methodId = this->GetInst().template GetId().AsIndex(); - auto imm = this->GetInst().template GetImm(); - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto method_id = this->GetInst().template GetId().AsIndex(); + auto imm = this->GetInst().template GetImm(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "defineclasswithbuffer" - << " method id:" << methodId << " literal id:" << imm << " lexenv: v" << v0 << " parent: v" << v1; + << " method id:" << method_id << " literal id:" << imm << " lexenv: v" << v0 << " parent: v" << v1; uint64_t lexenv = GetRegAsTaggedValue(v0).GetRawData(); uint64_t proto = GetRegAsTaggedValue(v1).GetRawData(); INTRINSIC_CALL_CHECK_SETACC( - intrinsics::DefineClassWithBuffer(this->GetJSThread(), methodId, imm, lexenv, proto)); - this->template MoveToNextInst(); + intrinsics::DefineClassWithBuffer(this->GetJSThread(), method_id, imm, lexenv, proto)); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaSupercall() { - auto v0 = this->GetInst().template GetVReg(); - auto range = this->GetInst().template GetImm(); + auto v0 = this->GetInst().template GetVReg(); + auto range = this->GetInst().template GetImm(); LOG_INST() << "supercall" << "range: " << range << " v" << v0; @@ -2158,13 +2159,13 @@ public: INTERPRETER_RETURN_IF_ABRUPT(res); SetAccFromTaggedValue(res); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaSupercallspread() { - auto v0 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "intrinsic::supercallspread" << " array: v" << v0; @@ -2175,55 +2176,55 @@ public: uint64_t new_target = GetRegAsTaggedValue(num_vregs + 1).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::SuperCallSpread(this->GetJSThread(), array, new_target, this_func)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaCreateobjecthavingmethod() { - auto imm = this->GetInst().template GetImm(); + auto imm = this->GetInst().template GetImm(); LOG_INST() << "createobjecthavingmethod" << " imm:" << imm; uint64_t env = GetAccAsTaggedValue().GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::CreateObjectHavingMethod(this->GetJSThread(), imm, env)); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaReturnundefined() { LOG_INST() << "return.undefined"; SetAccFromTaggedValue(JSTaggedValue::Undefined()); this->GetFrame()->GetAcc().Set(JSTaggedValue::Undefined().GetRawData()); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaLdnan() { LOG_INST() << "ldnan"; INTRINSIC_CALL_SETACC(intrinsics::Ldnan()); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaThrowifsupernotcorrectcall() { - uint16_t imm = this->GetInst().template GetImm(); - JSTaggedValue thisValue = GetAccAsTaggedValue(); + uint16_t imm = this->GetInst().template GetImm(); + JSTaggedValue this_value = GetAccAsTaggedValue(); LOG_INST() << "intrinsic::throwifsupernotcorrectcall" << " imm:" << imm; auto thread = JSThread::Cast(this->GetThread()); - JSTaggedValue res = SlowRuntimeStub::ThrowIfSuperNotCorrectCall(thread, imm, thisValue); + JSTaggedValue res = SlowRuntimeStub::ThrowIfSuperNotCorrectCall(thread, imm, this_value); INTERPRETER_RETURN_IF_ABRUPT(res); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaThrowdeletesuperproperty() { LOG_INST() << "throwdeletesuperproperty"; @@ -2232,27 +2233,27 @@ public: this->MoveToExceptionHandler(); } - template + template ALWAYS_INLINE void HandleEcmaLdhomeobject() { LOG_INST() << "ldhomeobject"; INTRINSIC_CALL_SETACC(intrinsics::LdHomeObject(this->GetJSThread())); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaPoplexenvdyn() { intrinsics::popLexenvDyn(this->GetJSThread()); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaSetobjectwithproto() { - auto v0 = this->GetInst().template GetVReg(); - auto v1 = this->GetInst().template GetVReg(); + auto v0 = this->GetInst().template GetVReg(); + auto v1 = this->GetInst().template GetVReg(); LOG_INST() << "setobjectwithproto" << " v" << v0 << " v" << v1; @@ -2263,14 +2264,14 @@ public: SaveAccToFrame(); INTRINSIC_CALL_CHECK(intrinsics::SetObjectWithProto(this->GetJSThread(), proto, obj)); RestoreAccFromFrame(); - this->template MoveToNextInst(); + this->template MoveToNextInst(); } - template + template ALWAYS_INLINE void HandleEcmaDebugger() { LOG_INST() << "debugger"; - this->template MoveToNextInst(); + this->template MoveToNextInst(); } ALWAYS_INLINE JSThread *GetJSThread() diff --git a/runtime/interpreter/fast_runtime_stub-inl.h b/runtime/interpreter/fast_runtime_stub-inl.h index c3105ab56..8edd4461b 100644 --- a/runtime/interpreter/fast_runtime_stub-inl.h +++ b/runtime/interpreter/fast_runtime_stub-inl.h @@ -63,16 +63,16 @@ JSTaggedValue FastRuntimeStub::FastMul(JSTaggedValue left, JSTaggedValue right) JSTaggedValue FastRuntimeStub::FastDiv(JSTaggedValue left, JSTaggedValue right) { if (left.IsNumber() && right.IsNumber()) { - double dLeft = left.IsInt() ? left.GetInt() : left.GetDouble(); - double dRight = right.IsInt() ? right.GetInt() : right.GetDouble(); - if (UNLIKELY(dRight == 0.0)) { - if (dLeft == 0.0 || std::isnan(dLeft)) { + double d_left = left.IsInt() ? left.GetInt() : left.GetDouble(); + double d_right = right.IsInt() ? right.GetInt() : right.GetDouble(); + if (UNLIKELY(d_right == 0.0)) { + if (d_left == 0.0 || std::isnan(d_left)) { return JSTaggedValue(base::NAN_VALUE); } - uint64_t flagBit = ((bit_cast(dLeft)) ^ (bit_cast(dRight))) & base::DOUBLE_SIGN_MASK; - return JSTaggedValue(bit_cast(flagBit ^ (bit_cast(base::POSITIVE_INFINITY)))); + uint64_t flag_bit = ((bit_cast(d_left)) ^ (bit_cast(d_right))) & base::DOUBLE_SIGN_MASK; + return JSTaggedValue(bit_cast(flag_bit ^ (bit_cast(base::POSITIVE_INFINITY)))); } - return JSTaggedValue(dLeft / dRight); + return JSTaggedValue(d_left / d_right); } return JSTaggedValue::Hole(); } @@ -80,22 +80,22 @@ JSTaggedValue FastRuntimeStub::FastDiv(JSTaggedValue left, JSTaggedValue right) JSTaggedValue FastRuntimeStub::FastMod(JSTaggedValue left, JSTaggedValue right) { if (right.IsInt() && left.IsInt()) { - int iRight = right.GetInt(); - int iLeft = left.GetInt(); - if (iRight > 0 && iLeft > 0) { - return JSTaggedValue(iLeft % iRight); + int i_right = right.GetInt(); + int i_left = left.GetInt(); + if (i_right > 0 && i_left > 0) { + return JSTaggedValue(i_left % i_right); } } if (left.IsNumber() && right.IsNumber()) { - double dLeft = left.IsInt() ? left.GetInt() : left.GetDouble(); - double dRight = right.IsInt() ? right.GetInt() : right.GetDouble(); - if (dRight == 0.0 || std::isnan(dRight) || std::isnan(dLeft) || std::isinf(dLeft)) { + double d_left = left.IsInt() ? left.GetInt() : left.GetDouble(); + double d_right = right.IsInt() ? right.GetInt() : right.GetDouble(); + if (d_right == 0.0 || std::isnan(d_right) || std::isnan(d_left) || std::isinf(d_left)) { return JSTaggedValue(base::NAN_VALUE); } - if (dLeft == 0.0 || std::isinf(dRight)) { - return JSTaggedValue(dLeft); + if (d_left == 0.0 || std::isinf(d_right)) { + return JSTaggedValue(d_left); } - return JSTaggedValue(std::fmod(dLeft, dRight)); + return JSTaggedValue(std::fmod(d_left, d_right)); } return JSTaggedValue::Hole(); } @@ -133,9 +133,9 @@ bool FastRuntimeStub::FastStrictEqual(JSTaggedValue left, JSTaggedValue right) { if (left.IsNumber()) { if (right.IsNumber()) { - double dLeft = left.IsInt() ? left.GetInt() : left.GetDouble(); - double dRight = right.IsInt() ? right.GetInt() : right.GetDouble(); - return JSTaggedValue::StrictNumberEquals(dLeft, dRight); + double d_left = left.IsInt() ? left.GetInt() : left.GetDouble(); + double d_right = right.IsInt() ? right.GetInt() : right.GetDouble(); + return JSTaggedValue::StrictNumberEquals(d_left, d_right); } return false; } @@ -152,19 +152,19 @@ bool FastRuntimeStub::FastStrictEqual(JSTaggedValue left, JSTaggedValue right) return false; } -bool FastRuntimeStub::IsSpecialIndexedObj(JSType jsType) +bool FastRuntimeStub::IsSpecialIndexedObj(JSType js_type) { - return jsType > JSType::JS_ARRAY; + return js_type > JSType::JS_ARRAY; } -bool FastRuntimeStub::IsSpecialReceiverObj(JSType jsType) +bool FastRuntimeStub::IsSpecialReceiverObj(JSType js_type) { - return jsType > JSType::JS_PRIMITIVE_REF; + return js_type > JSType::JS_PRIMITIVE_REF; } -bool FastRuntimeStub::IsSpecialContainer(JSType jsType) +bool FastRuntimeStub::IsSpecialContainer(JSType js_type) { - return jsType >= JSType::JS_ARRAY_LIST && jsType <= JSType::JS_QUEUE; + return js_type >= JSType::JS_ARRAY_LIST && js_type <= JSType::JS_QUEUE; } uint32_t FastRuntimeStub::TryToElementsIndex(JSTaggedValue key) @@ -192,34 +192,34 @@ JSTaggedValue FastRuntimeStub::CallGetter(JSThread *thread, JSTaggedValue receiv { INTERPRETER_TRACE(thread, CallGetter); // Accessor - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); AccessorData *accessor = AccessorData::Cast(value.GetTaggedObject()); if (UNLIKELY(accessor->IsInternal())) { - JSHandle objHandle(thread, holder); - return accessor->CallInternalGet(thread, objHandle); + JSHandle obj_handle(thread, holder); + return accessor->CallInternalGet(thread, obj_handle); } - JSHandle objHandle(thread, receiver); - return JSObject::CallGetter(thread, accessor, objHandle); + JSHandle obj_handle(thread, receiver); + return JSObject::CallGetter(thread, accessor, obj_handle); } JSTaggedValue FastRuntimeStub::CallSetter(JSThread *thread, JSTaggedValue receiver, JSTaggedValue value, - JSTaggedValue accessorValue) + JSTaggedValue accessor_value) { INTERPRETER_TRACE(thread, CallSetter); // Accessor - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle objHandle(thread, receiver); - JSHandle valueHandle(thread, value); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle obj_handle(thread, receiver); + JSHandle value_handle(thread, value); - auto accessor = AccessorData::Cast(accessorValue.GetTaggedObject()); - bool success = JSObject::CallSetter(thread, *accessor, objHandle, valueHandle, true); + auto accessor = AccessorData::Cast(accessor_value.GetTaggedObject()); + bool success = JSObject::CallSetter(thread, *accessor, obj_handle, value_handle, true); return success ? JSTaggedValue::Undefined() : JSTaggedValue::Exception(); } -bool FastRuntimeStub::ShouldCallSetter(JSTaggedValue receiver, JSTaggedValue holder, JSTaggedValue accessorValue, +bool FastRuntimeStub::ShouldCallSetter(JSTaggedValue receiver, JSTaggedValue holder, JSTaggedValue accessor_value, PropertyAttributes attr) { - if (!AccessorData::Cast(accessorValue.GetTaggedObject())->IsInternal()) { + if (!AccessorData::Cast(accessor_value.GetTaggedObject())->IsInternal()) { return true; } if (receiver != holder) { @@ -228,46 +228,46 @@ bool FastRuntimeStub::ShouldCallSetter(JSTaggedValue receiver, JSTaggedValue hol return attr.IsWritable(); } -PropertyAttributes FastRuntimeStub::AddPropertyByName(JSThread *thread, JSHandle objHandle, - JSHandle keyHandle, - JSHandle valueHandle, PropertyAttributes attr) +PropertyAttributes FastRuntimeStub::AddPropertyByName(JSThread *thread, JSHandle obj_handle, + JSHandle key_handle, + JSHandle value_handle, PropertyAttributes attr) { INTERPRETER_TRACE(thread, AddPropertyByName); - if (objHandle->IsJSArray() && keyHandle.GetTaggedValue() == thread->GlobalConstants()->GetConstructorString()) { - objHandle->GetJSHClass()->SetHasConstructor(true); + if (obj_handle->IsJSArray() && key_handle.GetTaggedValue() == thread->GlobalConstants()->GetConstructorString()) { + obj_handle->GetJSHClass()->SetHasConstructor(true); } - int32_t nextInlinedPropsIndex = objHandle->GetJSHClass()->GetNextInlinedPropsIndex(); - if (nextInlinedPropsIndex >= 0) { - objHandle->SetPropertyInlinedProps(thread, nextInlinedPropsIndex, valueHandle.GetTaggedValue()); - attr.SetOffset(nextInlinedPropsIndex); + int32_t next_inlined_props_index = obj_handle->GetJSHClass()->GetNextInlinedPropsIndex(); + if (next_inlined_props_index >= 0) { + obj_handle->SetPropertyInlinedProps(thread, next_inlined_props_index, value_handle.GetTaggedValue()); + attr.SetOffset(next_inlined_props_index); attr.SetIsInlinedProps(true); - JSHClass::AddProperty(thread, objHandle, keyHandle, attr); + JSHClass::AddProperty(thread, obj_handle, key_handle, attr); return attr; } - JSMutableHandle array(thread, objHandle->GetProperties()); + JSMutableHandle array(thread, obj_handle->GetProperties()); uint32_t length = array->GetLength(); if (length == 0) { length = JSObject::MIN_PROPERTIES_LENGTH; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); array.Update(factory->NewTaggedArray(length).GetTaggedValue()); - objHandle->SetProperties(thread, array.GetTaggedValue()); + obj_handle->SetProperties(thread, array.GetTaggedValue()); } if (!array->IsDictionaryMode()) { attr.SetIsInlinedProps(false); - uint32_t nonInlinedProps = objHandle->GetJSHClass()->GetNextNonInlinedPropsIndex(); - ASSERT(length >= nonInlinedProps); + uint32_t non_inlined_props = obj_handle->GetJSHClass()->GetNextNonInlinedPropsIndex(); + ASSERT(length >= non_inlined_props); // if array is full, grow array or change to dictionary mode - if (length == nonInlinedProps) { + if (length == non_inlined_props) { if (UNLIKELY(length == JSHClass::MAX_CAPACITY_OF_OUT_OBJECTS)) { // change to dictionary and add one. - JSHandle dict(JSObject::TransitionToDictionary(thread, objHandle)); - JSHandle newDict = - NameDictionary::PutIfAbsent(thread, dict, keyHandle, valueHandle, attr); - objHandle->SetProperties(thread, newDict); + JSHandle dict(JSObject::TransitionToDictionary(thread, obj_handle)); + JSHandle new_dict = + NameDictionary::PutIfAbsent(thread, dict, key_handle, value_handle, attr); + obj_handle->SetProperties(thread, new_dict); // index is not essential when fastMode is false; return attr; } @@ -275,17 +275,17 @@ PropertyAttributes FastRuntimeStub::AddPropertyByName(JSThread *thread, JSHandle uint32_t capacity = JSObject::ComputePropertyCapacity(length); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); array.Update(factory->CopyArray(array, length, capacity).GetTaggedValue()); - objHandle->SetProperties(thread, array.GetTaggedValue()); + obj_handle->SetProperties(thread, array.GetTaggedValue()); } - attr.SetOffset(nonInlinedProps + objHandle->GetJSHClass()->GetInlinedProperties()); - JSHClass::AddProperty(thread, objHandle, keyHandle, attr); - array->Set(thread, nonInlinedProps, valueHandle.GetTaggedValue()); + attr.SetOffset(non_inlined_props + obj_handle->GetJSHClass()->GetInlinedProperties()); + JSHClass::AddProperty(thread, obj_handle, key_handle, attr); + array->Set(thread, non_inlined_props, value_handle.GetTaggedValue()); } else { - JSHandle dictHandle(array); - JSHandle newDict = - NameDictionary::PutIfAbsent(thread, dictHandle, keyHandle, valueHandle, attr); - objHandle->SetProperties(thread, newDict); + JSHandle dict_handle(array); + JSHandle new_dict = + NameDictionary::PutIfAbsent(thread, dict_handle, key_handle, value_handle, attr); + obj_handle->SetProperties(thread, new_dict); } return attr; } @@ -294,7 +294,7 @@ JSTaggedValue FastRuntimeStub::AddPropertyByIndex(JSThread *thread, JSTaggedValu JSTaggedValue value) { INTERPRETER_TRACE(thread, AddPropertyByIndex); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); if (UNLIKELY(!JSObject::Cast(receiver)->IsExtensible())) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot add property in prevent extensions ", JSTaggedValue::Exception()); } @@ -304,18 +304,18 @@ JSTaggedValue FastRuntimeStub::AddPropertyByIndex(JSThread *thread, JSTaggedValu return success ? JSTaggedValue::Undefined() : JSTaggedValue::Exception(); } -template +template JSTaggedValue FastRuntimeStub::GetPropertyByIndex(JSThread *thread, JSTaggedValue receiver, uint32_t index) { INTERPRETER_TRACE(thread, GetPropertyByIndex); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSTaggedValue holder = receiver; do { auto *hclass = holder.GetTaggedObject()->GetClass(); - JSType jsType = hclass->GetObjectType(); - if (IsSpecialIndexedObj(jsType)) { - if (IsSpecialContainer(jsType)) { - return GetContainerProperty(thread, holder, index, jsType); + JSType js_type = hclass->GetObjectType(); + if (IsSpecialIndexedObj(js_type)) { + if (IsSpecialContainer(js_type)) { + return GetContainerProperty(thread, holder, index, js_type); } return JSTaggedValue::Hole(); } @@ -344,7 +344,7 @@ JSTaggedValue FastRuntimeStub::GetPropertyByIndex(JSThread *thread, JSTaggedValu return value; } } - if (UseOwn) { + if (USE_OWN) { break; } holder = JSObject::Cast(holder)->GetJSHClass()->GetPrototype(); @@ -354,7 +354,7 @@ JSTaggedValue FastRuntimeStub::GetPropertyByIndex(JSThread *thread, JSTaggedValu return JSTaggedValue::Undefined(); } -template +template JSTaggedValue FastRuntimeStub::GetPropertyByValue(JSThread *thread, JSTaggedValue *receiver, JSTaggedValue *key) { INTERPRETER_TRACE(thread, GetPropertyByValue); @@ -364,24 +364,24 @@ JSTaggedValue FastRuntimeStub::GetPropertyByValue(JSThread *thread, JSTaggedValu // fast path auto index = TryToElementsIndex(*key); if (LIKELY(index < JSObject::MAX_ELEMENT_INDEX)) { - return GetPropertyByIndex(thread, *receiver, index); + return GetPropertyByIndex(thread, *receiver, index); } if (!key->IsNumber()) { if (key->IsString() && !EcmaString::Cast(key->GetTaggedObject())->IsInternString()) { // update string stable - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle receiverHandler(thread, *receiver); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle receiver_handler(thread, *receiver); *key = JSTaggedValue(thread->GetEcmaVM()->GetFactory()->InternString(JSHandle(thread, *key))); // Maybe moved by GC - *receiver = receiverHandler.GetTaggedValue(); + *receiver = receiver_handler.GetTaggedValue(); } - return FastRuntimeStub::GetPropertyByName(thread, *receiver, *key); + return FastRuntimeStub::GetPropertyByName(thread, *receiver, *key); } return JSTaggedValue::Hole(); } -template +template JSTaggedValue FastRuntimeStub::GetPropertyByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key) { INTERPRETER_TRACE(thread, GetPropertyByName); @@ -390,19 +390,19 @@ JSTaggedValue FastRuntimeStub::GetPropertyByName(JSThread *thread, JSTaggedValue JSTaggedValue holder = receiver; do { auto *hclass = holder.GetTaggedObject()->GetClass(); - JSType jsType = hclass->GetObjectType(); - if (IsSpecialIndexedObj(jsType)) { + JSType js_type = hclass->GetObjectType(); + if (IsSpecialIndexedObj(js_type)) { return JSTaggedValue::Hole(); } if (LIKELY(!hclass->IsDictionaryMode())) { ASSERT(!TaggedArray::Cast(JSObject::Cast(holder)->GetProperties().GetTaggedObject())->IsDictionaryMode()); - LayoutInfo *layoutInfo = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject()); - int propsNumber = hclass->NumberOfProps(); - int entry = layoutInfo->FindElementWithCache(thread, hclass, key, propsNumber); + LayoutInfo *layout_info = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject()); + int props_number = hclass->NumberOfProps(); + int entry = layout_info->FindElementWithCache(thread, hclass, key, props_number); if (entry != -1) { - PropertyAttributes attr(layoutInfo->GetAttr(entry)); + PropertyAttributes attr(layout_info->GetAttr(entry)); ASSERT(static_cast(attr.GetOffset()) == entry); auto value = JSObject::Cast(holder)->GetProperty(hclass, attr); if (UNLIKELY(attr.IsAccessor())) { @@ -426,7 +426,7 @@ JSTaggedValue FastRuntimeStub::GetPropertyByName(JSThread *thread, JSTaggedValue return value; } } - if (UseOwn) { + if (USE_OWN) { break; } holder = hclass->GetPrototype(); @@ -435,7 +435,7 @@ JSTaggedValue FastRuntimeStub::GetPropertyByName(JSThread *thread, JSTaggedValue return JSTaggedValue::Undefined(); } -template +template JSTaggedValue FastRuntimeStub::SetPropertyByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, JSTaggedValue value) { @@ -444,9 +444,9 @@ JSTaggedValue FastRuntimeStub::SetPropertyByName(JSThread *thread, JSTaggedValue JSTaggedValue holder = receiver; do { auto *hclass = holder.GetTaggedObject()->GetClass(); - JSType jsType = hclass->GetObjectType(); - if (IsSpecialIndexedObj(jsType)) { - if (IsSpecialContainer(jsType)) { + JSType js_type = hclass->GetObjectType(); + if (IsSpecialIndexedObj(js_type)) { + if (IsSpecialContainer(js_type)) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot set property on Container", JSTaggedValue::Exception()); } return JSTaggedValue::Hole(); @@ -455,12 +455,12 @@ JSTaggedValue FastRuntimeStub::SetPropertyByName(JSThread *thread, JSTaggedValue if (LIKELY(!hclass->IsDictionaryMode())) { ASSERT(!TaggedArray::Cast(JSObject::Cast(holder)->GetProperties().GetTaggedObject())->IsDictionaryMode()); - LayoutInfo *layoutInfo = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject()); + LayoutInfo *layout_info = LayoutInfo::Cast(hclass->GetLayout().GetTaggedObject()); - int propsNumber = hclass->NumberOfProps(); - int entry = layoutInfo->FindElementWithCache(thread, hclass, key, propsNumber); + int props_number = hclass->NumberOfProps(); + int entry = layout_info->FindElementWithCache(thread, hclass, key, props_number); if (entry != -1) { - PropertyAttributes attr(layoutInfo->GetAttr(entry)); + PropertyAttributes attr(layout_info->GetAttr(entry)); ASSERT(static_cast(attr.GetOffset()) == entry); if (UNLIKELY(attr.IsAccessor())) { auto accessor = JSObject::Cast(holder)->GetProperty(hclass, attr); @@ -469,7 +469,7 @@ JSTaggedValue FastRuntimeStub::SetPropertyByName(JSThread *thread, JSTaggedValue } } if (UNLIKELY(!attr.IsWritable())) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot set readonly property", JSTaggedValue::Exception()); } if (UNLIKELY(holder != receiver)) { @@ -492,7 +492,7 @@ JSTaggedValue FastRuntimeStub::SetPropertyByName(JSThread *thread, JSTaggedValue } } if (UNLIKELY(!attr.IsWritable())) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot set readonly property", JSTaggedValue::Exception()); } if (UNLIKELY(holder != receiver)) { @@ -502,25 +502,25 @@ JSTaggedValue FastRuntimeStub::SetPropertyByName(JSThread *thread, JSTaggedValue return JSTaggedValue::Undefined(); } } - if (UseOwn) { + if (USE_OWN) { break; } holder = hclass->GetPrototype(); } while (holder.IsHeapObject()); - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle objHandle(thread, receiver); - JSHandle keyHandle(thread, key); - JSHandle valueHandle(thread, value); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle obj_handle(thread, receiver); + JSHandle key_handle(thread, key); + JSHandle value_handle(thread, value); if (UNLIKELY(!JSObject::Cast(receiver)->IsExtensible())) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot add property in prevent extensions ", JSTaggedValue::Exception()); } - AddPropertyByName(thread, objHandle, keyHandle, valueHandle, PropertyAttributes::Default()); + AddPropertyByName(thread, obj_handle, key_handle, value_handle, PropertyAttributes::Default()); return JSTaggedValue::Undefined(); } -template +template JSTaggedValue FastRuntimeStub::SetPropertyByIndex(JSThread *thread, JSTaggedValue receiver, uint32_t index, JSTaggedValue value) { @@ -528,10 +528,10 @@ JSTaggedValue FastRuntimeStub::SetPropertyByIndex(JSThread *thread, JSTaggedValu JSTaggedValue holder = receiver; do { auto *hclass = holder.GetTaggedObject()->GetClass(); - JSType jsType = hclass->GetObjectType(); - if (IsSpecialIndexedObj(jsType)) { - if (IsSpecialContainer(jsType)) { - return SetContainerProperty(thread, holder, index, value, jsType); + JSType js_type = hclass->GetObjectType(); + if (IsSpecialIndexedObj(js_type)) { + if (IsSpecialContainer(js_type)) { + return SetContainerProperty(thread, holder, index, value, js_type); } return JSTaggedValue::Hole(); } @@ -550,7 +550,7 @@ JSTaggedValue FastRuntimeStub::SetPropertyByIndex(JSThread *thread, JSTaggedValu } else { return JSTaggedValue::Hole(); } - if (UseOwn) { + if (USE_OWN) { break; } holder = JSObject::Cast(holder)->GetJSHClass()->GetPrototype(); @@ -559,7 +559,7 @@ JSTaggedValue FastRuntimeStub::SetPropertyByIndex(JSThread *thread, JSTaggedValu return AddPropertyByIndex(thread, receiver, index, value); } -template +template JSTaggedValue FastRuntimeStub::SetPropertyByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, JSTaggedValue value) { @@ -570,20 +570,20 @@ JSTaggedValue FastRuntimeStub::SetPropertyByValue(JSThread *thread, JSTaggedValu // fast path auto index = TryToElementsIndex(key); if (LIKELY(index < JSObject::MAX_ELEMENT_INDEX)) { - return SetPropertyByIndex(thread, receiver, index, value); + return SetPropertyByIndex(thread, receiver, index, value); } if (!key.IsNumber()) { if (key.IsString() && !EcmaString::Cast(key.GetTaggedObject())->IsInternString()) { // update string stable - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle receiverHandler(thread, receiver); - JSHandle valueHandler(thread, value); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle receiver_handler(thread, receiver); + JSHandle value_handler(thread, value); key = JSTaggedValue(thread->GetEcmaVM()->GetFactory()->InternString(JSHandle(thread, key))); // Maybe moved by GC - receiver = receiverHandler.GetTaggedValue(); - value = valueHandler.GetTaggedValue(); + receiver = receiver_handler.GetTaggedValue(); + value = value_handler.GetTaggedValue(); } - return FastRuntimeStub::SetPropertyByName(thread, receiver, key, value); + return FastRuntimeStub::SetPropertyByName(thread, receiver, key, value); } return JSTaggedValue::Hole(); } @@ -605,33 +605,33 @@ JSTaggedValue FastRuntimeStub::GetGlobalOwnProperty(JSTaggedValue receiver, JSTa JSTaggedValue FastRuntimeStub::FastTypeOf(JSThread *thread, JSTaggedValue obj) { INTERPRETER_TRACE(thread, FastTypeOf); - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); + const GlobalEnvConstants *global_const = thread->GlobalConstants(); switch (obj.GetRawData()) { case JSTaggedValue::VALUE_TRUE: case JSTaggedValue::VALUE_FALSE: - return globalConst->GetBooleanString(); + return global_const->GetBooleanString(); case JSTaggedValue::VALUE_NULL: - return globalConst->GetObjectString(); + return global_const->GetObjectString(); case JSTaggedValue::VALUE_UNDEFINED: - return globalConst->GetUndefinedString(); + return global_const->GetUndefinedString(); default: if (obj.IsHeapObject()) { if (obj.IsString()) { - return globalConst->GetStringString(); + return global_const->GetStringString(); } if (obj.IsSymbol()) { - return globalConst->GetSymbolString(); + return global_const->GetSymbolString(); } if (obj.IsCallable()) { - return globalConst->GetFunctionString(); + return global_const->GetFunctionString(); } - return globalConst->GetObjectString(); + return global_const->GetObjectString(); } if (obj.IsNumber()) { - return globalConst->GetNumberString(); + return global_const->GetNumberString(); } } - return globalConst->GetUndefinedString(); + return global_const->GetUndefinedString(); } bool FastRuntimeStub::FastSetPropertyByIndex(JSThread *thread, JSTaggedValue receiver, uint32_t index, @@ -682,10 +682,10 @@ JSTaggedValue FastRuntimeStub::FastGetPropertyByName(JSThread *thread, JSTaggedV INTERPRETER_TRACE(thread, FastGetPropertyByName); ASSERT(key.IsStringOrSymbol()); if (key.IsString() && !EcmaString::Cast(key.GetTaggedObject())->IsInternString()) { - JSHandle receiverHandler(thread, receiver); + JSHandle receiver_handler(thread, receiver); key = JSTaggedValue(thread->GetEcmaVM()->GetFactory()->InternString(JSHandle(thread, key))); // Maybe moved by GC - receiver = receiverHandler.GetTaggedValue(); + receiver = receiver_handler.GetTaggedValue(); } #ifdef ECMASCRIPT_ENABLE_STUB_AOT1 auto stubAddr = thread->GetFastStubEntry(FAST_STUB_ID(GetPropertyByName)); @@ -729,7 +729,7 @@ JSTaggedValue FastRuntimeStub::FastGetPropertyByValue(JSThread *thread, JSTagged return result; } -template // UseHole is only for Array::Sort() which requires Hole order +template // UseHole is only for Array::Sort() which requires Hole order JSTaggedValue FastRuntimeStub::FastGetPropertyByIndex(JSThread *thread, JSTaggedValue receiver, uint32_t index) { INTERPRETER_TRACE(thread, FastGetPropertyByIndex); @@ -741,7 +741,7 @@ JSTaggedValue FastRuntimeStub::FastGetPropertyByIndex(JSThread *thread, JSTagged #else JSTaggedValue result = FastRuntimeStub::GetPropertyByIndex(thread, receiver, index); #endif - if (result.IsHole() && !UseHole) { + if (result.IsHole() && !USE_HOLE) { // CSA reports usage of 'receiver' after GC in the function 'CallGetter' which is called from // GetPropertyByIndex. In case we reach CallGetter the result canot by JSTaggedValue::Hole(). // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) @@ -752,27 +752,27 @@ JSTaggedValue FastRuntimeStub::FastGetPropertyByIndex(JSThread *thread, JSTagged return result; } -JSTaggedValue FastRuntimeStub::NewLexicalEnvDyn(JSThread *thread, ObjectFactory *factory, uint16_t numVars) +JSTaggedValue FastRuntimeStub::NewLexicalEnvDyn(JSThread *thread, ObjectFactory *factory, uint16_t num_vars) { INTERPRETER_TRACE(thread, NewLexicalEnvDyn); - LexicalEnv *newEnv = factory->InlineNewLexicalEnv(numVars); - if (UNLIKELY(newEnv == nullptr)) { + LexicalEnv *new_env = factory->InlineNewLexicalEnv(num_vars); + if (UNLIKELY(new_env == nullptr)) { return JSTaggedValue::Hole(); } - return JSTaggedValue(newEnv); + return JSTaggedValue(new_env); } // Those interface below is discarded bool FastRuntimeStub::IsSpecialIndexedObjForGet(JSTaggedValue obj) { - JSType jsType = obj.GetTaggedObject()->GetClass()->GetObjectType(); - return jsType > JSType::JS_ARRAY && jsType <= JSType::JS_PRIMITIVE_REF; + JSType js_type = obj.GetTaggedObject()->GetClass()->GetObjectType(); + return js_type > JSType::JS_ARRAY && js_type <= JSType::JS_PRIMITIVE_REF; } bool FastRuntimeStub::IsSpecialIndexedObjForSet(JSTaggedValue obj) { - JSType jsType = obj.GetTaggedObject()->GetClass()->GetObjectType(); - return jsType >= JSType::JS_ARRAY && jsType <= JSType::JS_PRIMITIVE_REF; + JSType js_type = obj.GetTaggedObject()->GetClass()->GetObjectType(); + return js_type >= JSType::JS_ARRAY && js_type <= JSType::JS_PRIMITIVE_REF; } JSTaggedValue FastRuntimeStub::GetElement(JSTaggedValue receiver, uint32_t index) @@ -812,22 +812,22 @@ JSTaggedValue FastRuntimeStub::GetElementWithArray(JSTaggedValue receiver, uint3 } bool FastRuntimeStub::SetElement(JSThread *thread, JSTaggedValue receiver, uint32_t index, JSTaggedValue value, - bool mayThrow) + bool may_throw) { INTERPRETER_TRACE(thread, SetElement); JSTaggedValue holder = receiver; - bool onPrototype = false; + bool on_prototype = false; while (true) { PropertyAttributes attr; - uint32_t indexOrEntry = 0; + uint32_t index_or_entry = 0; TaggedArray *elements = TaggedArray::Cast(JSObject::Cast(holder)->GetElements().GetHeapObject()); - bool isDict = elements->IsDictionaryMode(); - JSTaggedValue val = FindOwnElement(elements, index, isDict, &attr, &indexOrEntry); + bool is_dict = elements->IsDictionaryMode(); + JSTaggedValue val = FindOwnElement(elements, index, is_dict, &attr, &index_or_entry); if (!val.IsHole()) { - if (UNLIKELY(onPrototype)) { + if (UNLIKELY(on_prototype)) { if (UNLIKELY(!JSObject::Cast(receiver)->IsExtensible())) { - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot add property in prevent extensions ", false); } return false; @@ -840,33 +840,33 @@ bool FastRuntimeStub::SetElement(JSThread *thread, JSTaggedValue receiver, uint3 if (!attr.IsAccessor()) { if (attr.IsWritable()) { elements = TaggedArray::Cast(JSObject::Cast(receiver)->GetElements().GetHeapObject()); - if (!isDict) { - elements->Set(thread, indexOrEntry, value); + if (!is_dict) { + elements->Set(thread, index_or_entry, value); JSObject::Cast(receiver)->GetJSHClass()->UpdateRepresentation(value); return true; } - NumberDictionary::Cast(elements)->UpdateValueAndAttributes(thread, indexOrEntry, value, attr); + NumberDictionary::Cast(elements)->UpdateValueAndAttributes(thread, index_or_entry, value, attr); return true; } - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot set readonly property", false); } return false; } // Accessor - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle objHandle(thread, receiver); - JSHandle valueHandle(thread, value); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle obj_handle(thread, receiver); + JSHandle value_handle(thread, value); AccessorData *access = AccessorData::Cast(val.GetHeapObject()); - return JSObject::CallSetter(thread, *access, objHandle, valueHandle, mayThrow); + return JSObject::CallSetter(thread, *access, obj_handle, value_handle, may_throw); } holder = JSObject::Cast(holder)->GetJSHClass()->GetPrototype(); if (!holder.IsHeapObject()) { if (UNLIKELY(!JSObject::Cast(receiver)->IsExtensible())) { - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot add property in prevent extensions ", false); } return false; @@ -878,35 +878,35 @@ bool FastRuntimeStub::SetElement(JSThread *thread, JSTaggedValue receiver, uint3 if (holder.IsJSProxy()) { return JSProxy::SetProperty( thread, JSHandle(thread, holder), JSHandle(thread, JSTaggedValue(index)), - JSHandle(thread, value), JSHandle(thread, receiver), mayThrow); + JSHandle(thread, value), JSHandle(thread, receiver), may_throw); } - onPrototype = true; + on_prototype = true; } } bool FastRuntimeStub::SetPropertyByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, - JSTaggedValue value, bool mayThrow) + JSTaggedValue value, bool may_throw) { INTERPRETER_TRACE(thread, SetPropertyByName); // property JSTaggedValue holder = receiver; - bool onPrototype = false; + bool on_prototype = false; while (true) { TaggedArray *properties = TaggedArray::Cast(JSObject::Cast(holder)->GetProperties().GetHeapObject()); PropertyAttributes attr; - uint32_t indexOrEntry = 0; - JSTaggedValue val = FindOwnProperty(thread, JSObject::Cast(holder), properties, key, &attr, &indexOrEntry); + uint32_t index_or_entry = 0; + JSTaggedValue val = FindOwnProperty(thread, JSObject::Cast(holder), properties, key, &attr, &index_or_entry); if (!val.IsHole()) { if (!attr.IsAccessor()) { - if (UNLIKELY(onPrototype)) { + if (UNLIKELY(on_prototype)) { if (UNLIKELY(!JSObject::Cast(receiver)->IsExtensible() || !attr.IsWritable())) { - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot add property in prevent extensions ", false); } return false; } - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectOperator::FastAdd(thread, receiver, key, JSHandle(thread, value), PropertyAttributes::Default()); @@ -924,119 +924,119 @@ bool FastRuntimeStub::SetPropertyByName(JSThread *thread, JSTaggedValue receiver JSObject::Cast(receiver)->GetJSHClass()->UpdatePropertyMetaData(thread, key, attr); if (UNLIKELY(val.IsInternalAccessor())) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); AccessorData::Cast(val.GetHeapObject()) ->CallInternalSet(thread, JSHandle(thread, receiver), - JSHandle(thread, value), mayThrow); + JSHandle(thread, value), may_throw); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); return true; } if (attr.IsInlinedProps()) { - JSObject::Cast(receiver)->SetPropertyInlinedProps(thread, indexOrEntry, value); + JSObject::Cast(receiver)->SetPropertyInlinedProps(thread, index_or_entry, value); } else { - properties->Set(thread, indexOrEntry, value); + properties->Set(thread, index_or_entry, value); } return true; } if (receiver.IsJSGlobalObject()) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle dictHandle(thread, properties); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle dict_handle(thread, properties); // globalobj have no internal accessor - GlobalDictionary::InvalidatePropertyBox(thread, dictHandle, indexOrEntry, attr); + GlobalDictionary::InvalidatePropertyBox(thread, dict_handle, index_or_entry, attr); return true; } if (UNLIKELY(val.IsInternalAccessor())) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); AccessorData::Cast(val.GetHeapObject()) ->CallInternalSet(thread, JSHandle(thread, receiver), - JSHandle(thread, value), mayThrow); + JSHandle(thread, value), may_throw); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); return true; } - NameDictionary::Cast(properties)->UpdateValueAndAttributes(thread, indexOrEntry, value, attr); + NameDictionary::Cast(properties)->UpdateValueAndAttributes(thread, index_or_entry, value, attr); return true; } - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot set readonly property", false); } return false; } // Accessor - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle objHandle(thread, receiver); - JSHandle valueHandle(thread, value); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle obj_handle(thread, receiver); + JSHandle value_handle(thread, value); AccessorData *access = AccessorData::Cast(val.GetHeapObject()); - return JSObject::CallSetter(thread, *access, objHandle, valueHandle, mayThrow); + return JSObject::CallSetter(thread, *access, obj_handle, value_handle, may_throw); } if (holder.IsTypedArray()) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle holder_handle(thread, holder); JSHandle value_handle(thread, value); JSHandle receiver_handle(thread, receiver); JSHandle key_handle = JSTypedArray::ToPropKey(thread, JSHandle(thread, key)); return JSTypedArray::SetProperty(thread, holder_handle, key_handle, value_handle, receiver_handle, - mayThrow); + may_throw); } holder = JSObject::Cast(holder)->GetJSHClass()->GetPrototype(); if (!holder.IsHeapObject()) { if (UNLIKELY(!JSObject::Cast(receiver)->IsExtensible())) { - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot add property in prevent extensions ", false); } return false; } - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectOperator::FastAdd(thread, receiver, key, JSHandle(thread, value), PropertyAttributes::Default()); return true; } if (holder.IsJSProxy()) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); return JSProxy::SetProperty(thread, JSHandle(thread, holder), JSHandle(thread, key), JSHandle(thread, value), - JSHandle(thread, receiver), mayThrow); + JSHandle(thread, receiver), may_throw); } - onPrototype = true; + on_prototype = true; } } bool FastRuntimeStub::SetGlobalOwnProperty(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, - JSTaggedValue value, bool mayThrow) + JSTaggedValue value, bool may_throw) { INTERPRETER_TRACE(thread, SetGlobalOwnProperty); uint32_t index = 0; if (JSTaggedValue::ToElementIndex(key, &index)) { - return SetElement(thread, receiver, index, value, mayThrow); + return SetElement(thread, receiver, index, value, may_throw); } JSObject *obj = JSObject::Cast(receiver); GlobalDictionary *dict = GlobalDictionary::Cast(obj->GetProperties().GetTaggedObject()); PropertyAttributes attr = PropertyAttributes::Default(); if (UNLIKELY(dict->GetLength() == 0)) { - JSHandle keyHandle(thread, key); - JSHandle valHandle(thread, value); - JSHandle objHandle(thread, obj); - JSHandle dictHandle(GlobalDictionary::Create(thread)); + JSHandle key_handle(thread, key); + JSHandle val_handle(thread, value); + JSHandle obj_handle(thread, obj); + JSHandle dict_handle(GlobalDictionary::Create(thread)); // Add PropertyBox to global dictionary ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle boxHandle = factory->NewPropertyBox(valHandle); - boxHandle->SetValue(thread, valHandle.GetTaggedValue()); - PropertyBoxType boxType = valHandle->IsUndefined() ? PropertyBoxType::UNDEFINED : PropertyBoxType::CONSTANT; - attr.SetBoxType(boxType); + JSHandle box_handle = factory->NewPropertyBox(val_handle); + box_handle->SetValue(thread, val_handle.GetTaggedValue()); + PropertyBoxType box_type = val_handle->IsUndefined() ? PropertyBoxType::UNDEFINED : PropertyBoxType::CONSTANT; + attr.SetBoxType(box_type); JSHandle properties = - GlobalDictionary::PutIfAbsent(thread, dictHandle, keyHandle, JSHandle(boxHandle), attr); - objHandle->SetProperties(thread, properties); + GlobalDictionary::PutIfAbsent(thread, dict_handle, key_handle, JSHandle(box_handle), attr); + obj_handle->SetProperties(thread, properties); return true; } @@ -1047,8 +1047,8 @@ bool FastRuntimeStub::SetGlobalOwnProperty(JSThread *thread, JSTaggedValue recei if (!attr.IsAccessor()) { if (attr.IsWritable()) { // globalobj have no internal accessor - JSHandle dictHandle(thread, dict); - GlobalDictionary::InvalidatePropertyBox(thread, dictHandle, entry, attr); + JSHandle dict_handle(thread, dict); + GlobalDictionary::InvalidatePropertyBox(thread, dict_handle, entry, attr); return true; } } @@ -1056,37 +1056,37 @@ bool FastRuntimeStub::SetGlobalOwnProperty(JSThread *thread, JSTaggedValue recei // Accessor JSTaggedValue setter = AccessorData::Cast(val.GetHeapObject())->GetSetter(); if (setter.IsUndefined()) { - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot set property when setter is undefined", false); } return false; } - JSHandle objHandle(thread, receiver); - JSHandle setFunc(thread, setter); + JSHandle obj_handle(thread, receiver); + JSHandle set_func(thread, setter); InternalCallParams *arguments = thread->GetInternalCallParams(); arguments->MakeArgv(value); - JSFunction::Call(thread, setFunc, objHandle, 1, arguments->GetArgv()); + JSFunction::Call(thread, set_func, obj_handle, 1, arguments->GetArgv()); // 10. ReturnIfAbrupt(setterResult). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); return true; } - JSHandle keyHandle(thread, key); - JSHandle valHandle(thread, value); - JSHandle objHandle(thread, obj); - JSHandle dictHandle(thread, dict); + JSHandle key_handle(thread, key); + JSHandle val_handle(thread, value); + JSHandle obj_handle(thread, obj); + JSHandle dict_handle(thread, dict); // Add PropertyBox to global dictionary ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle boxHandle = factory->NewPropertyBox(keyHandle); - boxHandle->SetValue(thread, valHandle.GetTaggedValue()); - PropertyBoxType boxType = valHandle->IsUndefined() ? PropertyBoxType::UNDEFINED : PropertyBoxType::CONSTANT; - attr.SetBoxType(boxType); + JSHandle box_handle = factory->NewPropertyBox(key_handle); + box_handle->SetValue(thread, val_handle.GetTaggedValue()); + PropertyBoxType box_type = val_handle->IsUndefined() ? PropertyBoxType::UNDEFINED : PropertyBoxType::CONSTANT; + attr.SetBoxType(box_type); JSHandle properties = - GlobalDictionary::PutIfAbsent(thread, dictHandle, keyHandle, JSHandle(boxHandle), attr); - objHandle->SetProperties(thread, properties); + GlobalDictionary::PutIfAbsent(thread, dict_handle, key_handle, JSHandle(box_handle), attr); + obj_handle->SetProperties(thread, properties); return true; } @@ -1097,8 +1097,8 @@ void FastRuntimeStub::SetOwnPropertyByName(JSThread *thread, JSTaggedValue recei INTERPRETER_TRACE(thread, SetOwnPropertyByName); TaggedArray *properties = TaggedArray::Cast(JSObject::Cast(receiver)->GetProperties().GetHeapObject()); PropertyAttributes attr; - uint32_t indexOrEntry; - JSTaggedValue val = FindOwnProperty(thread, JSObject::Cast(receiver), properties, key, &attr, &indexOrEntry); + uint32_t index_or_entry; + JSTaggedValue val = FindOwnProperty(thread, JSObject::Cast(receiver), properties, key, &attr, &index_or_entry); if (!val.IsHole()) { ASSERT(!attr.IsAccessor() && attr.IsWritable()); if (!properties->IsDictionaryMode()) { @@ -1110,17 +1110,17 @@ void FastRuntimeStub::SetOwnPropertyByName(JSThread *thread, JSTaggedValue recei JSObject::Cast(receiver)->GetJSHClass()->UpdatePropertyMetaData(thread, key, attr); if (attr.IsInlinedProps()) { - JSObject::Cast(receiver)->SetPropertyInlinedProps(thread, indexOrEntry, value); + JSObject::Cast(receiver)->SetPropertyInlinedProps(thread, index_or_entry, value); } else { - properties->Set(thread, indexOrEntry, value); + properties->Set(thread, index_or_entry, value); } return; } - NameDictionary::Cast(properties)->UpdateValueAndAttributes(thread, indexOrEntry, value, attr); + NameDictionary::Cast(properties)->UpdateValueAndAttributes(thread, index_or_entry, value, attr); return; } - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectOperator::FastAdd(thread, receiver, key, JSHandle(thread, value), PropertyAttributes::Default()); @@ -1131,18 +1131,18 @@ bool FastRuntimeStub::SetOwnElement(JSThread *thread, JSTaggedValue receiver, ui { INTERPRETER_TRACE(thread, SetOwnElement); PropertyAttributes attr; - uint32_t indexOrEntry; + uint32_t index_or_entry; TaggedArray *elements = TaggedArray::Cast(JSObject::Cast(receiver)->GetElements().GetHeapObject()); - bool isDict = elements->IsDictionaryMode(); - [[maybe_unused]] JSTaggedValue val = FindOwnElement(elements, index, isDict, &attr, &indexOrEntry); + bool is_dict = elements->IsDictionaryMode(); + [[maybe_unused]] JSTaggedValue val = FindOwnElement(elements, index, is_dict, &attr, &index_or_entry); if (!val.IsHole()) { ASSERT(!attr.IsAccessor() && attr.IsWritable()); - if (!isDict) { - elements->Set(thread, indexOrEntry, value); + if (!is_dict) { + elements->Set(thread, index_or_entry, value); JSObject::Cast(receiver)->GetJSHClass()->UpdateRepresentation(value); return true; } - NumberDictionary::Cast(elements)->UpdateValueAndAttributes(thread, indexOrEntry, value, attr); + NumberDictionary::Cast(elements)->UpdateValueAndAttributes(thread, index_or_entry, value, attr); return true; } @@ -1151,7 +1151,7 @@ bool FastRuntimeStub::SetOwnElement(JSThread *thread, JSTaggedValue receiver, ui } bool FastRuntimeStub::FastSetProperty(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, JSTaggedValue value, - bool mayThrow) + bool may_throw) { INTERPRETER_TRACE(thread, FastSetProperty); if (receiver.IsJSObject() && !receiver.IsTypedArray() && (key.IsStringOrSymbol())) { @@ -1162,16 +1162,16 @@ bool FastRuntimeStub::FastSetProperty(JSThread *thread, JSTaggedValue receiver, } return JSTaggedValue::SetProperty(thread, JSHandle(thread, receiver), JSHandle(thread, key), - JSHandle(thread, value), mayThrow); + JSHandle(thread, value), may_throw); } if (key.IsString()) { key = JSTaggedValue(thread->GetEcmaVM()->GetFactory()->InternString(JSHandle(thread, key))); } - return FastRuntimeStub::SetPropertyByName(thread, receiver, key, value, mayThrow); + return FastRuntimeStub::SetPropertyByName(thread, receiver, key, value, may_throw); } return JSTaggedValue::SetProperty(thread, JSHandle(thread, receiver), JSHandle(thread, key), JSHandle(thread, value), - mayThrow); + may_throw); } JSTaggedValue FastRuntimeStub::FastGetProperty(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key) @@ -1207,25 +1207,25 @@ JSTaggedValue FastRuntimeStub::FastGetProperty(JSThread *thread, JSTaggedValue r } JSTaggedValue FastRuntimeStub::FindOwnProperty(JSThread *thread, JSObject *obj, TaggedArray *properties, - JSTaggedValue key, PropertyAttributes *attr, uint32_t *indexOrEntry) + JSTaggedValue key, PropertyAttributes *attr, uint32_t *index_or_entry) { INTERPRETER_TRACE(thread, FindOwnProperty); if (!properties->IsDictionaryMode()) { JSHClass *cls = obj->GetJSHClass(); JSTaggedValue attrs = cls->GetLayout(); if (!attrs.IsNull()) { - LayoutInfo *layoutInfo = LayoutInfo::Cast(attrs.GetHeapObject()); - int propNumber = cls->NumberOfProps(); - int entry = layoutInfo->FindElementWithCache(thread, cls, key, propNumber); + LayoutInfo *layout_info = LayoutInfo::Cast(attrs.GetHeapObject()); + int prop_number = cls->NumberOfProps(); + int entry = layout_info->FindElementWithCache(thread, cls, key, prop_number); if (entry != -1) { - *attr = layoutInfo->GetAttr(entry); + *attr = layout_info->GetAttr(entry); ASSERT(entry == static_cast(attr->GetOffset())); - *indexOrEntry = entry; + *index_or_entry = entry; if (attr->IsInlinedProps()) { return obj->GetPropertyInlinedProps(entry); } - *indexOrEntry -= cls->GetInlinedProperties(); - return properties->Get(*indexOrEntry); + *index_or_entry -= cls->GetInlinedProperties(); + return properties->Get(*index_or_entry); } } return JSTaggedValue::Hole(); // properties == empty properties will return here. @@ -1235,7 +1235,7 @@ JSTaggedValue FastRuntimeStub::FindOwnProperty(JSThread *thread, JSObject *obj, GlobalDictionary *dict = GlobalDictionary::Cast(properties); int entry = dict->FindEntry(key); if (entry != -1) { - *indexOrEntry = entry; + *index_or_entry = entry; *attr = dict->GetAttributes(entry); return dict->GetValue(entry); } @@ -1245,7 +1245,7 @@ JSTaggedValue FastRuntimeStub::FindOwnProperty(JSThread *thread, JSObject *obj, NameDictionary *dict = NameDictionary::Cast(properties); int entry = dict->FindEntry(key); if (entry != -1) { - *indexOrEntry = entry; + *index_or_entry = entry; *attr = dict->GetAttributes(entry); return dict->GetValue(entry); } @@ -1253,10 +1253,10 @@ JSTaggedValue FastRuntimeStub::FindOwnProperty(JSThread *thread, JSObject *obj, return JSTaggedValue::Hole(); } -JSTaggedValue FastRuntimeStub::FindOwnElement(TaggedArray *elements, uint32_t index, bool isDict, - PropertyAttributes *attr, uint32_t *indexOrEntry) +JSTaggedValue FastRuntimeStub::FindOwnElement(TaggedArray *elements, uint32_t index, bool is_dict, + PropertyAttributes *attr, uint32_t *index_or_entry) { - if (!isDict) { + if (!is_dict) { if (elements->GetLength() <= index) { return JSTaggedValue::Hole(); } @@ -1264,14 +1264,14 @@ JSTaggedValue FastRuntimeStub::FindOwnElement(TaggedArray *elements, uint32_t in JSTaggedValue value = elements->Get(index); if (!value.IsHole()) { *attr = PropertyAttributes::Default(); - *indexOrEntry = index; + *index_or_entry = index; return value; } } else { NumberDictionary *dict = NumberDictionary::Cast(elements); int entry = dict->FindEntry(JSTaggedValue(static_cast(index))); if (entry != -1) { - *indexOrEntry = entry; + *index_or_entry = entry; *attr = dict->GetAttributes(entry); return dict->GetValue(entry); } @@ -1287,11 +1287,11 @@ JSTaggedValue FastRuntimeStub::FindOwnProperty(JSThread *thread, JSObject *obj, JSHClass *cls = obj->GetJSHClass(); JSTaggedValue attrs = cls->GetLayout(); if (!attrs.IsNull()) { - LayoutInfo *layoutInfo = LayoutInfo::Cast(attrs.GetHeapObject()); - int propsNumber = cls->NumberOfProps(); - int entry = layoutInfo->FindElementWithCache(thread, cls, key, propsNumber); + LayoutInfo *layout_info = LayoutInfo::Cast(attrs.GetHeapObject()); + int props_number = cls->NumberOfProps(); + int entry = layout_info->FindElementWithCache(thread, cls, key, props_number); if (entry != -1) { - PropertyAttributes attr(layoutInfo->GetAttr(entry)); + PropertyAttributes attr(layout_info->GetAttr(entry)); ASSERT(static_cast(attr.GetOffset()) == entry); return attr.IsInlinedProps() ? obj->GetPropertyInlinedProps(entry) : array->Get(entry - cls->GetInlinedProperties()); @@ -1353,10 +1353,10 @@ JSTaggedValue FastRuntimeStub::HasOwnProperty(JSThread *thread, JSObject *obj, J } JSTaggedValue FastRuntimeStub::GetContainerProperty(JSThread *thread, JSTaggedValue receiver, uint32_t index, - JSType jsType) + JSType js_type) { JSTaggedValue res = JSTaggedValue::Undefined(); - switch (jsType) { + switch (js_type) { case JSType::JS_ARRAY_LIST: res = JSArrayList::Cast(receiver.GetTaggedObject())->Get(thread, index); break; @@ -1367,10 +1367,10 @@ JSTaggedValue FastRuntimeStub::GetContainerProperty(JSThread *thread, JSTaggedVa } JSTaggedValue FastRuntimeStub::SetContainerProperty(JSThread *thread, JSTaggedValue receiver, uint32_t index, - JSTaggedValue value, JSType jsType) + JSTaggedValue value, JSType js_type) { JSTaggedValue res = JSTaggedValue::Undefined(); - switch (jsType) { + switch (js_type) { case JSType::JS_ARRAY_LIST: res = JSArrayList::Cast(receiver.GetTaggedObject())->Set(thread, index, value); break; diff --git a/runtime/interpreter/fast_runtime_stub.h b/runtime/interpreter/fast_runtime_stub.h index 098494b56..c68cc389c 100644 --- a/runtime/interpreter/fast_runtime_stub.h +++ b/runtime/interpreter/fast_runtime_stub.h @@ -35,7 +35,7 @@ public: static inline JSTaggedValue FastEqual(JSTaggedValue left, JSTaggedValue right); static inline JSTaggedValue FastTypeOf(JSThread *thread, JSTaggedValue obj); static inline bool FastStrictEqual(JSTaggedValue left, JSTaggedValue right); - static inline JSTaggedValue NewLexicalEnvDyn(JSThread *thread, ObjectFactory *factory, uint16_t numVars); + static inline JSTaggedValue NewLexicalEnvDyn(JSThread *thread, ObjectFactory *factory, uint16_t num_vars); static inline JSTaggedValue GetGlobalOwnProperty(JSTaggedValue receiver, JSTaggedValue key, bool *found); /* -------------- Special API For Multi-Language VM Begin ----------------- */ static inline bool IsSpecialIndexedObjForGet(JSTaggedValue obj); @@ -43,11 +43,11 @@ public: static inline JSTaggedValue GetElement(JSTaggedValue receiver, uint32_t index); static inline JSTaggedValue GetElementWithArray(JSTaggedValue receiver, uint32_t index); static inline bool SetElement(JSThread *thread, JSTaggedValue receiver, uint32_t index, JSTaggedValue value, - bool mayThrow); + bool may_throw); static inline bool SetPropertyByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, - JSTaggedValue value, bool mayThrow); + JSTaggedValue value, bool may_throw); static inline bool SetGlobalOwnProperty(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, - JSTaggedValue value, bool mayThrow); + JSTaggedValue value, bool may_throw); // set property that is not accessor and is writable static inline void SetOwnPropertyByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, @@ -55,12 +55,12 @@ public: // set element that is not accessor and is writable static inline bool SetOwnElement(JSThread *thread, JSTaggedValue receiver, uint32_t index, JSTaggedValue value); static inline bool FastSetProperty(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, JSTaggedValue value, - bool mayThrow); + bool may_throw); static inline JSTaggedValue FastGetProperty(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key); static inline JSTaggedValue FindOwnProperty(JSThread *thread, JSObject *obj, TaggedArray *properties, - JSTaggedValue key, PropertyAttributes *attr, uint32_t *indexOrEntry); - static inline JSTaggedValue FindOwnElement(TaggedArray *elements, uint32_t index, bool isDict, - PropertyAttributes *attr, uint32_t *indexOrEntry); + JSTaggedValue key, PropertyAttributes *attr, uint32_t *index_or_entry); + static inline JSTaggedValue FindOwnElement(TaggedArray *elements, uint32_t index, bool is_dict, + PropertyAttributes *attr, uint32_t *index_or_entry); static inline JSTaggedValue FindOwnProperty(JSThread *thread, JSObject *obj, JSTaggedValue key); static inline JSTaggedValue FindOwnElement(JSObject *obj, uint32_t index); @@ -69,19 +69,19 @@ public: /* -------------- Special API For Multi-Language VM End ----------------- */ /* -------------- Common API End, Don't change those interface!!! ----------------- */ - template + template static inline JSTaggedValue GetPropertyByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key); - template + template static inline JSTaggedValue GetPropertyByValue(JSThread *thread, JSTaggedValue *receiver, JSTaggedValue *key); - template + template static inline JSTaggedValue GetPropertyByIndex(JSThread *thread, JSTaggedValue receiver, uint32_t index); - template + template static inline JSTaggedValue SetPropertyByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, JSTaggedValue value); - template + template static inline JSTaggedValue SetPropertyByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, JSTaggedValue value); - template + template static inline JSTaggedValue SetPropertyByIndex(JSThread *thread, JSTaggedValue receiver, uint32_t index, JSTaggedValue value); @@ -91,30 +91,30 @@ public: JSTaggedValue value); static inline JSTaggedValue FastGetPropertyByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key); static inline JSTaggedValue FastGetPropertyByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key); - template + template static inline JSTaggedValue FastGetPropertyByIndex(JSThread *thread, JSTaggedValue receiver, uint32_t index); - static inline PropertyAttributes AddPropertyByName(JSThread *thread, JSHandle objHandle, - JSHandle keyHandle, - JSHandle valueHandle, PropertyAttributes attr); + static inline PropertyAttributes AddPropertyByName(JSThread *thread, JSHandle obj_handle, + JSHandle key_handle, + JSHandle value_handle, PropertyAttributes attr); private: friend class ICRuntimeStub; - static inline bool IsSpecialIndexedObj(JSType jsType); - static inline bool IsSpecialReceiverObj(JSType jsType); - static inline bool IsSpecialContainer(JSType jsType); + static inline bool IsSpecialIndexedObj(JSType js_type); + static inline bool IsSpecialReceiverObj(JSType js_type); + static inline bool IsSpecialContainer(JSType js_type); static inline uint32_t TryToElementsIndex(JSTaggedValue key); static inline JSTaggedValue CallGetter(JSThread *thread, JSTaggedValue receiver, JSTaggedValue holder, JSTaggedValue value); static inline JSTaggedValue CallSetter(JSThread *thread, JSTaggedValue receiver, JSTaggedValue value, - JSTaggedValue accessorValue); - static inline bool ShouldCallSetter(JSTaggedValue receiver, JSTaggedValue holder, JSTaggedValue accessorValue, + JSTaggedValue accessor_value); + static inline bool ShouldCallSetter(JSTaggedValue receiver, JSTaggedValue holder, JSTaggedValue accessor_value, PropertyAttributes attr); static inline JSTaggedValue AddPropertyByIndex(JSThread *thread, JSTaggedValue receiver, uint32_t index, JSTaggedValue value); static inline JSTaggedValue GetContainerProperty(JSThread *thread, JSTaggedValue receiver, uint32_t index, - JSType jsType); + JSType js_type); static inline JSTaggedValue SetContainerProperty(JSThread *thread, JSTaggedValue receiver, uint32_t index, - JSTaggedValue value, JSType jsType); + JSTaggedValue value, JSType js_type); }; } // namespace panda::ecmascript diff --git a/runtime/interpreter/interpreter-inl.h b/runtime/interpreter/interpreter-inl.h index dc6cb69ab..80231df85 100644 --- a/runtime/interpreter/interpreter-inl.h +++ b/runtime/interpreter/interpreter-inl.h @@ -140,27 +140,27 @@ JSTaggedValue EcmaInterpreter::ExecuteInvoke(JSThread *thread, JSTaggedValue fn_ return JSTaggedValue(ret_value); } -JSTaggedValue EcmaInterpreter::Execute(JSThread *thread, JSHandle callTarget, uint32_t numActualArgs, +JSTaggedValue EcmaInterpreter::Execute(JSThread *thread, JSHandle call_target, uint32_t num_actual_args, JSTaggedType *args) { - ASSERT(JSHandle::Cast(callTarget)->IsJSFunction()); + ASSERT(JSHandle::Cast(call_target)->IsJSFunction()); if (UNLIKELY(thread->HasPendingException())) { return JSTaggedValue::Undefined(); } - Method *method = callTarget->GetCallTarget(); + Method *method = call_target->GetCallTarget(); if (method->IsNative()) { if (!thread->IsCurrentFrameCompiled()) { - return ExecuteNative(thread, callTarget, numActualArgs, args); + return ExecuteNative(thread, call_target, num_actual_args, args); } ASSERT(!thread->HasPendingException()); TaggedValue ret_value = - method->InvokeDyn(thread, numActualArgs, reinterpret_cast(args)); + method->InvokeDyn(thread, num_actual_args, reinterpret_cast(args)); return JSTaggedValue(ret_value); } - return ExecuteInvoke(thread, callTarget, numActualArgs, reinterpret_cast(args)); + return ExecuteInvoke(thread, call_target, num_actual_args, reinterpret_cast(args)); } JSTaggedValue EcmaInterpreter::GeneratorReEnterInterpreter(JSThread *thread, JSHandle context) @@ -176,21 +176,21 @@ JSTaggedValue EcmaInterpreter::GeneratorReEnterInterpreter(JSThread *thread, JSH JSHandle func = JSHandle::Cast(JSHandle(thread, context->GetMethod())); Method *method = func->GetCallTarget(); - JSTaggedValue pcOffset = context->GetBCOffset(); + JSTaggedValue pc_offset = context->GetBCOffset(); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - const uint8_t *resumePc = method->GetInstructions() + static_cast(pcOffset.GetInt()) + - BytecodeInstruction::Size(BytecodeInstruction::Format::PREF_V8); + const uint8_t *resume_pc = method->GetInstructions() + static_cast(pc_offset.GetInt()) + + BytecodeInstruction::Size(BytecodeInstruction::Format::PREF_V8); TaggedValue acc(context->GetAcc().GetRawData()); uint32_t nregs = context->GetNRegs().GetInt(); - TaggedArray *regsArray = TaggedArray::Cast(context->GetRegsArray().GetHeapObject()); - auto *regs = reinterpret_cast(regsArray->GetData()); - ASSERT(nregs == regsArray->GetLength()); + TaggedArray *regs_array = TaggedArray::Cast(context->GetRegsArray().GetHeapObject()); + auto *regs = reinterpret_cast(regs_array->GetData()); + ASSERT(nregs == regs_array->GetLength()); // Set current functional object to thread so we can get it from InvokeHelper thread->SetFunctionalObject(func.GetTaggedValue()); thread->SetInvocationLexicalEnv(context->GetLexicalEnv()); - TaggedValue value = method->InvokeContext(thread, resumePc, acc, nregs, regs); + TaggedValue value = method->InvokeContext(thread, resume_pc, acc, nregs, regs); ASSERT(thread->GetEcmascriptEnv() == prev_env); return JSTaggedValue(value); diff --git a/runtime/interpreter/interpreter.h b/runtime/interpreter/interpreter.h index d24ded15a..89d3f6d61 100644 --- a/runtime/interpreter/interpreter.h +++ b/runtime/interpreter/interpreter.h @@ -33,7 +33,7 @@ public: const JSTaggedValue *args); static inline JSTaggedValue ExecuteInvoke(JSThread *thread, JSTaggedValue fn_object, uint32_t num_args, JSTaggedValue *args); - static inline JSTaggedValue Execute(JSThread *thread, JSHandle callTarget, uint32_t numActualArgs, + static inline JSTaggedValue Execute(JSThread *thread, JSHandle call_target, uint32_t num_actual_args, JSTaggedType *args); static inline JSTaggedValue ExecuteNative(JSThread *js_thread, JSHandle call_target, uint32_t num_args, const JSTaggedType *args); @@ -46,16 +46,16 @@ public: static inline uint8_t ReadU8(const uint8_t *pc, uint32_t offset); static inline void InitStackFrame(JSThread *thread); static inline uint32_t FindCatchBlock(JSMethod *caller, uint32_t pc); - static inline size_t GetJumpSizeAfterCall(const uint8_t *prevPc); + static inline size_t GetJumpSizeAfterCall(const uint8_t *prev_pc); static inline JSTaggedValue GetRuntimeProfileTypeInfo(JSTaggedType *sp); static inline bool UpdateHotnessCounter(JSThread *thread, JSTaggedType *sp, JSTaggedValue acc, int32_t offset); - static inline void InterpreterFrameCopyArgs(JSTaggedType *newSp, uint32_t numVregs, uint32_t numActualArgs, - uint32_t numDeclaredArgs, bool haveExtraArgs = true); + static inline void InterpreterFrameCopyArgs(JSTaggedType *new_sp, uint32_t num_vregs, uint32_t num_actual_args, + uint32_t num_declared_args, bool have_extra_args = true); static inline void NotifyBytecodePcChanged(JSThread *thread); static inline JSTaggedValue GetThisFunction(JSTaggedType *sp); static inline JSTaggedValue GetNewTarget(JSTaggedType *sp); - static inline uint32_t GetNumArgs(JSTaggedType *sp, uint32_t restIdx, uint32_t &startIdx); + static inline uint32_t GetNumArgs(JSTaggedType *sp, uint32_t rest_idx, uint32_t &start_idx); }; enum EcmaOpcode { diff --git a/runtime/interpreter/js_decode_call_instr.h b/runtime/interpreter/js_decode_call_instr.h index 0d20e9dc6..337de6a9c 100644 --- a/runtime/interpreter/js_decode_call_instr.h +++ b/runtime/interpreter/js_decode_call_instr.h @@ -11,28 +11,28 @@ #include "plugins/ecmascript/runtime/js_thread.h" namespace panda::ecmascript { -template +template ALWAYS_INLINE inline uint32_t JSGetNumberActualArgsDyn([[maybe_unused]] BytecodeInstruction inst) { - if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALL0DYN_PREF_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_V8); + if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALL0DYN_PREF_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_V8); return NUM_MANDATORY_JSFUNC_ARGS + 0; - } else if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALL1DYN_PREF_V8_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_V8_V8); + } else if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALL1DYN_PREF_V8_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_V8_V8); return NUM_MANDATORY_JSFUNC_ARGS + 1; - } else if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALL2DYN_PREF_V8_V8_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_V8_V8_V8); + } else if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALL2DYN_PREF_V8_V8_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_V8_V8_V8); return NUM_MANDATORY_JSFUNC_ARGS + 2; - } else if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALL3DYN_PREF_V8_V8_V8_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_V8_V8_V8_V8); + } else if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALL3DYN_PREF_V8_V8_V8_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_V8_V8_V8_V8); return NUM_MANDATORY_JSFUNC_ARGS + 3; - } else if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALLIRANGEDYN_PREF_IMM16_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_IMM16_V8); - auto imm = inst.GetImm(); + } else if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALLIRANGEDYN_PREF_IMM16_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_IMM16_V8); + auto imm = inst.GetImm(); return NUM_MANDATORY_JSFUNC_ARGS + imm; - } else if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALLITHISRANGEDYN_PREF_IMM16_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_IMM16_V8); - auto imm = inst.GetImm(); + } else if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALLITHISRANGEDYN_PREF_IMM16_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_IMM16_V8); + auto imm = inst.GetImm(); ASSERT(imm >= 1); // 'this' is always passed to the function return NUM_MANDATORY_JSFUNC_ARGS - 1 + imm; } else { @@ -44,7 +44,7 @@ ALWAYS_INLINE inline uint32_t JSGetNumberActualArgsDyn([[maybe_unused]] Bytecode return 0; } -template +template ALWAYS_INLINE inline static void JSCopyArgumets(JSThread *thread, Frame *prev_frame, uint16_t prev_v0, BytecodeInstruction prev_inst, Frame *new_frame, uint32_t num_vregs, uint32_t num_actual_args) @@ -78,7 +78,7 @@ ALWAYS_INLINE inline static void JSCopyArgumets(JSThread *thread, Frame *prev_fr new_frame->GetVReg(num_vregs + 0).SetValue(raw_fn_object); new_frame->GetVReg(num_vregs + 1).SetValue(JSTaggedValue::VALUE_UNDEFINED); - if constexpr (opcode != BytecodeInstruction::Opcode::ECMA_CALLITHISRANGEDYN_PREF_IMM16_V8) { + if constexpr (OPCODE != BytecodeInstruction::Opcode::ECMA_CALLITHISRANGEDYN_PREF_IMM16_V8) { JSTaggedValue fn_object(raw_fn_object); uint64_t dyn_arg2 = JSTaggedValue::VALUE_UNDEFINED; if (fn_object.IsJSFunction() && !JSFunction::Cast(fn_object.GetHeapObject())->IsStrict()) { @@ -87,32 +87,32 @@ ALWAYS_INLINE inline static void JSCopyArgumets(JSThread *thread, Frame *prev_fr new_frame->GetVReg(num_vregs + 2).SetValue(dyn_arg2); } - if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALL0DYN_PREF_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_V8); + if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALL0DYN_PREF_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_V8); ASSERT(num_actual_args == 3); // Do nothing - } else if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALL1DYN_PREF_V8_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_V8_V8); + } else if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALL1DYN_PREF_V8_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_V8_V8); ASSERT(num_actual_args == 3 + 1); new_frame->GetVReg(num_vregs + 3 + 0) = prev_frame->GetVReg(prev_inst.GetVReg(1)); - } else if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALL2DYN_PREF_V8_V8_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_V8_V8_V8); + } else if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALL2DYN_PREF_V8_V8_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_V8_V8_V8); ASSERT(num_actual_args == 3 + 2); new_frame->GetVReg(num_vregs + 3 + 0) = prev_frame->GetVReg(prev_inst.GetVReg(1)); new_frame->GetVReg(num_vregs + 3 + 1) = prev_frame->GetVReg(prev_inst.GetVReg(2)); - } else if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALL3DYN_PREF_V8_V8_V8_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_V8_V8_V8_V8); + } else if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALL3DYN_PREF_V8_V8_V8_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_V8_V8_V8_V8); ASSERT(num_actual_args == 3 + 3); new_frame->GetVReg(num_vregs + 3 + 0) = prev_frame->GetVReg(prev_inst.GetVReg(1)); new_frame->GetVReg(num_vregs + 3 + 1) = prev_frame->GetVReg(prev_inst.GetVReg(2)); new_frame->GetVReg(num_vregs + 3 + 2) = prev_frame->GetVReg(prev_inst.GetVReg(3)); - } else if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALLIRANGEDYN_PREF_IMM16_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_IMM16_V8); + } else if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALLIRANGEDYN_PREF_IMM16_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_IMM16_V8); for (uint16_t i = 1; i < (num_actual_args - 2); ++i) { new_frame->GetVReg(num_vregs + 2 + i) = prev_frame->GetVReg(prev_v0 + i); } - } else if constexpr (opcode == BytecodeInstruction::Opcode::ECMA_CALLITHISRANGEDYN_PREF_IMM16_V8) { - static_assert(format == BytecodeInstruction::Format::PREF_IMM16_V8); + } else if constexpr (OPCODE == BytecodeInstruction::Opcode::ECMA_CALLITHISRANGEDYN_PREF_IMM16_V8) { + static_assert(FORMAT == BytecodeInstruction::Format::PREF_IMM16_V8); for (uint16_t i = 0; i < (num_actual_args - 2); ++i) { new_frame->GetVReg(num_vregs + 2 + i) = prev_frame->GetVReg(prev_v0 + 1 + i); } diff --git a/runtime/interpreter/slow_runtime_helper.cpp b/runtime/interpreter/slow_runtime_helper.cpp index 4aa5bd8d1..088fe533b 100644 --- a/runtime/interpreter/slow_runtime_helper.cpp +++ b/runtime/interpreter/slow_runtime_helper.cpp @@ -33,23 +33,23 @@ JSTaggedValue GetGlobalObject(JSThread *thread) } #endif -JSTaggedValue SlowRuntimeHelper::CallBoundFunction(JSThread *thread, JSHandle boundFunc, +JSTaggedValue SlowRuntimeHelper::CallBoundFunction(JSThread *thread, JSHandle bound_func, JSHandle obj) { - JSHandle targetFunc(thread, boundFunc->GetBoundTarget()); - if (targetFunc->IsClassConstructor()) { + JSHandle target_func(thread, bound_func->GetBoundTarget()); + if (target_func->IsClassConstructor()) { THROW_TYPE_ERROR_AND_RETURN(thread, "class constructor cannot called without 'new'", JSTaggedValue::Exception()); } InternalCallParams *arguments = thread->GetInternalCallParams(); - arguments->MakeBoundArgv(thread, boundFunc); - JSHandle newTarget(thread, JSTaggedValue::Undefined()); - return InvokeJsFunction(thread, targetFunc, obj, newTarget, arguments); + arguments->MakeBoundArgv(thread, bound_func); + JSHandle new_target(thread, JSTaggedValue::Undefined()); + return InvokeJsFunction(thread, target_func, obj, new_target, arguments); } JSTaggedValue SlowRuntimeHelper::NewObject(JSThread *thread, JSHandle func, - JSHandle newTarget, uint32_t argc, + JSHandle new_target, uint32_t argc, const JSTaggedType argv[] // NOLINT(modernize-avoid-c-arrays) ) { @@ -60,32 +60,32 @@ JSTaggedValue SlowRuntimeHelper::NewObject(JSThread *thread, JSHandleIsJSFunction()) { if (func->IsBoundFunction()) { JSTaggedValue result = - JSBoundFunction::ConstructInternal(thread, JSHandle::Cast(func), newTarget); + JSBoundFunction::ConstructInternal(thread, JSHandle::Cast(func), new_target); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return result; } if (func->IsJSProxy()) { - JSTaggedValue jsObj = JSProxy::ConstructInternal(thread, JSHandle(func), argc, argv, newTarget); + JSTaggedValue js_obj = JSProxy::ConstructInternal(thread, JSHandle(func), argc, argv, new_target); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - return jsObj; + return js_obj; } THROW_TYPE_ERROR_AND_RETURN(thread, "Constructed NonConstructable", JSTaggedValue::Exception()); } - JSHandle jsFunc = JSHandle::Cast(func); - ASSERT(jsFunc->GetCallTarget() != nullptr); - ASSERT(JSFunction::Cast(newTarget->GetTaggedObject())->GetCallTarget() != nullptr); + JSHandle js_func = JSHandle::Cast(func); + ASSERT(js_func->GetCallTarget() != nullptr); + ASSERT(JSFunction::Cast(new_target->GetTaggedObject())->GetCallTarget() != nullptr); - if (jsFunc->GetCallTarget()->IsNative()) { - if (jsFunc->IsBuiltinsConstructor()) { - return InvokeJsFunction(thread, jsFunc, JSHandle(thread, JSTaggedValue::Undefined()), - newTarget, thread->GetInternalCallParams()); + if (js_func->GetCallTarget()->IsNative()) { + if (js_func->IsBuiltinsConstructor()) { + return InvokeJsFunction(thread, js_func, JSHandle(thread, JSTaggedValue::Undefined()), + new_target, thread->GetInternalCallParams()); } THROW_TYPE_ERROR_AND_RETURN(thread, "Constructed NonConstructable", JSTaggedValue::Exception()); } - JSTaggedValue result = JSFunction::ConstructInternal(thread, jsFunc, argc, argv, newTarget); + JSTaggedValue result = JSFunction::ConstructInternal(thread, js_func, argc, argv, new_target); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return result; } @@ -95,15 +95,15 @@ void SlowRuntimeHelper::SaveFrameToContext(JSThread *thread, JSHandleGetCurrentFrame(); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); uint32_t nregs = frame->GetSize(); - JSHandle regsArray = factory->NewTaggedArray(nregs); + JSHandle regs_array = factory->NewTaggedArray(nregs); for (uint32_t i = 0; i < nregs; i++) { - regsArray->Set(thread, i, VRegAsTaggedValue(frame->GetVReg(i))); + regs_array->Set(thread, i, VRegAsTaggedValue(frame->GetVReg(i))); } auto num_vregs = frame->GetMethod()->GetNumVregs(); auto func = VRegAsTaggedValue(frame->GetVReg(num_vregs)); auto acc = VRegAsTaggedValue(frame->GetAcc()); - context->SetRegsArray(thread, regsArray.GetTaggedValue()); + context->SetRegsArray(thread, regs_array.GetTaggedValue()); context->SetMethod(thread, func); context->SetAcc(thread, acc); @@ -112,8 +112,8 @@ void SlowRuntimeHelper::SaveFrameToContext(JSThread *thread, JSHandleSetLexicalEnv(thread, thread->GetCurrentLexenv()); } -JSTaggedValue ConstructGeneric(JSThread *thread, JSHandle ctor, JSHandle newTgt, - JSHandle preArgs, uint32_t argsCount, JSTaggedType *stkargs) +JSTaggedValue ConstructGeneric(JSThread *thread, JSHandle ctor, JSHandle new_tgt, + JSHandle pre_args, uint32_t args_count, JSTaggedType *stkargs) { if (!ctor->IsConstructor()) { THROW_TYPE_ERROR_AND_RETURN(thread, "Constructor is false", JSTaggedValue::Exception()); @@ -122,10 +122,10 @@ JSTaggedValue ConstructGeneric(JSThread *thread, JSHandle ctor, JSHa JSHandle obj(thread, JSTaggedValue::Undefined()); if (!ctor->IsBuiltinsConstructor() && ctor->IsBase()) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - obj = JSHandle(factory->NewJSObjectByConstructor(ctor, newTgt)); + obj = JSHandle(factory->NewJSObjectByConstructor(ctor, new_tgt)); } - uint32_t preArgsSize = preArgs->IsUndefined() ? 0 : JSHandle::Cast(preArgs)->GetLength(); - const uint32_t size = preArgsSize + argsCount; + uint32_t pre_args_size = pre_args->IsUndefined() ? 0 : JSHandle::Cast(pre_args)->GetLength(); + const uint32_t size = pre_args_size + args_count; PandaVector values; values.reserve(size); @@ -138,66 +138,66 @@ JSTaggedValue ConstructGeneric(JSThread *thread, JSHandle ctor, JSHa values.emplace_back(ctor.GetTaggedType()); // add default arg newTarget, this - values.emplace_back(newTgt.GetTaggedType()); + values.emplace_back(new_tgt.GetTaggedType()); values.emplace_back(obj.GetTaggedType()); // add preArgs when boundfunction is encountered - if (preArgsSize > 0) { - JSHandle tgaPreArgs = JSHandle::Cast(preArgs); - for (uint32_t i = 0; i < preArgsSize; ++i) { - values.emplace_back(tgaPreArgs->Get(i).GetRawData()); + if (pre_args_size > 0) { + JSHandle tga_pre_args = JSHandle::Cast(pre_args); + for (uint32_t i = 0; i < pre_args_size; ++i) { + values.emplace_back(tga_pre_args->Get(i).GetRawData()); } - for (array_size_t i = 0; i < argsCount; ++i) { + for (array_size_t i = 0; i < args_count; ++i) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) values.emplace_back(stkargs[i]); } } else { - for (array_size_t i = 0; i < argsCount; ++i) { + for (array_size_t i = 0; i < args_count; ++i) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) values.emplace_back(stkargs[i]); } } - JSTaggedValue resultValue = + JSTaggedValue result_value = EcmaInterpreter::Execute(thread, JSHandle::Cast(ctor), values.size(), values.data()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 9.3.2 [[Construct]] (argumentsList, newTarget) - if (ctor->IsBuiltinsConstructor() || resultValue.IsECMAObject()) { - return resultValue; + if (ctor->IsBuiltinsConstructor() || result_value.IsECMAObject()) { + return result_value; } if (ctor->IsBase()) { return obj.GetTaggedValue(); } - if (!resultValue.IsUndefined()) { + if (!result_value.IsUndefined()) { THROW_TYPE_ERROR_AND_RETURN(thread, "function is non-constructor", JSTaggedValue::Exception()); } return obj.GetTaggedValue(); } -JSTaggedValue ConstructBoundFunction(JSThread *thread, JSHandle ctor, JSHandle newTgt, - JSHandle preArgs, uint32_t argsCount, JSTaggedType *stkargs) +JSTaggedValue ConstructBoundFunction(JSThread *thread, JSHandle ctor, JSHandle new_tgt, + JSHandle pre_args, uint32_t args_count, JSTaggedType *stkargs) { JSHandle target(thread, ctor->GetBoundTarget()); ASSERT(target->IsConstructor()); - JSHandle boundArgs(thread, ctor->GetBoundArguments()); - JSMutableHandle newPreArgs(thread, preArgs.GetTaggedValue()); - if (newPreArgs->IsUndefined()) { - newPreArgs.Update(boundArgs.GetTaggedValue()); + JSHandle bound_args(thread, ctor->GetBoundArguments()); + JSMutableHandle new_pre_args(thread, pre_args.GetTaggedValue()); + if (new_pre_args->IsUndefined()) { + new_pre_args.Update(bound_args.GetTaggedValue()); } else { - newPreArgs.Update( - TaggedArray::Append(thread, boundArgs, JSHandle::Cast(preArgs)).GetTaggedValue()); + new_pre_args.Update( + TaggedArray::Append(thread, bound_args, JSHandle::Cast(pre_args)).GetTaggedValue()); } - JSMutableHandle newTargetMutable(thread, newTgt.GetTaggedValue()); - if (JSTaggedValue::SameValue(ctor.GetTaggedValue(), newTgt.GetTaggedValue())) { - newTargetMutable.Update(target.GetTaggedValue()); + JSMutableHandle new_target_mutable(thread, new_tgt.GetTaggedValue()); + if (JSTaggedValue::SameValue(ctor.GetTaggedValue(), new_tgt.GetTaggedValue())) { + new_target_mutable.Update(target.GetTaggedValue()); } - return SlowRuntimeHelper::Construct(thread, target, newTargetMutable, newPreArgs, argsCount, stkargs); + return SlowRuntimeHelper::Construct(thread, target, new_target_mutable, new_pre_args, args_count, stkargs); } -JSTaggedValue ConstructProxy(JSThread *thread, JSHandle ctor, JSHandle newTgt, - JSHandle preArgs, uint32_t argsCount, JSTaggedType *stkargs) +JSTaggedValue ConstructProxy(JSThread *thread, JSHandle ctor, JSHandle new_tgt, + JSHandle pre_args, uint32_t args_count, JSTaggedType *stkargs) { // step 1 ~ 4 get ProxyHandler and ProxyTarget JSHandle handler(thread, ctor->GetHandler()); @@ -218,60 +218,60 @@ JSTaggedValue ConstructProxy(JSThread *thread, JSHandle ctor, JSHandle< // b.Return Construct(target, argumentsList, newTarget). if (method->IsUndefined()) { ASSERT(target->IsConstructor()); - return SlowRuntimeHelper::Construct(thread, target, newTgt, preArgs, argsCount, stkargs); + return SlowRuntimeHelper::Construct(thread, target, new_tgt, pre_args, args_count, stkargs); } // 8.Let argArray be CreateArrayFromList(argumentsList). - uint32_t preArgsSize = preArgs->IsUndefined() ? 0 : JSHandle::Cast(preArgs)->GetLength(); - const uint32_t size = preArgsSize + argsCount; + uint32_t pre_args_size = pre_args->IsUndefined() ? 0 : JSHandle::Cast(pre_args)->GetLength(); + const uint32_t size = pre_args_size + args_count; JSHandle args = thread->GetEcmaVM()->GetFactory()->NewTaggedArray(size); - if (preArgsSize > 0) { - JSHandle tgaPreArgs = JSHandle::Cast(preArgs); - for (uint32_t i = 0; i < preArgsSize; ++i) { - JSTaggedValue value = tgaPreArgs->Get(i); + if (pre_args_size > 0) { + JSHandle tga_pre_args = JSHandle::Cast(pre_args); + for (uint32_t i = 0; i < pre_args_size; ++i) { + JSTaggedValue value = tga_pre_args->Get(i); args->Set(thread, i, value); } } - for (array_size_t i = 0; i < argsCount; ++i) { + for (array_size_t i = 0; i < args_count; ++i) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - args->Set(thread, i + preArgsSize, JSTaggedValue(stkargs[i])); + args->Set(thread, i + pre_args_size, JSTaggedValue(stkargs[i])); } // step 8 ~ 9 Call(trap, handler, «target, argArray, newTarget »). InternalCallParams *arguments = thread->GetInternalCallParams(); - arguments->MakeArgv(target, JSHandle(args), newTgt); - JSTaggedValue newObjValue = + arguments->MakeArgv(target, JSHandle(args), new_tgt); + JSTaggedValue new_obj_value = JSFunction::Call(thread, method, handler, 3, arguments->GetArgv()); // 3: «target, argArray, newTarget » // 10.ReturnIfAbrupt(newObj). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 11.If Type(newObj) is not Object, throw a TypeError exception. - if (!newObjValue.IsECMAObject()) { + if (!new_obj_value.IsECMAObject()) { THROW_TYPE_ERROR_AND_RETURN(thread, "new object is not object", JSTaggedValue::Exception()); } // 12.Return newObj. - return newObjValue; + return new_obj_value; } JSTaggedValue SlowRuntimeHelper::Construct(JSThread *thread, JSHandle ctor, - JSHandle newTarget, JSHandle preArgs, - uint32_t argsCount, JSTaggedType *stkargs) + JSHandle new_target, JSHandle pre_args, + uint32_t args_count, JSTaggedType *stkargs) { - if (newTarget->IsUndefined()) { - newTarget = ctor; + if (new_target->IsUndefined()) { + new_target = ctor; } - if (!(newTarget->IsConstructor() && ctor->IsConstructor())) { + if (!(new_target->IsConstructor() && ctor->IsConstructor())) { THROW_TYPE_ERROR_AND_RETURN(thread, "Constructor is false", JSTaggedValue::Exception()); } if (ctor->IsJSFunction()) { - return ConstructGeneric(thread, JSHandle::Cast(ctor), newTarget, preArgs, argsCount, stkargs); + return ConstructGeneric(thread, JSHandle::Cast(ctor), new_target, pre_args, args_count, stkargs); } if (ctor->IsBoundFunction()) { - return ConstructBoundFunction(thread, JSHandle::Cast(ctor), newTarget, preArgs, argsCount, + return ConstructBoundFunction(thread, JSHandle::Cast(ctor), new_target, pre_args, args_count, stkargs); } if (ctor->IsJSProxy()) { - return ConstructProxy(thread, JSHandle::Cast(ctor), newTarget, preArgs, argsCount, stkargs); + return ConstructProxy(thread, JSHandle::Cast(ctor), new_target, pre_args, args_count, stkargs); } THROW_TYPE_ERROR_AND_RETURN(thread, "Constructor NonConstructor", JSTaggedValue::Exception()); } diff --git a/runtime/interpreter/slow_runtime_helper.h b/runtime/interpreter/slow_runtime_helper.h index 73dc07d16..1d7678c1b 100644 --- a/runtime/interpreter/slow_runtime_helper.h +++ b/runtime/interpreter/slow_runtime_helper.h @@ -23,17 +23,17 @@ namespace panda::ecmascript { class SlowRuntimeHelper { public: - static JSTaggedValue NewObject(JSThread *thread, JSHandle func, JSHandle newTarget, + static JSTaggedValue NewObject(JSThread *thread, JSHandle func, JSHandle new_target, uint32_t argc, const JSTaggedType argv[] // NOLINT(modernize-avoid-c-arrays) ); - static JSTaggedValue CallBoundFunction(JSThread *thread, JSHandle boundFunc, + static JSTaggedValue CallBoundFunction(JSThread *thread, JSHandle bound_func, JSHandle obj); static void SaveFrameToContext(JSThread *thread, JSHandle context); - static JSTaggedValue Construct(JSThread *thread, JSHandle ctor, JSHandle newTarget, - JSHandle preArgs, uint32_t argsCount, JSTaggedType *stkargs); + static JSTaggedValue Construct(JSThread *thread, JSHandle ctor, JSHandle new_target, + JSHandle pre_args, uint32_t args_count, JSTaggedType *stkargs); }; } // namespace panda::ecmascript diff --git a/runtime/interpreter/slow_runtime_stub.cpp b/runtime/interpreter/slow_runtime_stub.cpp index d2b09630c..9490d6bdb 100644 --- a/runtime/interpreter/slow_runtime_stub.cpp +++ b/runtime/interpreter/slow_runtime_stub.cpp @@ -54,17 +54,17 @@ JSTaggedValue SlowRuntimeStub::CallSpreadDyn(JSThread *thread, JSTaggedValue fun if ((!obj.IsUndefined() && !obj.IsECMAObject()) || !func.IsJSFunction() || !array.IsJSArray()) { THROW_TYPE_ERROR_AND_RETURN(thread, "cannot Callspread", JSTaggedValue::Exception()); } - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle jsFunc(thread, func); - JSHandle jsArray(thread, array); - JSHandle taggedObj(thread, obj); + JSHandle js_func(thread, func); + JSHandle js_array(thread, array); + JSHandle tagged_obj(thread, obj); - JSHandle coretypesArray(thread, GetCallSpreadArgs(thread, jsArray.GetTaggedValue())); + JSHandle coretypes_array(thread, GetCallSpreadArgs(thread, js_array.GetTaggedValue())); InternalCallParams *params = thread->GetInternalCallParams(); - params->MakeArgList(*coretypesArray); - JSHandle newTarget(thread, JSTaggedValue::Undefined()); - JSTaggedValue res = InvokeJsFunction(thread, jsFunc, taggedObj, newTarget, params); + params->MakeArgList(*coretypes_array); + JSHandle new_target(thread, JSTaggedValue::Undefined()); + JSTaggedValue res = InvokeJsFunction(thread, js_func, tagged_obj, new_target, params); return res; } @@ -72,18 +72,18 @@ JSTaggedValue SlowRuntimeStub::CallSpreadDyn(JSThread *thread, JSTaggedValue fun JSTaggedValue SlowRuntimeStub::NegDyn(JSThread *thread, JSTaggedValue value) { INTERPRETER_TRACE(thread, NegDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle input(thread, value); JSTaggedNumber number = JSTaggedValue::ToNumber(thread, input); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); if (number.IsInt()) { - int32_t intValue = number.GetInt(); - if (intValue == 0) { + int32_t int_value = number.GetInt(); + if (int_value == 0) { return JSTaggedValue(-0.0); } - return JSTaggedValue(-intValue); + return JSTaggedValue(-int_value); } if (number.IsDouble()) { return JSTaggedValue(-number.GetDouble()); @@ -96,34 +96,34 @@ JSTaggedValue SlowRuntimeStub::AsyncFunctionEnter(JSThread *thread) { INTERPRETER_TRACE(thread, AsyncFunctionEnter); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); // 1. create promise - JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle promiseFunc = globalEnv->GetPromiseFunction(); + JSHandle global_env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle promise_func = global_env->GetPromiseFunction(); - JSHandle promiseObject = - JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(promiseFunc), promiseFunc)); - promiseObject->SetPromiseState(thread, JSTaggedValue(static_cast(PromiseStatus::PENDING))); + JSHandle promise_object = + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(promise_func), promise_func)); + promise_object->SetPromiseState(thread, JSTaggedValue(static_cast(PromiseStatus::PENDING))); // 2. create asyncfuncobj - JSHandle asyncFuncObj = factory->NewJSAsyncFuncObject(); - asyncFuncObj->SetPromise(thread, promiseObject); + JSHandle async_func_obj = factory->NewJSAsyncFuncObject(); + async_func_obj->SetPromise(thread, promise_object); JSHandle context = factory->NewGeneratorContext(); - context->SetGeneratorObject(thread, asyncFuncObj); + context->SetGeneratorObject(thread, async_func_obj); // change state to EXECUTING - asyncFuncObj->SetState(thread, JSGeneratorState::EXECUTING); - asyncFuncObj->SetGeneratorContext(thread, context); + async_func_obj->SetState(thread, JSGeneratorState::EXECUTING); + async_func_obj->SetGeneratorContext(thread, context); // 3. return asyncfuncobj RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - return asyncFuncObj.GetTaggedValue(); + return async_func_obj.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::ToNumber(JSThread *thread, JSTaggedValue value) { INTERPRETER_TRACE(thread, Tonumber); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle number(thread, value); // may return exception @@ -133,9 +133,9 @@ JSTaggedValue SlowRuntimeStub::ToNumber(JSThread *thread, JSTaggedValue value) JSTaggedValue SlowRuntimeStub::NotDyn(JSThread *thread, JSTaggedValue value) { INTERPRETER_TRACE(thread, NotDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle valueHandle(thread, value); - int32_t number = JSTaggedValue::ToInt32(thread, valueHandle); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle value_handle(thread, value); + int32_t number = JSTaggedValue::ToInt32(thread, value_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue(~number); // NOLINT(hicpp-signed-bitwise) } @@ -143,10 +143,10 @@ JSTaggedValue SlowRuntimeStub::NotDyn(JSThread *thread, JSTaggedValue value) JSTaggedValue SlowRuntimeStub::IncDyn(JSThread *thread, JSTaggedValue value) { INTERPRETER_TRACE(thread, IncDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle valueHandle(thread, value); - JSTaggedNumber number = JSTaggedValue::ToNumber(thread, valueHandle); + JSHandle value_handle(thread, value); + JSTaggedNumber number = JSTaggedValue::ToNumber(thread, value_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return (++number); } @@ -154,10 +154,10 @@ JSTaggedValue SlowRuntimeStub::IncDyn(JSThread *thread, JSTaggedValue value) JSTaggedValue SlowRuntimeStub::DecDyn(JSThread *thread, JSTaggedValue value) { INTERPRETER_TRACE(thread, DecDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle valueHandle(thread, value); - JSTaggedNumber number = JSTaggedValue::ToNumber(thread, valueHandle); + JSHandle value_handle(thread, value); + JSTaggedNumber number = JSTaggedValue::ToNumber(thread, value_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return (--number); } @@ -166,31 +166,31 @@ void SlowRuntimeStub::ThrowDyn(JSThread *thread, JSTaggedValue value) { INTERPRETER_TRACE(thread, ThrowDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle obj(thread, value); - JSHandle wrapperObject = factory->NewObjectWrapper(obj); + JSHandle wrapper_object = factory->NewObjectWrapper(obj); - thread->SetException(wrapperObject.GetTaggedValue()); + thread->SetException(wrapper_object.GetTaggedValue()); } JSTaggedValue SlowRuntimeStub::GetPropIterator(JSThread *thread, JSTaggedValue value) { INTERPRETER_TRACE(thread, GetPropIterator); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle objHandle(thread, value); - JSHandle iteratorHandle = JSObject::EnumerateObjectProperties(thread, objHandle); + JSHandle obj_handle(thread, value); + JSHandle iterator_handle = JSObject::EnumerateObjectProperties(thread, obj_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - iteratorHandle->SetFastRemainingIndex(JSTaggedNumber(0)); - return iteratorHandle.GetTaggedValue(); + iterator_handle->SetFastRemainingIndex(JSTaggedNumber(0)); + return iterator_handle.GetTaggedValue(); } void SlowRuntimeStub::ThrowConstAssignment(JSThread *thread, JSTaggedValue value) { INTERPRETER_TRACE(thread, ThrowConstAssignment); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); @@ -204,48 +204,48 @@ void SlowRuntimeStub::ThrowConstAssignment(JSThread *thread, JSTaggedValue value JSTaggedValue SlowRuntimeStub::Add2Dyn(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, Add2Dyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); - - JSHandle leftValue(thread, left); - JSHandle rightValue(thread, right); - if (leftValue->IsString() && rightValue->IsString()) { - EcmaString *newString = - EcmaString::Concat(JSHandle(leftValue), JSHandle(rightValue), ecma_vm); - return JSTaggedValue(newString); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + + JSHandle left_value(thread, left); + JSHandle right_value(thread, right); + if (left_value->IsString() && right_value->IsString()) { + EcmaString *new_string = + EcmaString::Concat(JSHandle(left_value), JSHandle(right_value), ecma_vm); + return JSTaggedValue(new_string); } - JSHandle primitiveA0(thread, JSTaggedValue::ToPrimitive(thread, leftValue)); + JSHandle primitive_a0(thread, JSTaggedValue::ToPrimitive(thread, left_value)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - JSHandle primitiveA1(thread, JSTaggedValue::ToPrimitive(thread, rightValue)); + JSHandle primitive_a1(thread, JSTaggedValue::ToPrimitive(thread, right_value)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // contain string - if (primitiveA0->IsString() || primitiveA1->IsString()) { - JSHandle stringA0 = JSTaggedValue::ToString(thread, primitiveA0); + if (primitive_a0->IsString() || primitive_a1->IsString()) { + JSHandle string_a0 = JSTaggedValue::ToString(thread, primitive_a0); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - JSHandle stringA1 = JSTaggedValue::ToString(thread, primitiveA1); + JSHandle string_a1 = JSTaggedValue::ToString(thread, primitive_a1); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - EcmaString *newString = EcmaString::Concat(stringA0, stringA1, ecma_vm); - return JSTaggedValue(newString); + EcmaString *new_string = EcmaString::Concat(string_a0, string_a1, ecma_vm); + return JSTaggedValue(new_string); } - JSTaggedNumber taggedValueA0 = JSTaggedValue::ToNumber(thread, primitiveA0); + JSTaggedNumber tagged_value_a0 = JSTaggedValue::ToNumber(thread, primitive_a0); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - JSTaggedNumber taggedValueA1 = JSTaggedValue::ToNumber(thread, primitiveA1); + JSTaggedNumber tagged_value_a1 = JSTaggedValue::ToNumber(thread, primitive_a1); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - double a0Double = taggedValueA0.GetNumber(); - double a1Double = taggedValueA1.GetNumber(); - return JSTaggedValue(a0Double + a1Double); + double a0_double = tagged_value_a0.GetNumber(); + double a1_double = tagged_value_a1.GetNumber(); + return JSTaggedValue(a0_double + a1_double); } JSTaggedValue SlowRuntimeStub::Sub2Dyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, Sub2Dyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle leftHandle(thread, left); - JSHandle rightHandle(thread, right); + JSHandle left_handle(thread, left); + JSHandle right_handle(thread, right); - JSTaggedNumber number0 = JSTaggedValue::ToNumber(thread, leftHandle); + JSTaggedNumber number0 = JSTaggedValue::ToNumber(thread, left_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - JSTaggedNumber number1 = JSTaggedValue::ToNumber(thread, rightHandle); + JSTaggedNumber number1 = JSTaggedValue::ToNumber(thread, right_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return number0 - number1; } @@ -253,82 +253,82 @@ JSTaggedValue SlowRuntimeStub::Sub2Dyn(JSThread *thread, JSTaggedValue left, JST JSTaggedValue SlowRuntimeStub::Mul2Dyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, Mul2Dyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle leftValue(thread, left); - JSHandle rightValue(thread, right); + JSHandle left_value(thread, left); + JSHandle right_value(thread, right); // 6. Let lnum be ToNumber(leftValue). - JSTaggedNumber primitiveA = JSTaggedValue::ToNumber(thread, leftValue); + JSTaggedNumber primitive_a = JSTaggedValue::ToNumber(thread, left_value); // 7. ReturnIfAbrupt(lnum). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 8. Let rnum be ToNumber(rightValue). - JSTaggedNumber primitiveB = JSTaggedValue::ToNumber(thread, rightValue); + JSTaggedNumber primitive_b = JSTaggedValue::ToNumber(thread, right_value); // 9. ReturnIfAbrupt(rnum). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 12.6.3.1 Applying the * Operator - return primitiveA * primitiveB; + return primitive_a * primitive_b; } JSTaggedValue SlowRuntimeStub::Div2Dyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, Div2Dyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle leftHandle(thread, left); - JSHandle rightHandle(thread, right); + JSHandle left_handle(thread, left); + JSHandle right_handle(thread, right); - JSTaggedNumber leftNumber = JSTaggedValue::ToNumber(thread, leftHandle); + JSTaggedNumber left_number = JSTaggedValue::ToNumber(thread, left_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - double dLeft = leftNumber.GetNumber(); - JSTaggedNumber rightNumber = JSTaggedValue::ToNumber(thread, rightHandle); + double d_left = left_number.GetNumber(); + JSTaggedNumber right_number = JSTaggedValue::ToNumber(thread, right_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - double dRight = rightNumber.GetNumber(); - if (dRight == 0) { - if (dLeft == 0 || std::isnan(dLeft)) { + double d_right = right_number.GetNumber(); + if (d_right == 0) { + if (d_left == 0 || std::isnan(d_left)) { return JSTaggedValue(base::NAN_VALUE); } - bool positive = (((bit_cast(dRight)) & base::DOUBLE_SIGN_MASK) == - ((bit_cast(dLeft)) & base::DOUBLE_SIGN_MASK)); + bool positive = (((bit_cast(d_right)) & base::DOUBLE_SIGN_MASK) == + ((bit_cast(d_left)) & base::DOUBLE_SIGN_MASK)); return JSTaggedValue(positive ? base::POSITIVE_INFINITY : -base::POSITIVE_INFINITY); } - return JSTaggedValue(dLeft / dRight); + return JSTaggedValue(d_left / d_right); } JSTaggedValue SlowRuntimeStub::Mod2Dyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, Mod2Dyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle leftHandle(thread, left); - JSHandle rightHandle(thread, right); + JSHandle left_handle(thread, left); + JSHandle right_handle(thread, right); - JSTaggedNumber leftNumber = JSTaggedValue::ToNumber(thread, leftHandle); + JSTaggedNumber left_number = JSTaggedValue::ToNumber(thread, left_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - double dLeft = leftNumber.GetNumber(); - JSTaggedNumber rightNumber = JSTaggedValue::ToNumber(thread, rightHandle); + double d_left = left_number.GetNumber(); + JSTaggedNumber right_number = JSTaggedValue::ToNumber(thread, right_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - double dRight = rightNumber.GetNumber(); + double d_right = right_number.GetNumber(); // 12.6.3.3 Applying the % Operator - if ((dRight == 0.0) || std::isnan(dRight) || std::isnan(dLeft) || std::isinf(dLeft)) { + if ((d_right == 0.0) || std::isnan(d_right) || std::isnan(d_left) || std::isinf(d_left)) { return JSTaggedValue(base::NAN_VALUE); } - if ((dLeft == 0.0) || std::isinf(dRight)) { - return JSTaggedValue(dLeft); + if ((d_left == 0.0) || std::isinf(d_right)) { + return JSTaggedValue(d_left); } - return JSTaggedValue(std::fmod(dLeft, dRight)); + return JSTaggedValue(std::fmod(d_left, d_right)); } JSTaggedValue SlowRuntimeStub::EqDyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, EqDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle leftValue(thread, left); - JSHandle rightValue(thread, right); - bool ret = JSTaggedValue::Equal(thread, leftValue, rightValue); + JSHandle left_value(thread, left); + JSHandle right_value(thread, right); + bool ret = JSTaggedValue::Equal(thread, left_value, right_value); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return (ret ? JSTaggedValue::True() : JSTaggedValue::False()); } @@ -336,11 +336,11 @@ JSTaggedValue SlowRuntimeStub::EqDyn(JSThread *thread, JSTaggedValue left, JSTag JSTaggedValue SlowRuntimeStub::NotEqDyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, NotEqDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle leftValue(thread, left); - JSHandle rightValue(thread, right); - bool ret = JSTaggedValue::Equal(thread, leftValue, rightValue); + JSHandle left_value(thread, left); + JSHandle right_value(thread, right); + bool ret = JSTaggedValue::Equal(thread, left_value, right_value); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return (ret ? JSTaggedValue::False() : JSTaggedValue::True()); } @@ -348,11 +348,11 @@ JSTaggedValue SlowRuntimeStub::NotEqDyn(JSThread *thread, JSTaggedValue left, JS JSTaggedValue SlowRuntimeStub::LessDyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, LessDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle leftValue(thread, left); - JSHandle rightValue(thread, right); - bool ret = JSTaggedValue::Compare(thread, leftValue, rightValue) == ComparisonResult::LESS; + JSHandle left_value(thread, left); + JSHandle right_value(thread, right); + bool ret = JSTaggedValue::Compare(thread, left_value, right_value) == ComparisonResult::LESS; RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return (ret ? JSTaggedValue::True() : JSTaggedValue::False()); } @@ -360,11 +360,11 @@ JSTaggedValue SlowRuntimeStub::LessDyn(JSThread *thread, JSTaggedValue left, JST JSTaggedValue SlowRuntimeStub::LessEqDyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, LessEqDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle leftValue(thread, left); - JSHandle rightValue(thread, right); - bool ret = JSTaggedValue::Compare(thread, leftValue, rightValue) <= ComparisonResult::EQUAL; + JSHandle left_value(thread, left); + JSHandle right_value(thread, right); + bool ret = JSTaggedValue::Compare(thread, left_value, right_value) <= ComparisonResult::EQUAL; RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return (ret ? JSTaggedValue::True() : JSTaggedValue::False()); } @@ -372,11 +372,11 @@ JSTaggedValue SlowRuntimeStub::LessEqDyn(JSThread *thread, JSTaggedValue left, J JSTaggedValue SlowRuntimeStub::GreaterDyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, GreaterDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle leftValue(thread, left); - JSHandle rightValue(thread, right); - bool ret = JSTaggedValue::Compare(thread, leftValue, rightValue) == ComparisonResult::GREAT; + JSHandle left_value(thread, left); + JSHandle right_value(thread, right); + bool ret = JSTaggedValue::Compare(thread, left_value, right_value) == ComparisonResult::GREAT; RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return (ret ? JSTaggedValue::True() : JSTaggedValue::False()); } @@ -384,11 +384,11 @@ JSTaggedValue SlowRuntimeStub::GreaterDyn(JSThread *thread, JSTaggedValue left, JSTaggedValue SlowRuntimeStub::GreaterEqDyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, GreaterEqDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle leftValue(thread, left); - JSHandle rightValue(thread, right); - ComparisonResult comparison = JSTaggedValue::Compare(thread, leftValue, rightValue); + JSHandle left_value(thread, left); + JSHandle right_value(thread, right); + ComparisonResult comparison = JSTaggedValue::Compare(thread, left_value, right_value); bool ret = (comparison == ComparisonResult::GREAT) || (comparison == ComparisonResult::EQUAL); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return (ret ? JSTaggedValue::True() : JSTaggedValue::False()); @@ -397,9 +397,9 @@ JSTaggedValue SlowRuntimeStub::GreaterEqDyn(JSThread *thread, JSTaggedValue left JSTaggedValue SlowRuntimeStub::ToJSTaggedValueWithInt32(JSThread *thread, JSTaggedValue value) { INTERPRETER_TRACE(thread, ToJSTaggedValueWithInt32); - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle valueHandle(thread, value); - int32_t res = JSTaggedValue::ToInt32(thread, valueHandle); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle value_handle(thread, value); + int32_t res = JSTaggedValue::ToInt32(thread, value_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue(res); } @@ -407,9 +407,9 @@ JSTaggedValue SlowRuntimeStub::ToJSTaggedValueWithInt32(JSThread *thread, JSTagg JSTaggedValue SlowRuntimeStub::ToJSTaggedValueWithUint32(JSThread *thread, JSTaggedValue value) { INTERPRETER_TRACE(thread, ToJSTaggedValueWithUint32); - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle valueHandle(thread, value); - int32_t res = JSTaggedValue::ToUint32(thread, valueHandle); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle value_handle(thread, value); + int32_t res = JSTaggedValue::ToUint32(thread, value_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue(res); } @@ -417,15 +417,15 @@ JSTaggedValue SlowRuntimeStub::ToJSTaggedValueWithUint32(JSThread *thread, JSTag JSTaggedValue SlowRuntimeStub::DelObjProp(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop) { INTERPRETER_TRACE(thread, Delobjprop); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle objHandle(thread, obj); - JSHandle propHandle(thread, prop); - JSHandle jsObj(JSTaggedValue::ToObject(thread, objHandle)); + JSHandle obj_handle(thread, obj); + JSHandle prop_handle(thread, prop); + JSHandle js_obj(JSTaggedValue::ToObject(thread, obj_handle)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - JSHandle propKey = JSTaggedValue::ToPropertyKey(thread, propHandle); + JSHandle prop_key = JSTaggedValue::ToPropertyKey(thread, prop_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - bool ret = JSTaggedValue::DeletePropertyOrThrow(thread, jsObj, propKey); + bool ret = JSTaggedValue::DeletePropertyOrThrow(thread, js_obj, prop_key); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue(ret); } @@ -434,65 +434,65 @@ JSTaggedValue SlowRuntimeStub::NewObjDynRange(JSThread *thread, uint16_t args_co JSTaggedValue new_target, JSTaggedType *stkargs) { INTERPRETER_TRACE(thread, NewobjDynrange); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle funcHandle(thread, JSTaggedValue(func)); - JSHandle newTargetHandle(thread, JSTaggedValue(new_target)); + JSHandle func_handle(thread, JSTaggedValue(func)); + JSHandle new_target_handle(thread, JSTaggedValue(new_target)); - JSHandle preArgs(thread, JSTaggedValue::Undefined()); - auto tagged = SlowRuntimeHelper::Construct(thread, funcHandle, newTargetHandle, preArgs, args_count, stkargs); + JSHandle pre_args(thread, JSTaggedValue::Undefined()); + auto tagged = SlowRuntimeHelper::Construct(thread, func_handle, new_target_handle, pre_args, args_count, stkargs); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return tagged; } -JSTaggedValue SlowRuntimeStub::CreateObjectWithExcludedKeys(JSThread *thread, uint16_t numKeys, JSTaggedValue objVal, +JSTaggedValue SlowRuntimeStub::CreateObjectWithExcludedKeys(JSThread *thread, uint16_t num_keys, JSTaggedValue obj_val, JSTaggedType *stkargs) { INTERPRETER_TRACE(thread, CreateObjectWithExcludedKeys); - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle obj_tval(thread, objVal); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle obj_tval(thread, obj_val); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - uint32_t numExcludedKeys = 0; - JSHandle excludedKeys = factory->NewTaggedArray(numKeys + 1); + uint32_t num_excluded_keys = 0; + JSHandle excluded_keys = factory->NewTaggedArray(num_keys + 1); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - auto excludedKey = JSTaggedValue(stkargs[0]); - if (!excludedKey.IsUndefined()) { - numExcludedKeys = numKeys + 1; - excludedKeys->Set(thread, 0, excludedKey); - for (array_size_t i = 1; i < numExcludedKeys; i++) { + auto excluded_key = JSTaggedValue(stkargs[0]); + if (!excluded_key.IsUndefined()) { + num_excluded_keys = num_keys + 1; + excluded_keys->Set(thread, 0, excluded_key); + for (array_size_t i = 1; i < num_excluded_keys; i++) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - excludedKey = JSTaggedValue(stkargs[i]); - excludedKeys->Set(thread, i, excludedKey); + excluded_key = JSTaggedValue(stkargs[i]); + excluded_keys->Set(thread, i, excluded_key); } } - JSHandle restObj = factory->NewEmptyJSObject(); - JSHandle allKeys; + JSHandle rest_obj = factory->NewEmptyJSObject(); + JSHandle all_keys; if (obj_tval->IsJSProxy()) { - allKeys = JSProxy::OwnPropertyKeys(thread, JSHandle(obj_tval)); + all_keys = JSProxy::OwnPropertyKeys(thread, JSHandle(obj_tval)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } else { ASSERT(obj_tval->IsJSObject()); JSHandle obj(obj_tval); - uint32_t numAllKeys = obj->GetNumberOfKeys(); - allKeys = factory->NewTaggedArray(numAllKeys); - JSObject::GetAllKeys(thread, obj, 0, allKeys); + uint32_t num_all_keys = obj->GetNumberOfKeys(); + all_keys = factory->NewTaggedArray(num_all_keys); + JSObject::GetAllKeys(thread, obj, 0, all_keys); } JSMutableHandle key(thread, JSTaggedValue::Undefined()); - for (uint32_t i = 0; i < allKeys->GetLength(); i++) { - key.Update(allKeys->Get(i)); - bool isExcludedKey = false; - for (uint32_t j = 0; j < numExcludedKeys; j++) { - if (JSTaggedValue::Equal(thread, key, JSHandle(thread, excludedKeys->Get(j)))) { - isExcludedKey = true; + for (uint32_t i = 0; i < all_keys->GetLength(); i++) { + key.Update(all_keys->Get(i)); + bool is_excluded_key = false; + for (uint32_t j = 0; j < num_excluded_keys; j++) { + if (JSTaggedValue::Equal(thread, key, JSHandle(thread, excluded_keys->Get(j)))) { + is_excluded_key = true; break; } } - if (!isExcludedKey) { + if (!is_excluded_key) { PropertyDescriptor desc(thread); bool success = JSTaggedValue::GetOwnProperty(thread, obj_tval, key, desc); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); @@ -500,44 +500,44 @@ JSTaggedValue SlowRuntimeStub::CreateObjectWithExcludedKeys(JSThread *thread, ui JSHandle value = JSObject::GetProperty(thread, JSHandle(obj_tval), key).GetValue(); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - JSObject::SetProperty(thread, restObj, key, value, true); + JSObject::SetProperty(thread, rest_obj, key, value, true); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } } } - return restObj.GetTaggedValue(); + return rest_obj.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::ExpDyn(JSThread *thread, JSTaggedValue base, JSTaggedValue exponent) { INTERPRETER_TRACE(thread, ExpDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle base_handle(thread, base); JSHandle exp_handle(thread, exponent); - JSTaggedNumber baseNumber = JSTaggedValue::ToNumber(thread, base_handle); + JSTaggedNumber base_number = JSTaggedValue::ToNumber(thread, base_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - double doubleBase = baseNumber.GetNumber(); - JSTaggedNumber exponentNumber = JSTaggedValue::ToNumber(thread, exp_handle); + double double_base = base_number.GetNumber(); + JSTaggedNumber exponent_number = JSTaggedValue::ToNumber(thread, exp_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - double doubleExponent = exponentNumber.GetNumber(); + double double_exponent = exponent_number.GetNumber(); - return base::NumberHelper::Pow(doubleBase, doubleExponent); + return base::NumberHelper::Pow(double_base, double_exponent); } JSTaggedValue SlowRuntimeStub::IsInDyn(JSThread *thread, JSTaggedValue prop, JSTaggedValue obj) { INTERPRETER_TRACE(thread, IsInDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle propHandle(thread, prop); - JSHandle objHandle(thread, obj); - if (!objHandle->IsECMAObject()) { + JSHandle prop_handle(thread, prop); + JSHandle obj_handle(thread, obj); + if (!obj_handle->IsECMAObject()) { return ThrowTypeError(thread, "Cannot use 'in' operator in Non-Object"); } - JSHandle propKey = JSTaggedValue::ToPropertyKey(thread, propHandle); + JSHandle prop_key = JSTaggedValue::ToPropertyKey(thread, prop_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - bool ret = JSTaggedValue::HasProperty(thread, objHandle, propKey); + bool ret = JSTaggedValue::HasProperty(thread, obj_handle, prop_key); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue(ret); } @@ -545,46 +545,46 @@ JSTaggedValue SlowRuntimeStub::IsInDyn(JSThread *thread, JSTaggedValue prop, JST JSTaggedValue SlowRuntimeStub::InstanceofDyn(JSThread *thread, JSTaggedValue obj, JSTaggedValue target) { INTERPRETER_TRACE(thread, InstanceofDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle objHandle(thread, obj); - JSHandle targetHandle(thread, target); - bool ret = JSObject::InstanceOf(thread, objHandle, targetHandle); + JSHandle obj_handle(thread, obj); + JSHandle target_handle(thread, target); + bool ret = JSObject::InstanceOf(thread, obj_handle, target_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue(ret); } -JSTaggedValue SlowRuntimeStub::NewLexicalEnvDyn(JSThread *thread, uint16_t numVars) +JSTaggedValue SlowRuntimeStub::NewLexicalEnvDyn(JSThread *thread, uint16_t num_vars) { INTERPRETER_TRACE(thread, NewlexenvDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle newEnv = factory->NewLexicalEnv(numVars); + JSHandle new_env = factory->NewLexicalEnv(num_vars); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - return newEnv.GetTaggedValue(); + return new_env.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::CreateIterResultObj(JSThread *thread, JSTaggedValue value, bool done) { INTERPRETER_TRACE(thread, CreateIterResultObj); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle valueHandle(thread, value); - JSHandle iter = JSIterator::CreateIterResultObject(thread, valueHandle, done); + JSHandle value_handle(thread, value); + JSHandle iter = JSIterator::CreateIterResultObject(thread, value_handle, done); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return iter.GetTaggedValue(); } -JSTaggedValue SlowRuntimeStub::CreateGeneratorObj(JSThread *thread, JSTaggedValue genFunc) +JSTaggedValue SlowRuntimeStub::CreateGeneratorObj(JSThread *thread, JSTaggedValue gen_func) { INTERPRETER_TRACE(thread, CreateGeneratorObj); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle generatorFunction(thread, genFunc); - JSHandle obj = factory->NewJSGeneratorObject(generatorFunction); + JSHandle generator_function(thread, gen_func); + JSHandle obj = factory->NewJSGeneratorObject(generator_function); JSHandle context = factory->NewGeneratorContext(); context->SetGeneratorObject(thread, obj.GetTaggedValue()); @@ -596,81 +596,81 @@ JSTaggedValue SlowRuntimeStub::CreateGeneratorObj(JSThread *thread, JSTaggedValu return obj.GetTaggedValue(); } -JSTaggedValue SlowRuntimeStub::SetGeneratorState(JSThread *thread, JSTaggedValue genObj, uint8_t state) +JSTaggedValue SlowRuntimeStub::SetGeneratorState(JSThread *thread, JSTaggedValue gen_obj, uint8_t state) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle generatorObjectHandle(thread, genObj); - generatorObjectHandle->SetState(thread, static_cast(state)); + JSHandle generator_object_handle(thread, gen_obj); + generator_object_handle->SetState(thread, static_cast(state)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue::Undefined(); } -JSTaggedValue SlowRuntimeStub::CreateAsyncGeneratorObj(JSThread *thread, JSTaggedValue genFunc) +JSTaggedValue SlowRuntimeStub::CreateAsyncGeneratorObj(JSThread *thread, JSTaggedValue gen_func) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle generatorFunction(thread, genFunc); - JSHandle obj = factory->NewJSAsyncGeneratorObject(generatorFunction); + JSHandle generator_function(thread, gen_func); + JSHandle obj = factory->NewJSAsyncGeneratorObject(generator_function); JSHandle context = factory->NewGeneratorContext(); - JSHandle asyncQueue = factory->NewTaggedQueue(0); + JSHandle async_queue = factory->NewTaggedQueue(0); context->SetGeneratorObject(thread, obj.GetTaggedValue()); // change state to SUSPENDED_START obj->SetState(thread, JSGeneratorState::SUSPENDED_START); obj->SetGeneratorContext(thread, context); - obj->SetAsyncGeneratorQueue(thread, asyncQueue); + obj->SetAsyncGeneratorQueue(thread, async_queue); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return obj.GetTaggedValue(); } -JSTaggedValue SlowRuntimeStub::SuspendGenerator(JSThread *thread, JSTaggedValue genObj, JSTaggedValue value) +JSTaggedValue SlowRuntimeStub::SuspendGenerator(JSThread *thread, JSTaggedValue gen_obj, JSTaggedValue value) { INTERPRETER_TRACE(thread, SuspendGenerator); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle generatorObjectHandle(thread, genObj); - JSHandle genContextHandle(thread, generatorObjectHandle->GetGeneratorContext()); - JSHandle valueHandle(thread, value); + JSHandle generator_object_handle(thread, gen_obj); + JSHandle gen_context_handle(thread, generator_object_handle->GetGeneratorContext()); + JSHandle value_handle(thread, value); // save stack, should copy cur_frame, function execute over will free cur_frame - SlowRuntimeHelper::SaveFrameToContext(thread, genContextHandle); + SlowRuntimeHelper::SaveFrameToContext(thread, gen_context_handle); - return valueHandle.GetTaggedValue(); + return value_handle.GetTaggedValue(); } -JSTaggedValue SlowRuntimeStub::SuspendAsyncGenerator(JSThread *thread, JSTaggedValue asyncGenObj, JSTaggedValue value) +JSTaggedValue SlowRuntimeStub::SuspendAsyncGenerator(JSThread *thread, JSTaggedValue async_gen_obj, JSTaggedValue value) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle asyncGeneratorObjectHandle(thread, asyncGenObj); - JSHandle asyncGeneratorHandle(thread, asyncGenObj); - JSHandle genContextHandle(thread, asyncGeneratorObjectHandle->GetGeneratorContext()); - JSHandle valueHandle(thread, value); + JSHandle async_generator_object_handle(thread, async_gen_obj); + JSHandle async_generator_handle(thread, async_gen_obj); + JSHandle gen_context_handle(thread, async_generator_object_handle->GetGeneratorContext()); + JSHandle value_handle(thread, value); // save stack, should copy cur_frame, function execute over will free cur_frame - SlowRuntimeHelper::SaveFrameToContext(thread, genContextHandle); + SlowRuntimeHelper::SaveFrameToContext(thread, gen_context_handle); - return JSAsyncGeneratorObject::AsyncGeneratorResolve(thread, asyncGeneratorHandle, valueHandle, false) + return JSAsyncGeneratorObject::AsyncGeneratorResolve(thread, async_generator_handle, value_handle, false) .GetTaggedValue(); } -JSTaggedValue SlowRuntimeStub::AsyncFunctionAwait(JSThread *thread, JSTaggedValue asyncFuncObj, JSTaggedValue value) +JSTaggedValue SlowRuntimeStub::AsyncFunctionAwait(JSThread *thread, JSTaggedValue async_func_obj, JSTaggedValue value) { INTERPRETER_TRACE(thread, AsyncFunctionAwait); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle asyncFuncObjHandle(thread, asyncFuncObj); - JSHandle valueHandle(thread, value); - JSAsyncFuncObject::AsyncFunctionAwait(thread, asyncFuncObjHandle, valueHandle); - JSHandle promise(thread, asyncFuncObjHandle->GetPromise()); + JSHandle async_func_obj_handle(thread, async_func_obj); + JSHandle value_handle(thread, value); + JSAsyncFuncObject::AsyncFunctionAwait(thread, async_func_obj_handle, value_handle); + JSHandle promise(thread, async_func_obj_handle->GetPromise()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return promise.GetTaggedValue(); } -JSTaggedValue SlowRuntimeStub::AsyncFunctionResolveOrReject(JSThread *thread, JSTaggedValue asyncFuncObj, +JSTaggedValue SlowRuntimeStub::AsyncFunctionResolveOrReject(JSThread *thread, JSTaggedValue async_func_obj, JSTaggedValue value, bool is_resolve) { if (is_resolve) { @@ -679,96 +679,96 @@ JSTaggedValue SlowRuntimeStub::AsyncFunctionResolveOrReject(JSThread *thread, JS INTERPRETER_TRACE(thread, AsyncFunctionReject); } - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle asyncFuncObjHandle(thread, asyncFuncObj); - JSHandle promise(thread, asyncFuncObjHandle->GetPromise()); - JSHandle valueHandle(thread, value); + JSHandle async_func_obj_handle(thread, async_func_obj); + JSHandle promise(thread, async_func_obj_handle->GetPromise()); + JSHandle value_handle(thread, value); // ActivePromise JSHandle reactions = JSPromise::CreateResolvingFunctions(thread, promise); - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); - JSHandle thisArg = globalConst->GetHandledUndefined(); - JSHandle activeFunc; + const GlobalEnvConstants *global_const = thread->GlobalConstants(); + JSHandle this_arg = global_const->GetHandledUndefined(); + JSHandle active_func; if (is_resolve) { - activeFunc = JSHandle(thread, reactions->GetResolveFunction()); + active_func = JSHandle(thread, reactions->GetResolveFunction()); } else { - activeFunc = JSHandle(thread, reactions->GetRejectFunction()); + active_func = JSHandle(thread, reactions->GetRejectFunction()); } InternalCallParams *arguments = thread->GetInternalCallParams(); - arguments->MakeArgv(valueHandle); - [[maybe_unused]] JSTaggedValue res = JSFunction::Call(thread, activeFunc, thisArg, 1, arguments->GetArgv()); + arguments->MakeArgv(value_handle); + [[maybe_unused]] JSTaggedValue res = JSFunction::Call(thread, active_func, this_arg, 1, arguments->GetArgv()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return promise.GetTaggedValue(); } // 27.6.3.2 AsyncGeneratorStart (generator, generatorBody) -JSTaggedValue SlowRuntimeStub::AsyncGeneratorResolve(JSThread *thread, JSTaggedValue asyncGenObj, JSTaggedValue value) +JSTaggedValue SlowRuntimeStub::AsyncGeneratorResolve(JSThread *thread, JSTaggedValue async_gen_obj, JSTaggedValue value) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle asyncGeneratorHandle(thread, asyncGenObj); - JSHandle valueHandle(thread, value); + JSHandle async_generator_handle(thread, async_gen_obj); + JSHandle value_handle(thread, value); // e. Set generator.[[AsyncGeneratorState]] to completed. - JSAsyncGeneratorObject::Cast(asyncGenObj.GetHeapObject())->SetState(thread, JSGeneratorState::COMPLETED); + JSAsyncGeneratorObject::Cast(async_gen_obj.GetHeapObject())->SetState(thread, JSGeneratorState::COMPLETED); // f. If result is a normal completion, let resultValue be undefined. // i. Let resultValue be result.[[Value]]. // h. Return ! AsyncGeneratorResolve(generator, resultValue, true). - return JSAsyncGeneratorObject::AsyncGeneratorResolve(thread, asyncGeneratorHandle, valueHandle, true) + return JSAsyncGeneratorObject::AsyncGeneratorResolve(thread, async_generator_handle, value_handle, true) .GetTaggedValue(); } // 27.6.3.2 AsyncGeneratorStart (generator, generatorBody) -JSTaggedValue SlowRuntimeStub::AsyncGeneratorReject(JSThread *thread, JSTaggedValue asyncGenObj, JSTaggedValue value) +JSTaggedValue SlowRuntimeStub::AsyncGeneratorReject(JSThread *thread, JSTaggedValue async_gen_obj, JSTaggedValue value) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle asyncGeneratorHandle(thread, asyncGenObj); - JSHandle valueHandle(thread, value); + JSHandle async_generator_handle(thread, async_gen_obj); + JSHandle value_handle(thread, value); // e. Set generator.[[AsyncGeneratorState]] to completed. - JSAsyncGeneratorObject::Cast(asyncGenObj.GetHeapObject())->SetState(thread, JSGeneratorState::COMPLETED); + JSAsyncGeneratorObject::Cast(async_gen_obj.GetHeapObject())->SetState(thread, JSGeneratorState::COMPLETED); // ii. ii. If result.[[Type]] is not return, then // 1. Return ! AsyncGeneratorReject(generator, resultValue). // 1. 1. Return ! AsyncGeneratorReject(generator, resultValue). - return JSAsyncGeneratorObject::AsyncGeneratorReject(thread, asyncGeneratorHandle, valueHandle).GetTaggedValue(); + return JSAsyncGeneratorObject::AsyncGeneratorReject(thread, async_generator_handle, value_handle).GetTaggedValue(); } -JSTaggedValue SlowRuntimeStub::NewObjSpreadDyn(JSThread *thread, JSTaggedValue func, JSTaggedValue newTarget, +JSTaggedValue SlowRuntimeStub::NewObjSpreadDyn(JSThread *thread, JSTaggedValue func, JSTaggedValue new_target, JSTaggedValue array) { INTERPRETER_TRACE(thread, NewobjspreadDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle funcHandle(thread, func); - JSHandle newTargetHandle(thread, newTarget); - JSHandle jsArray(thread, array); - if (!jsArray->IsJSArray()) { + JSHandle func_handle(thread, func); + JSHandle new_target_handle(thread, new_target); + JSHandle js_array(thread, array); + if (!js_array->IsJSArray()) { return ThrowTypeError(thread, "Cannot Newobjspread"); } - uint32_t length = JSHandle::Cast(jsArray)->GetArrayLength(); - JSHandle argsArray = factory->NewTaggedArray(length); + uint32_t length = JSHandle::Cast(js_array)->GetArrayLength(); + JSHandle args_array = factory->NewTaggedArray(length); for (uint32_t i = 0; i < length; ++i) { - auto prop = JSTaggedValue::GetProperty(thread, jsArray, i).GetValue(); - argsArray->Set(thread, i, prop); + auto prop = JSTaggedValue::GetProperty(thread, js_array, i).GetValue(); + args_array->Set(thread, i, prop); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } InternalCallParams *arguments = thread->GetInternalCallParams(); - arguments->MakeArgList(*argsArray); - auto tagged = SlowRuntimeHelper::NewObject(thread, funcHandle, newTargetHandle, length, arguments->GetArgv()); + arguments->MakeArgList(*args_array); + auto tagged = SlowRuntimeHelper::NewObject(thread, func_handle, new_target_handle, length, arguments->GetArgv()); return tagged; } void SlowRuntimeStub::ThrowUndefinedIfHole(JSThread *thread, JSTaggedValue obj) { INTERPRETER_TRACE(thread, ThrowUndefinedIfHole); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle name(thread, obj); @@ -778,15 +778,15 @@ void SlowRuntimeStub::ThrowUndefinedIfHole(JSThread *thread, JSTaggedValue obj) THROW_NEW_ERROR_AND_RETURN(thread, factory->NewJSError(base::ErrorType::REFERENCE_ERROR, msg).GetTaggedValue()); } -JSTaggedValue SlowRuntimeStub::ThrowIfSuperNotCorrectCall(JSThread *thread, uint16_t index, JSTaggedValue thisValue) +JSTaggedValue SlowRuntimeStub::ThrowIfSuperNotCorrectCall(JSThread *thread, uint16_t index, JSTaggedValue this_value) { INTERPRETER_TRACE(thread, ThrowIfSuperNotCorrectCall); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - if (index == 0 && (thisValue.IsUndefined() || thisValue.IsHole())) { + if (index == 0 && (this_value.IsUndefined() || this_value.IsHole())) { return ThrowReferenceError(thread, JSTaggedValue::Undefined(), "sub-class must call super before use 'this'"); } - if (index == 1 && !thisValue.IsUndefined() && !thisValue.IsHole()) { + if (index == 1 && !this_value.IsUndefined() && !this_value.IsHole()) { return ThrowReferenceError(thread, JSTaggedValue::Undefined(), "super() forbidden re-bind 'this'"); } return JSTaggedValue::True(); @@ -795,7 +795,7 @@ JSTaggedValue SlowRuntimeStub::ThrowIfSuperNotCorrectCall(JSThread *thread, uint void SlowRuntimeStub::ThrowIfNotObject(JSThread *thread) { INTERPRETER_TRACE(thread, ThrowIfNotObject); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); THROW_TYPE_ERROR(thread, "Inner return result is not object"); } @@ -803,7 +803,7 @@ void SlowRuntimeStub::ThrowIfNotObject(JSThread *thread) void SlowRuntimeStub::ThrowThrowNotExists(JSThread *thread) { INTERPRETER_TRACE(thread, ThrowThrowNotExists); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); THROW_TYPE_ERROR(thread, "Throw method is not defined"); } @@ -811,7 +811,7 @@ void SlowRuntimeStub::ThrowThrowNotExists(JSThread *thread) void SlowRuntimeStub::ThrowPatternNonCoercible(JSThread *thread) { INTERPRETER_TRACE(thread, ThrowPatternNonCoercible); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle msg(thread->GlobalConstants()->GetHandledObjNotCoercibleString()); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); @@ -821,24 +821,24 @@ void SlowRuntimeStub::ThrowPatternNonCoercible(JSThread *thread) JSTaggedValue SlowRuntimeStub::StOwnByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, JSTaggedValue value) { INTERPRETER_TRACE(thread, StOwnByNameDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); - JSHandle objHandle(thread, obj); - JSHandle propHandle(thread, prop); - JSHandle valueHandle(thread, value); - ASSERT(propHandle->IsStringOrSymbol()); + const GlobalEnvConstants *global_const = thread->GlobalConstants(); + JSHandle obj_handle(thread, obj); + JSHandle prop_handle(thread, prop); + JSHandle value_handle(thread, value); + ASSERT(prop_handle->IsStringOrSymbol()); - if (objHandle->IsClassConstructor() && - JSTaggedValue::SameValue(propHandle, globalConst->GetHandledPrototypeString())) { + if (obj_handle->IsClassConstructor() && + JSTaggedValue::SameValue(prop_handle, global_const->GetHandledPrototypeString())) { return ThrowTypeError(thread, "In a class, static property named 'prototype' throw a TypeError"); } // property in class is non-enumerable - bool enumerable = !(objHandle->IsClassPrototype() || objHandle->IsClassConstructor()); + bool enumerable = !(obj_handle->IsClassPrototype() || obj_handle->IsClassConstructor()); - PropertyDescriptor desc(thread, valueHandle, true, enumerable, true); - bool ret = JSTaggedValue::DefineOwnProperty(thread, objHandle, propHandle, desc); + PropertyDescriptor desc(thread, value_handle, true, enumerable, true); + bool ret = JSTaggedValue::DefineOwnProperty(thread, obj_handle, prop_handle, desc); if (!ret) { return ThrowTypeError(thread, "SetOwnByName failed"); } @@ -849,24 +849,24 @@ JSTaggedValue SlowRuntimeStub::StOwnByNameWithNameSet(JSThread *thread, JSTagged JSTaggedValue value) { INTERPRETER_TRACE(thread, StOwnByNameDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle objHandle(thread, obj); - JSHandle propHandle(thread, prop); - JSHandle valueHandle(thread, value); - ASSERT(propHandle->IsStringOrSymbol()); + JSHandle obj_handle(thread, obj); + JSHandle prop_handle(thread, prop); + JSHandle value_handle(thread, value); + ASSERT(prop_handle->IsStringOrSymbol()); - JSHandle propKey = JSTaggedValue::ToPropertyKey(thread, propHandle); + JSHandle prop_key = JSTaggedValue::ToPropertyKey(thread, prop_handle); // property in class is non-enumerable - bool enumerable = !(objHandle->IsClassPrototype() || objHandle->IsClassConstructor()); + bool enumerable = !(obj_handle->IsClassPrototype() || obj_handle->IsClassConstructor()); - PropertyDescriptor desc(thread, valueHandle, true, enumerable, true); - bool ret = JSTaggedValue::DefineOwnProperty(thread, objHandle, propHandle, desc); + PropertyDescriptor desc(thread, value_handle, true, enumerable, true); + bool ret = JSTaggedValue::DefineOwnProperty(thread, obj_handle, prop_handle, desc); if (!ret) { return ThrowTypeError(thread, "SetOwnByNameWithNameSet failed"); } - JSFunctionBase::SetFunctionName(thread, JSHandle::Cast(valueHandle), propKey, + JSFunctionBase::SetFunctionName(thread, JSHandle::Cast(value_handle), prop_key, JSHandle(thread, JSTaggedValue::Undefined())); return JSTaggedValue::True(); } @@ -874,17 +874,17 @@ JSTaggedValue SlowRuntimeStub::StOwnByNameWithNameSet(JSThread *thread, JSTagged JSTaggedValue SlowRuntimeStub::StOwnByIndex(JSThread *thread, JSTaggedValue obj, uint32_t idx, JSTaggedValue value) { INTERPRETER_TRACE(thread, StOwnByIdDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle objHandle(thread, obj); - JSHandle idxHandle(thread, JSTaggedValue(idx)); - JSHandle valueHandle(thread, value); + JSHandle obj_handle(thread, obj); + JSHandle idx_handle(thread, JSTaggedValue(idx)); + JSHandle value_handle(thread, value); // property in class is non-enumerable - bool enumerable = !(objHandle->IsClassPrototype() || objHandle->IsClassConstructor()); + bool enumerable = !(obj_handle->IsClassPrototype() || obj_handle->IsClassConstructor()); - PropertyDescriptor desc(thread, valueHandle, true, enumerable, true); - bool ret = JSTaggedValue::DefineOwnProperty(thread, objHandle, idxHandle, desc); + PropertyDescriptor desc(thread, value_handle, true, enumerable, true); + bool ret = JSTaggedValue::DefineOwnProperty(thread, obj_handle, idx_handle, desc); if (!ret) { return ThrowTypeError(thread, "SetOwnByIndex failed"); } @@ -894,12 +894,12 @@ JSTaggedValue SlowRuntimeStub::StOwnByIndex(JSThread *thread, JSTaggedValue obj, JSTaggedValue SlowRuntimeStub::StOwnByValue(JSThread *thread, const JSHandle &obj, const JSHandle &key, const JSHandle &value) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); INTERPRETER_TRACE(thread, StOwnByValueDyn); - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); + const GlobalEnvConstants *global_const = thread->GlobalConstants(); - if (obj->IsClassConstructor() && JSTaggedValue::SameValue(key, globalConst->GetHandledPrototypeString())) { + if (obj->IsClassConstructor() && JSTaggedValue::SameValue(key, global_const->GetHandledPrototypeString())) { return ThrowTypeError(thread, "In a class, static property named 'prototype' throw a TypeError"); } @@ -907,16 +907,16 @@ JSTaggedValue SlowRuntimeStub::StOwnByValue(JSThread *thread, const JSHandleIsClassPrototype() || obj->IsClassConstructor()); PropertyDescriptor desc(thread, value, true, enumerable, true); - JSMutableHandle propKey(JSTaggedValue::ToPropertyKey(thread, key)); - bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, propKey, desc); + JSMutableHandle prop_key(JSTaggedValue::ToPropertyKey(thread, key)); + bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, prop_key, desc); if (!ret) { return ThrowTypeError(thread, "StOwnByValue failed"); } if (value->IsJSFunction()) { - if (propKey->IsNumber()) { - propKey.Update(base::NumberHelper::NumberToString(thread, propKey.GetTaggedValue()).GetTaggedValue()); + if (prop_key->IsNumber()) { + prop_key.Update(base::NumberHelper::NumberToString(thread, prop_key.GetTaggedValue()).GetTaggedValue()); } - JSFunctionBase::SetFunctionName(thread, JSHandle::Cast(value), propKey, + JSFunctionBase::SetFunctionName(thread, JSHandle::Cast(value), prop_key, JSHandle(thread, JSTaggedValue::Undefined())); } return JSTaggedValue::True(); @@ -925,11 +925,11 @@ JSTaggedValue SlowRuntimeStub::StOwnByValue(JSThread *thread, const JSHandle obj, JSHandle key, JSHandle value) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); INTERPRETER_TRACE(thread, StOwnByValueDyn); - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); + const GlobalEnvConstants *global_const = thread->GlobalConstants(); - if (obj->IsClassConstructor() && JSTaggedValue::SameValue(key, globalConst->GetHandledPrototypeString())) { + if (obj->IsClassConstructor() && JSTaggedValue::SameValue(key, global_const->GetHandledPrototypeString())) { return ThrowTypeError(thread, "In a class, static property named 'prototype' throw a TypeError"); } @@ -937,79 +937,80 @@ JSTaggedValue SlowRuntimeStub::StOwnByValueWithNameSet(JSThread *thread, JSHandl bool enumerable = !(obj->IsClassPrototype() || obj->IsClassConstructor()); PropertyDescriptor desc(thread, value, true, enumerable, true); - JSMutableHandle propKey(JSTaggedValue::ToPropertyKey(thread, key)); - bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, propKey, desc); + JSMutableHandle prop_key(JSTaggedValue::ToPropertyKey(thread, key)); + bool ret = JSTaggedValue::DefineOwnProperty(thread, obj, prop_key, desc); if (!ret) { return ThrowTypeError(thread, "StOwnByValueWithNameSet failed"); } if (value->IsJSFunction()) { - if (propKey->IsNumber()) { - propKey.Update(base::NumberHelper::NumberToString(thread, propKey.GetTaggedValue()).GetTaggedValue()); + if (prop_key->IsNumber()) { + prop_key.Update(base::NumberHelper::NumberToString(thread, prop_key.GetTaggedValue()).GetTaggedValue()); } - JSFunctionBase::SetFunctionName(thread, JSHandle::Cast(value), propKey, + JSFunctionBase::SetFunctionName(thread, JSHandle::Cast(value), prop_key, JSHandle(thread, JSTaggedValue::Undefined())); } return JSTaggedValue::True(); } -JSTaggedValue SlowRuntimeStub::CreateEmptyArray(JSThread *thread, ObjectFactory *factory, JSHandle globalEnv) +JSTaggedValue SlowRuntimeStub::CreateEmptyArray(JSThread *thread, ObjectFactory *factory, + JSHandle global_env) { INTERPRETER_TRACE(thread, CreateEmptyArray); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle builtinObj(globalEnv->GetArrayFunction()); - JSHandle arr = factory->NewJSObjectByConstructor(builtinObj, JSHandle(builtinObj)); + JSHandle builtin_obj(global_env->GetArrayFunction()); + JSHandle arr = factory->NewJSObjectByConstructor(builtin_obj, JSHandle(builtin_obj)); return arr.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::CreateEmptyObject(JSThread *thread, ObjectFactory *factory, - JSHandle globalEnv) + JSHandle global_env) { INTERPRETER_TRACE(thread, CreateEmptyObject); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle builtinObj(globalEnv->GetObjectFunction()); - JSHandle obj = factory->NewJSObjectByConstructor(builtinObj, JSHandle(builtinObj)); + JSHandle builtin_obj(global_env->GetObjectFunction()); + JSHandle obj = factory->NewJSObjectByConstructor(builtin_obj, JSHandle(builtin_obj)); return obj.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::CreateObjectWithBuffer(JSThread *thread, ObjectFactory *factory, JSObject *literal) { INTERPRETER_TRACE(thread, CreateObjectWithBuffer); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle obj(thread, literal); - JSHandle objLiteral = factory->CloneObjectLiteral(obj); + JSHandle obj_literal = factory->CloneObjectLiteral(obj); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - return objLiteral.GetTaggedValue(); + return obj_literal.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::CreateObjectHavingMethod(JSThread *thread, ObjectFactory *factory, JSObject *literal, JSTaggedValue env, ConstantPool *constpool) { INTERPRETER_TRACE(thread, CreateObjectHavingMethod); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle obj(thread, literal); - JSHandle objLiteral = factory->CloneObjectLiteral( + JSHandle obj_literal = factory->CloneObjectLiteral( obj, JSHandle(thread, env), JSHandle(thread, JSTaggedValue(constpool))); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - return objLiteral.GetTaggedValue(); + return obj_literal.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::SetObjectWithProto(JSThread *thread, JSTaggedValue proto, JSTaggedValue obj) { INTERPRETER_TRACE(thread, SetObjectWithProto); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); if (!proto.IsECMAObject() && !proto.IsNull()) { return JSTaggedValue::False(); } - JSHandle protoHandle(thread, proto); - JSHandle objHandle(thread, obj); - JSObject::SetPrototype(thread, objHandle, protoHandle); + JSHandle proto_handle(thread, proto); + JSHandle obj_handle(thread, obj); + JSObject::SetPrototype(thread, obj_handle, proto_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue::True(); } @@ -1017,92 +1018,92 @@ JSTaggedValue SlowRuntimeStub::SetObjectWithProto(JSThread *thread, JSTaggedValu JSTaggedValue SlowRuntimeStub::CloseIterator(JSThread *thread, JSTaggedValue iter) { INTERPRETER_TRACE(thread, CloseIterator); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); + const GlobalEnvConstants *global_const = thread->GlobalConstants(); - JSHandle iterHandle(thread, iter); + JSHandle iter_handle(thread, iter); JSHandle record; if (thread->HasPendingException()) { JSHandle exception(thread, ObjectWrapper::Cast(thread->GetException().GetTaggedObject())->GetValue()); record = JSHandle(factory->NewCompletionRecord(CompletionRecord::THROW, exception)); } else { - JSHandle undefinedVal = globalConst->GetHandledUndefined(); - record = JSHandle(factory->NewCompletionRecord(CompletionRecord::NORMAL, undefinedVal)); + JSHandle undefined_val = global_const->GetHandledUndefined(); + record = JSHandle(factory->NewCompletionRecord(CompletionRecord::NORMAL, undefined_val)); } - JSHandle result = JSIterator::IteratorClose(thread, iterHandle, record); + JSHandle result = JSIterator::IteratorClose(thread, iter_handle, record); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return result.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::ImportModule([[maybe_unused]] JSThread *thread, - [[maybe_unused]] JSTaggedValue moduleName) + [[maybe_unused]] JSTaggedValue module_name) { INTERPRETER_TRACE(thread, ImportModule); [[maybe_unused]] EcmaHandleScope scope(thread); - JSHandle name(thread, moduleName); + JSHandle name(thread, module_name); JSHandle module = thread->GetEcmaVM()->GetModuleByName(name); return module.GetTaggedValue(); // return moduleRef } -void SlowRuntimeStub::StModuleVar([[maybe_unused]] JSThread *thread, [[maybe_unused]] JSTaggedValue exportName, - [[maybe_unused]] JSTaggedValue exportObj) +void SlowRuntimeStub::StModuleVar([[maybe_unused]] JSThread *thread, [[maybe_unused]] JSTaggedValue export_name, + [[maybe_unused]] JSTaggedValue export_obj) { INTERPRETER_TRACE(thread, StModuleVar); [[maybe_unused]] EcmaHandleScope scope(thread); - JSHandle name(thread, exportName); - JSHandle value(thread, exportObj); + JSHandle name(thread, export_name); + JSHandle value(thread, export_obj); thread->GetEcmaVM()->GetModuleManager()->AddModuleItem(thread, name, value); } -void SlowRuntimeStub::CopyModule(JSThread *thread, JSTaggedValue srcModule) +void SlowRuntimeStub::CopyModule(JSThread *thread, JSTaggedValue src_module) { INTERPRETER_TRACE(thread, CopyModule); [[maybe_unused]] EcmaHandleScope scope(thread); - JSHandle srcModuleObj(thread, srcModule); - thread->GetEcmaVM()->GetModuleManager()->CopyModule(thread, srcModuleObj); + JSHandle src_module_obj(thread, src_module); + thread->GetEcmaVM()->GetModuleManager()->CopyModule(thread, src_module_obj); } JSTaggedValue SlowRuntimeStub::LdModvarByName([[maybe_unused]] JSThread *thread, - [[maybe_unused]] JSTaggedValue moduleObj, - [[maybe_unused]] JSTaggedValue itemName) + [[maybe_unused]] JSTaggedValue module_obj, + [[maybe_unused]] JSTaggedValue item_name) { INTERPRETER_TRACE(thread, LdModvarByName); [[maybe_unused]] EcmaHandleScope scope(thread); - JSHandle module(thread, moduleObj); - JSHandle item(thread, itemName); - JSHandle moduleVar = thread->GetEcmaVM()->GetModuleManager()->GetModuleItem(thread, module, item); - return moduleVar.GetTaggedValue(); + JSHandle module(thread, module_obj); + JSHandle item(thread, item_name); + JSHandle module_var = thread->GetEcmaVM()->GetModuleManager()->GetModuleItem(thread, module, item); + return module_var.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::CreateRegExpWithLiteral(JSThread *thread, JSTaggedValue pattern, uint8_t flags) { INTERPRETER_TRACE(thread, CreateRegExpWithLiteral); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle patternHandle(thread, pattern); - JSHandle flagsHandle(thread, JSTaggedValue(flags)); + JSHandle pattern_handle(thread, pattern); + JSHandle flags_handle(thread, JSTaggedValue(flags)); - return builtins::BuiltinsRegExp::RegExpCreate(thread, patternHandle, flagsHandle); + return builtins::BuiltinsRegExp::RegExpCreate(thread, pattern_handle, flags_handle); } JSTaggedValue SlowRuntimeStub::CreateArrayWithBuffer(JSThread *thread, ObjectFactory *factory, JSArray *literal) { INTERPRETER_TRACE(thread, CreateArrayWithBuffer); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle array(thread, literal); - JSHandle arrLiteral = factory->CloneArrayLiteral(array); + JSHandle arr_literal = factory->CloneArrayLiteral(array); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - return arrLiteral.GetTaggedValue(); + return arr_literal.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::GetMethod(JSThread *thread, JSTaggedValue object, JSTaggedValue prop_key) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle obj(thread, object); JSHandle key(thread, prop_key); @@ -1115,18 +1116,18 @@ JSTaggedValue SlowRuntimeStub::GetMethod(JSThread *thread, JSTaggedValue object, JSTaggedValue SlowRuntimeStub::GetTemplateObject(JSThread *thread, JSTaggedValue literal) { INTERPRETER_TRACE(thread, GetTemplateObject); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle templateLiteral(thread, literal); - JSHandle templateObj = TemplateString::GetTemplateObject(thread, templateLiteral); + JSHandle template_literal(thread, literal); + JSHandle template_obj = TemplateString::GetTemplateObject(thread, template_literal); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - return templateObj.GetTaggedValue(); + return template_obj.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::GetNextPropName(JSThread *thread, JSTaggedValue iter) { INTERPRETER_TRACE(thread, GetNextPropName); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle iterator(thread, iter); ASSERT(iterator->IsForinIterator()); @@ -1139,45 +1140,45 @@ JSTaggedValue SlowRuntimeStub::GetNextPropName(JSThread *thread, JSTaggedValue i JSTaggedValue SlowRuntimeStub::CopyDataProperties(JSThread *thread, JSTaggedValue dst, JSTaggedValue src) { INTERPRETER_TRACE(thread, CopyDataProperties); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle dstHandle(thread, dst); - JSHandle srcHandle(thread, src); - if (!srcHandle->IsNull() && !srcHandle->IsUndefined()) { - JSHandle keys = JSTaggedValue::GetOwnPropertyKeys(thread, srcHandle); + JSHandle dst_handle(thread, dst); + JSHandle src_handle(thread, src); + if (!src_handle->IsNull() && !src_handle->IsUndefined()) { + JSHandle keys = JSTaggedValue::GetOwnPropertyKeys(thread, src_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSMutableHandle key(thread, JSTaggedValue::Undefined()); - uint32_t keysLen = keys->GetLength(); - for (uint32_t i = 0; i < keysLen; i++) { + uint32_t keys_len = keys->GetLength(); + for (uint32_t i = 0; i < keys_len; i++) { PropertyDescriptor desc(thread); key.Update(keys->Get(i)); - bool success = JSTaggedValue::GetOwnProperty(thread, srcHandle, key, desc); + bool success = JSTaggedValue::GetOwnProperty(thread, src_handle, key, desc); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); if (success && desc.IsEnumerable()) { - JSTaggedValue::DefineOwnProperty(thread, dstHandle, key, desc); + JSTaggedValue::DefineOwnProperty(thread, dst_handle, key, desc); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } } } - return dstHandle.GetTaggedValue(); + return dst_handle.GetTaggedValue(); } -JSTaggedValue SlowRuntimeStub::GetUnmappedArgs(JSThread *thread, uint32_t actualNumArgs, JSTaggedType *stkargs) +JSTaggedValue SlowRuntimeStub::GetUnmappedArgs(JSThread *thread, uint32_t actual_num_args, JSTaggedType *stkargs) { INTERPRETER_TRACE(thread, GetUnmapedArgs); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle argumentsList = factory->NewTaggedArray(actualNumArgs); - for (uint32_t i = 0; i < actualNumArgs; ++i) { - argumentsList->Set(thread, i, - JSTaggedValue(stkargs[i])); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + JSHandle global_env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle arguments_list = factory->NewTaggedArray(actual_num_args); + for (uint32_t i = 0; i < actual_num_args; ++i) { + arguments_list->Set(thread, i, + JSTaggedValue(stkargs[i])); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } // 1. Let len be the number of elements in argumentsList - int32_t len = argumentsList->GetLength(); + int32_t len = arguments_list->GetLength(); // 2. Let obj be ObjectCreate(%ObjectPrototype%, «[[ParameterMap]]»). // 3. Set obj’s [[ParameterMap]] internal slot to undefined. JSHandle obj = factory->NewJSArguments(); @@ -1189,91 +1190,92 @@ JSTaggedValue SlowRuntimeStub::GetUnmappedArgs(JSThread *thread, uint32_t actual // a. Let val be argumentsList[index]. // b. Perform CreateDataProperty(obj, ToString(index), val). // c. Let index be index + 1 - obj->SetElements(thread, argumentsList.GetTaggedValue()); + obj->SetElements(thread, arguments_list.GetTaggedValue()); // 7. Perform DefinePropertyOrThrow(obj, @@iterator, PropertyDescriptor // {[[Value]]:%ArrayProto_values%, // [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true}). obj->SetPropertyInlinedProps(thread, JSArguments::ITERATOR_INLINE_PROPERTY_INDEX, - globalEnv->GetArrayProtoValuesFunction().GetTaggedValue()); + global_env->GetArrayProtoValuesFunction().GetTaggedValue()); // 9. Perform DefinePropertyOrThrow(obj, "callee", PropertyDescriptor {[[Get]]: %ThrowTypeError%, // [[Set]]: %ThrowTypeError%, [[Enumerable]]: false, [[Configurable]]: false}). - JSHandle throwFunction = globalEnv->GetThrowTypeError(); + JSHandle throw_function = global_env->GetThrowTypeError(); JSHandle accessor = factory->NewAccessorData(); - accessor->SetGetter(thread, throwFunction); - accessor->SetSetter(thread, throwFunction); + accessor->SetGetter(thread, throw_function); + accessor->SetSetter(thread, throw_function); obj->SetPropertyInlinedProps(thread, JSArguments::CALLEE_INLINE_PROPERTY_INDEX, accessor.GetTaggedValue()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 11. Return obj return obj.GetTaggedValue(); } -JSTaggedValue SlowRuntimeStub::CopyRestArgs(JSThread *thread, uint32_t restNumArgs, JSTaggedType *stkargs) +JSTaggedValue SlowRuntimeStub::CopyRestArgs(JSThread *thread, uint32_t rest_num_args, JSTaggedType *stkargs) { INTERPRETER_TRACE(thread, Copyrestargs); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle restArray = JSArray::ArrayCreate(thread, JSTaggedNumber(restNumArgs)); + JSHandle rest_array = JSArray::ArrayCreate(thread, JSTaggedNumber(rest_num_args)); JSMutableHandle element(thread, JSTaggedValue::Undefined()); - for (uint32_t i = 0; i < restNumArgs; ++i) { + for (uint32_t i = 0; i < rest_num_args; ++i) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) element.Update(JSTaggedValue(stkargs[i])); - JSObject::SetProperty(thread, restArray, i, element, true); + JSObject::SetProperty(thread, rest_array, i, element, true); } RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - return restArray.GetTaggedValue(); + return rest_array.GetTaggedValue(); } // 7.4.1 GetIterator JSTaggedValue SlowRuntimeStub::GetIterator(JSThread *thread, JSTaggedValue obj, bool async, JSTaggedValue method) { INTERPRETER_TRACE(thread, GetIterator); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); EcmaVM *vm = thread->GetEcmaVM(); - auto globalConst = thread->GlobalConstants(); + auto global_const = thread->GlobalConstants(); JSHandle env = vm->GetGlobalEnv(); - JSHandle objHandle(thread, obj); - JSMutableHandle methodHandle(thread, globalConst->GetHandledUndefined()); + JSHandle obj_handle(thread, obj); + JSMutableHandle method_handle(thread, global_const->GetHandledUndefined()); // 3. If method is not present, then if (method.IsHole()) { // a. If hint is async, then if (async) { // i. Set method to ? GetMethod(obj, @@asyncIterator). - methodHandle.Update(JSObject::GetMethod(thread, objHandle, env->GetAsyncIteratorSymbol())); + method_handle.Update(JSObject::GetMethod(thread, obj_handle, env->GetAsyncIteratorSymbol())); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - if (methodHandle->IsUndefined()) { + if (method_handle->IsUndefined()) { // 1. Let syncMethod be ? GetMethod(obj, @@iterator). - JSHandle syncMethod = JSObject::GetMethod(thread, objHandle, env->GetIteratorSymbol()); + JSHandle sync_method = JSObject::GetMethod(thread, obj_handle, env->GetIteratorSymbol()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 2. Let syncIteratorRecord be ? GetIterator(obj, sync, syncMethod). - JSHandle syncIterator(thread, - SlowRuntimeStub::GetIterator(thread, objHandle.GetTaggedValue(), - false, syncMethod.GetTaggedValue())); + JSHandle sync_iterator( + thread, SlowRuntimeStub::GetIterator(thread, obj_handle.GetTaggedValue(), false, + sync_method.GetTaggedValue())); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 6. Let nextMethod be ? GetV(iterator, "next"). - JSHandle syncNextMethod = - JSTaggedValue::GetProperty(thread, syncIterator, globalConst->GetHandledNextString()).GetValue(); + JSHandle sync_next_method = + JSTaggedValue::GetProperty(thread, sync_iterator, global_const->GetHandledNextString()).GetValue(); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 3. Return ! CreateAsyncFromSyncIterator(syncIteratorRecord). - return JSAsyncFromSyncIteratorObject::CreateAsyncFromSyncIterator(thread, syncIterator, syncNextMethod); + return JSAsyncFromSyncIteratorObject::CreateAsyncFromSyncIterator(thread, sync_iterator, + sync_next_method); } } else { - methodHandle.Update(JSTaggedValue::GetProperty(thread, objHandle, env->GetIteratorSymbol()).GetValue()); + method_handle.Update(JSTaggedValue::GetProperty(thread, obj_handle, env->GetIteratorSymbol()).GetValue()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } } else { - methodHandle.Update(method); + method_handle.Update(method); } // 4. Let iterator be ? Call(method, obj). InternalCallParams *params = thread->GetInternalCallParams(); params->MakeEmptyArgv(); - JSTaggedValue iterator = JSFunction::Call(thread, methodHandle, objHandle, 0, params->GetArgv()); + JSTaggedValue iterator = JSFunction::Call(thread, method_handle, obj_handle, 0, params->GetArgv()); // 5. If Type(iterator) is not Object, throw a TypeError exception. if (!iterator.IsECMAObject()) { @@ -1287,71 +1289,71 @@ JSTaggedValue SlowRuntimeStub::DefineGetterSetterByValue(JSThread *thread, JSTag JSTaggedValue getter, JSTaggedValue setter, bool flag) { INTERPRETER_TRACE(thread, DefineGetterSetterByValue); - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle objHandle(thread, obj); - JSHandle propHandle(thread, prop); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle obj_handle(thread, obj); + JSHandle prop_handle(thread, prop); - JSHandle getterHandle(thread, getter); - JSHandle setterHandle(thread, setter); - JSHandle propKey = JSTaggedValue::ToPropertyKey(thread, propHandle); + JSHandle getter_handle(thread, getter); + JSHandle setter_handle(thread, setter); + JSHandle prop_key = JSTaggedValue::ToPropertyKey(thread, prop_handle); - auto globalConst = thread->GlobalConstants(); - if (objHandle.GetTaggedValue().IsClassConstructor() && - JSTaggedValue::SameValue(propKey, globalConst->GetHandledPrototypeString())) { + auto global_const = thread->GlobalConstants(); + if (obj_handle.GetTaggedValue().IsClassConstructor() && + JSTaggedValue::SameValue(prop_key, global_const->GetHandledPrototypeString())) { return ThrowTypeError( thread, "In a class, computed property names for static getter that are named 'prototype' throw a TypeError"); } if (flag) { - if (!getterHandle->IsUndefined()) { - if (propKey->IsNumber()) { - propKey = - JSHandle::Cast(base::NumberHelper::NumberToString(thread, propKey.GetTaggedValue())); + if (!getter_handle->IsUndefined()) { + if (prop_key->IsNumber()) { + prop_key = JSHandle::Cast( + base::NumberHelper::NumberToString(thread, prop_key.GetTaggedValue())); } - JSFunctionBase::SetFunctionName(thread, JSHandle::Cast(getterHandle), propKey, - JSHandle(thread, globalConst->GetGetString())); + JSFunctionBase::SetFunctionName(thread, JSHandle::Cast(getter_handle), prop_key, + JSHandle(thread, global_const->GetGetString())); } - if (!setterHandle->IsUndefined()) { - if (propKey->IsNumber()) { - propKey = - JSHandle::Cast(base::NumberHelper::NumberToString(thread, propKey.GetTaggedValue())); + if (!setter_handle->IsUndefined()) { + if (prop_key->IsNumber()) { + prop_key = JSHandle::Cast( + base::NumberHelper::NumberToString(thread, prop_key.GetTaggedValue())); } - JSFunctionBase::SetFunctionName(thread, JSHandle::Cast(setterHandle), propKey, - JSHandle(thread, globalConst->GetSetString())); + JSFunctionBase::SetFunctionName(thread, JSHandle::Cast(setter_handle), prop_key, + JSHandle(thread, global_const->GetSetString())); } } // set accessor bool enumerable = - !(objHandle.GetTaggedValue().IsClassPrototype() || objHandle.GetTaggedValue().IsClassConstructor()); + !(obj_handle.GetTaggedValue().IsClassPrototype() || obj_handle.GetTaggedValue().IsClassConstructor()); PropertyDescriptor desc(thread, true, enumerable, true); - if (!getterHandle->IsUndefined()) { - JSHandle::Cast(getterHandle)->SetFunctionKind(thread, FunctionKind::GETTER_FUNCTION); - desc.SetGetter(getterHandle); + if (!getter_handle->IsUndefined()) { + JSHandle::Cast(getter_handle)->SetFunctionKind(thread, FunctionKind::GETTER_FUNCTION); + desc.SetGetter(getter_handle); } - if (!setterHandle->IsUndefined()) { - JSHandle::Cast(setterHandle)->SetFunctionKind(thread, FunctionKind::SETTER_FUNCTION); - desc.SetSetter(setterHandle); + if (!setter_handle->IsUndefined()) { + JSHandle::Cast(setter_handle)->SetFunctionKind(thread, FunctionKind::SETTER_FUNCTION); + desc.SetSetter(setter_handle); } - JSObject::DefineOwnProperty(thread, objHandle, propKey, desc); + JSObject::DefineOwnProperty(thread, obj_handle, prop_key, desc); - return objHandle.GetTaggedValue(); + return obj_handle.GetTaggedValue(); } -JSTaggedValue SlowRuntimeStub::LdObjByIndex(JSThread *thread, JSTaggedValue obj, uint32_t idx, bool callGetter, +JSTaggedValue SlowRuntimeStub::LdObjByIndex(JSThread *thread, JSTaggedValue obj, uint32_t idx, bool call_getter, JSTaggedValue receiver) { INTERPRETER_TRACE(thread, LdObjByIndexDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSTaggedValue res; - JSHandle objHandle(thread, obj); - if (callGetter) { - res = JSObject::CallGetter(thread, AccessorData::Cast(receiver.GetTaggedObject()), objHandle); + JSHandle obj_handle(thread, obj); + if (call_getter) { + res = JSObject::CallGetter(thread, AccessorData::Cast(receiver.GetTaggedObject()), obj_handle); } else { - res = JSTaggedValue::GetProperty(thread, objHandle, idx).GetValue().GetTaggedValue(); + res = JSTaggedValue::GetProperty(thread, obj_handle, idx).GetValue().GetTaggedValue(); } RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return res; @@ -1360,7 +1362,7 @@ JSTaggedValue SlowRuntimeStub::LdObjByIndex(JSThread *thread, JSTaggedValue obj, JSTaggedValue SlowRuntimeStub::StObjByIndex(JSThread *thread, JSTaggedValue obj, uint32_t idx, JSTaggedValue value) { INTERPRETER_TRACE(thread, StObjByIndexDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSTaggedValue::SetProperty(thread, JSHandle(thread, obj), idx, JSHandle(thread, value), true); @@ -1368,19 +1370,19 @@ JSTaggedValue SlowRuntimeStub::StObjByIndex(JSThread *thread, JSTaggedValue obj, return JSTaggedValue::True(); } -JSTaggedValue SlowRuntimeStub::LdObjByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, bool callGetter, +JSTaggedValue SlowRuntimeStub::LdObjByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, bool call_getter, JSTaggedValue receiver) { INTERPRETER_TRACE(thread, LdObjByNameDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle objHandle(thread, obj); + JSHandle obj_handle(thread, obj); JSTaggedValue res; - if (callGetter) { - res = JSObject::CallGetter(thread, AccessorData::Cast(receiver.GetTaggedObject()), objHandle); + if (call_getter) { + res = JSObject::CallGetter(thread, AccessorData::Cast(receiver.GetTaggedObject()), obj_handle); } else { - JSHandle propHandle(thread, prop); - res = JSTaggedValue::GetProperty(thread, objHandle, propHandle).GetValue().GetTaggedValue(); + JSHandle prop_handle(thread, prop); + res = JSTaggedValue::GetProperty(thread, obj_handle, prop_handle).GetValue().GetTaggedValue(); } RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return res; @@ -1389,30 +1391,30 @@ JSTaggedValue SlowRuntimeStub::LdObjByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue SlowRuntimeStub::StObjByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, JSTaggedValue value) { INTERPRETER_TRACE(thread, StObjByNameDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle objHandle(thread, obj); - JSHandle propHandle(thread, prop); - JSHandle valueHandle(thread, value); - JSTaggedValue::SetProperty(thread, objHandle, propHandle, valueHandle, true); + JSHandle obj_handle(thread, obj); + JSHandle prop_handle(thread, prop); + JSHandle value_handle(thread, value); + JSTaggedValue::SetProperty(thread, obj_handle, prop_handle, value_handle, true); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue::True(); } -JSTaggedValue SlowRuntimeStub::LdObjByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, bool callGetter, +JSTaggedValue SlowRuntimeStub::LdObjByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, bool call_getter, JSTaggedValue receiver) { INTERPRETER_TRACE(thread, LdObjByValueDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle objHandle(thread, obj); + JSHandle obj_handle(thread, obj); JSTaggedValue res; - if (callGetter) { - res = JSObject::CallGetter(thread, AccessorData::Cast(receiver.GetTaggedObject()), objHandle); + if (call_getter) { + res = JSObject::CallGetter(thread, AccessorData::Cast(receiver.GetTaggedObject()), obj_handle); } else { - JSHandle propKey = JSTaggedValue::ToPropertyKey(thread, JSHandle(thread, prop)); + JSHandle prop_key = JSTaggedValue::ToPropertyKey(thread, JSHandle(thread, prop)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - res = JSTaggedValue::GetProperty(thread, objHandle, propKey).GetValue().GetTaggedValue(); + res = JSTaggedValue::GetProperty(thread, obj_handle, prop_key).GetValue().GetTaggedValue(); } RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return res; @@ -1422,15 +1424,15 @@ JSTaggedValue SlowRuntimeStub::StObjByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue value) { INTERPRETER_TRACE(thread, StObjByValueDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle objHandle(thread, obj); - JSHandle propHandle(thread, prop); - JSHandle valueHandle(thread, value); - JSHandle propKey(JSTaggedValue::ToPropertyKey(thread, propHandle)); + JSHandle obj_handle(thread, obj); + JSHandle prop_handle(thread, prop); + JSHandle value_handle(thread, value); + JSHandle prop_key(JSTaggedValue::ToPropertyKey(thread, prop_handle)); // strict mode is true - JSTaggedValue::SetProperty(thread, objHandle, propKey, valueHandle, true); + JSTaggedValue::SetProperty(thread, obj_handle, prop_key, value_handle, true); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue::True(); } @@ -1438,13 +1440,13 @@ JSTaggedValue SlowRuntimeStub::StObjByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue SlowRuntimeStub::TryLdGlobalByName(JSThread *thread, JSTaggedValue global, JSTaggedValue prop) { INTERPRETER_TRACE(thread, Trygetobjprop); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle obj(thread, global.GetTaggedObject()->GetClass()->GetPrototype()); - JSHandle propHandle(thread, prop); - OperationResult res = JSTaggedValue::GetProperty(thread, obj, propHandle); + JSHandle prop_handle(thread, prop); + OperationResult res = JSTaggedValue::GetProperty(thread, obj, prop_handle); if (!res.GetPropertyMetaData().IsFound()) { - return ThrowReferenceError(thread, propHandle.GetTaggedValue(), " is not defined"); + return ThrowReferenceError(thread, prop_handle.GetTaggedValue(), " is not defined"); } return res.GetValue().GetTaggedValue(); } @@ -1452,11 +1454,11 @@ JSTaggedValue SlowRuntimeStub::TryLdGlobalByName(JSThread *thread, JSTaggedValue JSTaggedValue SlowRuntimeStub::LdGlobalVar(JSThread *thread, JSTaggedValue global, JSTaggedValue prop) { INTERPRETER_TRACE(thread, LdGlobalVar); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle objHandle(thread, global.GetTaggedObject()->GetClass()->GetPrototype()); - JSHandle propHandle(thread, prop); - OperationResult res = JSTaggedValue::GetProperty(thread, objHandle, propHandle); + JSHandle obj_handle(thread, global.GetTaggedObject()->GetClass()->GetPrototype()); + JSHandle prop_handle(thread, prop); + OperationResult res = JSTaggedValue::GetProperty(thread, obj_handle, prop_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return res.GetValue().GetTaggedValue(); } @@ -1464,13 +1466,13 @@ JSTaggedValue SlowRuntimeStub::LdGlobalVar(JSThread *thread, JSTaggedValue globa JSTaggedValue SlowRuntimeStub::StGlobalVar(JSThread *thread, JSTaggedValue prop, JSTaggedValue value) { INTERPRETER_TRACE(thread, StGlobalVar); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle global(thread, thread->GetEcmaVM()->GetGlobalEnv()->GetGlobalObject()); - JSHandle propHandle(thread, prop); - JSHandle valueHandle(thread, value); + JSHandle prop_handle(thread, prop); + JSHandle value_handle(thread, value); - JSObject::GlobalSetProperty(thread, propHandle, valueHandle, true); + JSObject::GlobalSetProperty(thread, prop_handle, value_handle, true); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue::True(); } @@ -1478,7 +1480,7 @@ JSTaggedValue SlowRuntimeStub::StGlobalVar(JSThread *thread, JSTaggedValue prop, JSTaggedValue SlowRuntimeStub::TryUpdateGlobalRecord(JSThread *thread, JSTaggedValue prop, JSTaggedValue value) { INTERPRETER_TRACE(thread, TryUpdateGlobalRecord); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); EcmaVM *vm = thread->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); @@ -1500,7 +1502,7 @@ JSTaggedValue SlowRuntimeStub::TryUpdateGlobalRecord(JSThread *thread, JSTaggedV JSTaggedValue SlowRuntimeStub::LdGlobalRecord(JSThread *thread, JSTaggedValue key, bool *found) { INTERPRETER_TRACE(thread, LdGlobalRecord); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); EcmaVM *vm = thread->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); @@ -1513,10 +1515,10 @@ JSTaggedValue SlowRuntimeStub::LdGlobalRecord(JSThread *thread, JSTaggedValue ke return JSTaggedValue::Undefined(); } -JSTaggedValue SlowRuntimeStub::StGlobalRecord(JSThread *thread, JSTaggedValue prop, JSTaggedValue value, bool isConst) +JSTaggedValue SlowRuntimeStub::StGlobalRecord(JSThread *thread, JSTaggedValue prop, JSTaggedValue value, bool is_const) { INTERPRETER_TRACE(thread, StGlobalRecord); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); EcmaVM *vm = thread->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); @@ -1529,19 +1531,19 @@ JSTaggedValue SlowRuntimeStub::StGlobalRecord(JSThread *thread, JSTaggedValue pr } PropertyAttributes attributes; - if (isConst) { + if (is_const) { attributes.SetIsConstProps(true); } - JSHandle propHandle(thread, prop); - JSHandle valueHandle(thread, value); - JSHandle dictHandle(thread, dict); + JSHandle prop_handle(thread, prop); + JSHandle value_handle(thread, value); + JSHandle dict_handle(thread, dict); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle box = factory->NewPropertyBox(valueHandle); - PropertyBoxType boxType = valueHandle->IsUndefined() ? PropertyBoxType::UNDEFINED : PropertyBoxType::CONSTANT; - attributes.SetBoxType(boxType); + JSHandle box = factory->NewPropertyBox(value_handle); + PropertyBoxType box_type = value_handle->IsUndefined() ? PropertyBoxType::UNDEFINED : PropertyBoxType::CONSTANT; + attributes.SetBoxType(box_type); - dict = *GlobalDictionary::PutIfAbsent(thread, dictHandle, propHandle, JSHandle(box), attributes); + dict = *GlobalDictionary::PutIfAbsent(thread, dict_handle, prop_handle, JSHandle(box), attributes); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); env->SetGlobalRecord(thread, JSTaggedValue(dict)); return JSTaggedValue::True(); @@ -1550,12 +1552,12 @@ JSTaggedValue SlowRuntimeStub::StGlobalRecord(JSThread *thread, JSTaggedValue pr JSTaggedValue SlowRuntimeStub::ThrowReferenceError(JSThread *thread, JSTaggedValue prop, const char *desc) { INTERPRETER_TRACE(thread, ThrowReferenceError); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle propName = JSTaggedValue::ToString(thread, JSHandle(thread, prop)); + JSHandle prop_name = JSTaggedValue::ToString(thread, JSHandle(thread, prop)); ASSERT_NO_ABRUPT_COMPLETION(thread); JSHandle info = factory->NewFromString(desc); - JSHandle msg = factory->ConcatFromString(propName, info); + JSHandle msg = factory->ConcatFromString(prop_name, info); THROW_NEW_ERROR_AND_RETURN_VALUE(thread, factory->NewJSError(base::ErrorType::REFERENCE_ERROR, msg).GetTaggedValue(), JSTaggedValue::Exception()); @@ -1564,7 +1566,7 @@ JSTaggedValue SlowRuntimeStub::ThrowReferenceError(JSThread *thread, JSTaggedVal JSTaggedValue SlowRuntimeStub::ThrowTypeError(JSThread *thread, const char *message) { INTERPRETER_TRACE(thread, ThrowTypeError); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ASSERT_NO_ABRUPT_COMPLETION(thread); THROW_TYPE_ERROR_AND_RETURN(thread, message, JSTaggedValue::Exception()); } @@ -1572,7 +1574,7 @@ JSTaggedValue SlowRuntimeStub::ThrowTypeError(JSThread *thread, const char *mess JSTaggedValue SlowRuntimeStub::ThrowSyntaxError(JSThread *thread, const char *message) { INTERPRETER_TRACE(thread, ThrowSyntaxError); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ASSERT_NO_ABRUPT_COMPLETION(thread); THROW_SYNTAX_ERROR_AND_RETURN(thread, message, JSTaggedValue::Exception()); } @@ -1581,261 +1583,263 @@ JSTaggedValue SlowRuntimeStub::StArraySpread(JSThread *thread, JSTaggedValue dst JSTaggedValue src) { INTERPRETER_TRACE(thread, StArraySpread); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle dstHandle(thread, dst); - JSHandle srcHandle(thread, src); + JSHandle dst_handle(thread, dst); + JSHandle src_handle(thread, src); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - if (srcHandle->IsUndefined()) { + if (src_handle->IsUndefined()) { THROW_TYPE_ERROR_AND_RETURN(thread, "undefined is not iterable", JSTaggedValue::Exception()); } - if (srcHandle->IsNull()) { + if (src_handle->IsNull()) { THROW_TYPE_ERROR_AND_RETURN(thread, "null is not iterable", JSTaggedValue::Exception()); } - ASSERT(dstHandle->IsJSArray()); - if (srcHandle->IsString()) { - JSHandle srcString = JSTaggedValue::ToString(thread, srcHandle); + ASSERT(dst_handle->IsJSArray()); + if (src_handle->IsString()) { + JSHandle src_string = JSTaggedValue::ToString(thread, src_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - uint32_t dstLen = index.GetInt(); - uint32_t strLen = srcString->GetLength(); - for (uint32_t i = 0; i < strLen; i++) { - uint16_t res = srcString->At(i); - JSHandle strValue(factory->NewFromUtf16Literal(&res, 1)); - JSTaggedValue::SetProperty(thread, dstHandle, dstLen + i, strValue, true); + uint32_t dst_len = index.GetInt(); + uint32_t str_len = src_string->GetLength(); + for (uint32_t i = 0; i < str_len; i++) { + uint16_t res = src_string->At(i); + JSHandle str_value(factory->NewFromUtf16Literal(&res, 1)); + JSTaggedValue::SetProperty(thread, dst_handle, dst_len + i, str_value, true); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } - return JSTaggedValue(dstLen + strLen); + return JSTaggedValue(dst_len + str_len); } JSHandle iter; - auto globalConst = thread->GlobalConstants(); - if (srcHandle->IsJSArrayIterator() || srcHandle->IsJSMapIterator() || srcHandle->IsJSSetIterator() || - srcHandle->IsIterator()) { - iter = srcHandle; - } else if (srcHandle->IsJSArray() || srcHandle->IsJSMap() || srcHandle->IsTypedArray() || srcHandle->IsJSSet()) { - JSHandle valuesStr = globalConst->GetHandledValuesString(); - JSHandle valuesMethod = JSObject::GetMethod(thread, srcHandle, valuesStr); - iter = JSIterator::GetIterator(thread, srcHandle, valuesMethod); + auto global_const = thread->GlobalConstants(); + if (src_handle->IsJSArrayIterator() || src_handle->IsJSMapIterator() || src_handle->IsJSSetIterator() || + src_handle->IsIterator()) { + iter = src_handle; + } else if (src_handle->IsJSArray() || src_handle->IsJSMap() || src_handle->IsTypedArray() || + src_handle->IsJSSet()) { + JSHandle values_str = global_const->GetHandledValuesString(); + JSHandle values_method = JSObject::GetMethod(thread, src_handle, values_str); + iter = JSIterator::GetIterator(thread, src_handle, values_method); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } else { - iter = JSIterator::GetIterator(thread, srcHandle); + iter = JSIterator::GetIterator(thread, src_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } - JSMutableHandle indexHandle(thread, index); - JSHandle valueStr = globalConst->GetHandledValueString(); + JSMutableHandle index_handle(thread, index); + JSHandle value_str = global_const->GetHandledValueString(); PropertyDescriptor desc(thread); - JSHandle iterResult; + JSHandle iter_result; do { - iterResult = JSIterator::IteratorStep(thread, iter); + iter_result = JSIterator::IteratorStep(thread, iter); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - if (iterResult->IsFalse()) { + if (iter_result->IsFalse()) { break; } - bool success = JSTaggedValue::GetOwnProperty(thread, iterResult, valueStr, desc); + bool success = JSTaggedValue::GetOwnProperty(thread, iter_result, value_str, desc); if (success && desc.IsEnumerable()) { - JSTaggedValue::DefineOwnProperty(thread, dstHandle, indexHandle, desc); - int tmp = indexHandle->GetInt(); - indexHandle.Update(JSTaggedValue(tmp + 1)); + JSTaggedValue::DefineOwnProperty(thread, dst_handle, index_handle, desc); + int tmp = index_handle->GetInt(); + index_handle.Update(JSTaggedValue(tmp + 1)); } } while (true); - return indexHandle.GetTaggedValue(); + return index_handle.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::DefineGeneratorFunc(JSThread *thread, JSMethod *method) { INTERPRETER_TRACE(thread, DefineGeneratorFunc); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle jsFunc = factory->NewJSGeneratorFunction(method); + JSHandle js_func = factory->NewJSGeneratorFunction(method); ASSERT_NO_ABRUPT_COMPLETION(thread); // 26.3.4.3 prototype // Whenever a GeneratorFunction instance is created another ordinary object is also created and // is the initial value of the generator function's "prototype" property. - JSHandle objFun = env->GetObjectFunction(); - JSHandle initialGeneratorFuncPrototype = - factory->NewJSObjectByConstructor(JSHandle(objFun), objFun); - JSObject::SetPrototype(thread, initialGeneratorFuncPrototype, env->GetGeneratorPrototype()); + JSHandle obj_fun = env->GetObjectFunction(); + JSHandle initial_generator_func_prototype = + factory->NewJSObjectByConstructor(JSHandle(obj_fun), obj_fun); + JSObject::SetPrototype(thread, initial_generator_func_prototype, env->GetGeneratorPrototype()); ASSERT_NO_ABRUPT_COMPLETION(thread); - jsFunc->SetProtoOrDynClass(thread, initialGeneratorFuncPrototype); - jsFunc->SetupFunctionLength(thread); + js_func->SetProtoOrDynClass(thread, initial_generator_func_prototype); + js_func->SetupFunctionLength(thread); - return jsFunc.GetTaggedValue(); + return js_func.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::DefineAsyncGeneratorFunc(JSThread *thread, JSMethod *method) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle jsFunc = factory->NewJSAsyncGeneratorFunction(method); + JSHandle js_func = factory->NewJSAsyncGeneratorFunction(method); ASSERT_NO_ABRUPT_COMPLETION(thread); // 27.4.4.3 prototype // Whenever a AsyncGeneratorFunction instance is created another ordinary object is also created and // is the initial value of the generator function's "prototype" property. - JSHandle objFun = env->GetObjectFunction(); - JSHandle initialAsyncGeneratorFuncPrototype = - factory->NewJSObjectByConstructor(JSHandle(objFun), objFun); - JSObject::SetPrototype(thread, initialAsyncGeneratorFuncPrototype, env->GetAsyncGeneratorPrototype()); + JSHandle obj_fun = env->GetObjectFunction(); + JSHandle initial_async_generator_func_prototype = + factory->NewJSObjectByConstructor(JSHandle(obj_fun), obj_fun); + JSObject::SetPrototype(thread, initial_async_generator_func_prototype, env->GetAsyncGeneratorPrototype()); ASSERT_NO_ABRUPT_COMPLETION(thread); - jsFunc->SetProtoOrDynClass(thread, initialAsyncGeneratorFuncPrototype); - jsFunc->SetupFunctionLength(thread); + js_func->SetProtoOrDynClass(thread, initial_async_generator_func_prototype); + js_func->SetupFunctionLength(thread); - return jsFunc.GetTaggedValue(); + return js_func.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::DefineAsyncFunc(JSThread *thread, JSMethod *method) { INTERPRETER_TRACE(thread, DefineAsyncFunc); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle dynclass = JSHandle::Cast(env->GetAsyncFunctionClass()); - JSHandle jsFunc = factory->NewJSFunctionByDynClass(method, dynclass, FunctionKind::ASYNC_FUNCTION); + JSHandle js_func = factory->NewJSFunctionByDynClass(method, dynclass, FunctionKind::ASYNC_FUNCTION); ASSERT_NO_ABRUPT_COMPLETION(thread); - return jsFunc.GetTaggedValue(); + return js_func.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::DefineNCFuncDyn(JSThread *thread, JSMethod *method) { INTERPRETER_TRACE(thread, DefineNCFuncDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle dynclass = JSHandle::Cast(env->GetFunctionClassWithoutProto()); - JSHandle jsFunc = factory->NewJSFunctionByDynClass(method, dynclass, FunctionKind::ARROW_FUNCTION); - jsFunc->SetupFunctionLength(thread); + JSHandle js_func = factory->NewJSFunctionByDynClass(method, dynclass, FunctionKind::ARROW_FUNCTION); + js_func->SetupFunctionLength(thread); ASSERT_NO_ABRUPT_COMPLETION(thread); - return jsFunc.GetTaggedValue(); + return js_func.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::DefinefuncDyn(JSThread *thread, JSMethod *method) { INTERPRETER_TRACE(thread, DefinefuncDyn); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle dynclass = JSHandle::Cast(env->GetFunctionClassWithProto()); - JSHandle jsFunc = factory->NewJSFunctionByDynClass(method, dynclass, FunctionKind::BASE_CONSTRUCTOR); - jsFunc->SetupFunctionLength(thread); + JSHandle js_func = factory->NewJSFunctionByDynClass(method, dynclass, FunctionKind::BASE_CONSTRUCTOR); + js_func->SetupFunctionLength(thread); ASSERT_NO_ABRUPT_COMPLETION(thread); - return jsFunc.GetTaggedValue(); + return js_func.GetTaggedValue(); } -JSTaggedValue SlowRuntimeStub::SuperCall(JSThread *thread, JSTaggedValue func, JSTaggedValue newTarget, - uint16_t argsCount, JSTaggedType *stkargs) +JSTaggedValue SlowRuntimeStub::SuperCall(JSThread *thread, JSTaggedValue func, JSTaggedValue new_target, + uint16_t args_count, JSTaggedType *stkargs) { INTERPRETER_TRACE(thread, SuperCall); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle funcHandle(thread, func); - JSHandle newTargetHandle(thread, newTarget); + JSHandle func_handle(thread, func); + JSHandle new_target_handle(thread, new_target); - JSHandle superFunc(thread, JSHandle::Cast(funcHandle)->GetPrototype(thread)); - ASSERT(superFunc->IsJSFunction()); - JSTaggedValue result = JSFunction::Construct(thread, superFunc, argsCount, stkargs, newTargetHandle); + JSHandle super_func(thread, JSHandle::Cast(func_handle)->GetPrototype(thread)); + ASSERT(super_func->IsJSFunction()); + JSTaggedValue result = JSFunction::Construct(thread, super_func, args_count, stkargs, new_target_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return result; } -JSTaggedValue SlowRuntimeStub::SuperCallSpread(JSThread *thread, JSTaggedValue func, JSTaggedValue newTarget, +JSTaggedValue SlowRuntimeStub::SuperCallSpread(JSThread *thread, JSTaggedValue func, JSTaggedValue new_target, JSTaggedValue array) { INTERPRETER_TRACE(thread, SuperCallSpread); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle funcHandle(thread, func); - JSHandle newTargetHandle(thread, newTarget); - JSHandle jsArray(thread, array); + JSHandle func_handle(thread, func); + JSHandle new_target_handle(thread, new_target); + JSHandle js_array(thread, array); - JSHandle superFunc(thread, JSHandle::Cast(funcHandle)->GetPrototype(thread)); - ASSERT(superFunc->IsJSFunction()); + JSHandle super_func(thread, JSHandle::Cast(func_handle)->GetPrototype(thread)); + ASSERT(super_func->IsJSFunction()); - JSHandle argv(thread, GetCallSpreadArgs(thread, jsArray.GetTaggedValue())); + JSHandle argv(thread, GetCallSpreadArgs(thread, js_array.GetTaggedValue())); InternalCallParams *arguments = thread->GetInternalCallParams(); arguments->MakeArgList(*argv); JSTaggedValue result = - JSFunction::Construct(thread, superFunc, argv->GetLength(), arguments->GetArgv(), newTargetHandle); + JSFunction::Construct(thread, super_func, argv->GetLength(), arguments->GetArgv(), new_target_handle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return result; } JSTaggedValue SlowRuntimeStub::DefineMethod(JSThread *thread, JSMethod *method, - const JSHandle &homeObject) + const JSHandle &home_object) { INTERPRETER_TRACE(thread, DefineMethod); - [[maybe_unused]] EcmaHandleScope handleScope(thread); - ASSERT(homeObject->IsECMAObject()); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + ASSERT(home_object->IsECMAObject()); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle dynclass = JSHandle::Cast(env->GetFunctionClassWithoutProto()); - JSHandle jsFunc = factory->NewJSFunctionByDynClass(method, dynclass, FunctionKind::NORMAL_FUNCTION); - jsFunc->SetHomeObject(thread, homeObject); - jsFunc->SetupFunctionLength(thread); + JSHandle js_func = factory->NewJSFunctionByDynClass(method, dynclass, FunctionKind::NORMAL_FUNCTION); + js_func->SetHomeObject(thread, home_object); + js_func->SetupFunctionLength(thread); ASSERT_NO_ABRUPT_COMPLETION(thread); - return jsFunc.GetTaggedValue(); + return js_func.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::LdSuperByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue key, - JSTaggedValue thisFunc) + JSTaggedValue this_func) { INTERPRETER_TRACE(thread, LdSuperByValue); - [[maybe_unused]] EcmaHandleScope handleScope(thread); - ASSERT(thisFunc.IsJSFunction()); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + ASSERT(this_func.IsJSFunction()); // get Homeobject form function - JSHandle homeObject(thread, JSFunction::Cast(thisFunc.GetTaggedObject())->GetHomeObject()); + JSHandle home_object(thread, JSFunction::Cast(this_func.GetTaggedObject())->GetHomeObject()); if (obj.IsUndefined()) { return ThrowReferenceError(thread, obj, "this is uninitialized."); } - JSHandle objHandle(thread, obj); - JSHandle propHandle(thread, key); + JSHandle obj_handle(thread, obj); + JSHandle prop_handle(thread, key); - JSHandle propKey(JSTaggedValue::ToPropertyKey(thread, propHandle)); - JSHandle superBase(thread, JSTaggedValue::GetSuperBase(thread, homeObject)); - JSTaggedValue::RequireObjectCoercible(thread, superBase); + JSHandle prop_key(JSTaggedValue::ToPropertyKey(thread, prop_handle)); + JSHandle super_base(thread, JSTaggedValue::GetSuperBase(thread, home_object)); + JSTaggedValue::RequireObjectCoercible(thread, super_base); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - JSTaggedValue res = JSTaggedValue::GetProperty(thread, superBase, propKey, objHandle).GetValue().GetTaggedValue(); + JSTaggedValue res = + JSTaggedValue::GetProperty(thread, super_base, prop_key, obj_handle).GetValue().GetTaggedValue(); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return res; } JSTaggedValue SlowRuntimeStub::StSuperByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue key, - JSTaggedValue value, JSTaggedValue thisFunc) + JSTaggedValue value, JSTaggedValue this_func) { INTERPRETER_TRACE(thread, StSuperByValue); - [[maybe_unused]] EcmaHandleScope handleScope(thread); - ASSERT(thisFunc.IsJSFunction()); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + ASSERT(this_func.IsJSFunction()); // get Homeobject form function - JSHandle homeObject(thread, JSFunction::Cast(thisFunc.GetTaggedObject())->GetHomeObject()); + JSHandle home_object(thread, JSFunction::Cast(this_func.GetTaggedObject())->GetHomeObject()); if (obj.IsUndefined()) { return ThrowReferenceError(thread, obj, "this is uninitialized."); } - JSHandle objHandle(thread, obj); - JSHandle propHandle(thread, key); - JSHandle valueHandle(thread, value); + JSHandle obj_handle(thread, obj); + JSHandle prop_handle(thread, key); + JSHandle value_handle(thread, value); - JSHandle propKey(JSTaggedValue::ToPropertyKey(thread, propHandle)); - JSHandle superBase(thread, JSTaggedValue::GetSuperBase(thread, homeObject)); - JSTaggedValue::RequireObjectCoercible(thread, superBase); + JSHandle prop_key(JSTaggedValue::ToPropertyKey(thread, prop_handle)); + JSHandle super_base(thread, JSTaggedValue::GetSuperBase(thread, home_object)); + JSTaggedValue::RequireObjectCoercible(thread, super_base); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // check may_throw is false? - JSTaggedValue::SetProperty(thread, superBase, propKey, valueHandle, objHandle, true); + JSTaggedValue::SetProperty(thread, super_base, prop_key, value_handle, obj_handle, true); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return JSTaggedValue::True(); } @@ -1843,41 +1847,41 @@ JSTaggedValue SlowRuntimeStub::StSuperByValue(JSThread *thread, JSTaggedValue ob JSTaggedValue SlowRuntimeStub::GetCallSpreadArgs(JSThread *thread, JSTaggedValue array) { INTERPRETER_TRACE(thread, GetCallSpreadArgs); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle jsArray(thread, array); - uint32_t argvMayMaxLength = JSHandle::Cast(jsArray)->GetArrayLength(); - JSHandle argv = factory->NewTaggedArray(argvMayMaxLength); - JSHandle itor = JSIterator::GetIterator(thread, jsArray); + JSHandle js_array(thread, array); + uint32_t argv_may_max_length = JSHandle::Cast(js_array)->GetArrayLength(); + JSHandle argv = factory->NewTaggedArray(argv_may_max_length); + JSHandle itor = JSIterator::GetIterator(thread, js_array); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSMutableHandle next(thread, JSTaggedValue::Undefined()); - JSMutableHandle nextArg(thread, JSTaggedValue::Undefined()); - size_t argvIndex = 0; + JSMutableHandle next_arg(thread, JSTaggedValue::Undefined()); + size_t argv_index = 0; while (true) { next.Update(JSIterator::IteratorStep(thread, itor).GetTaggedValue()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); if (JSTaggedValue::SameValue(next.GetTaggedValue(), JSTaggedValue::False())) { break; } - nextArg.Update(JSIterator::IteratorValue(thread, next).GetTaggedValue()); + next_arg.Update(JSIterator::IteratorValue(thread, next).GetTaggedValue()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - argv->Set(thread, argvIndex++, nextArg); + argv->Set(thread, argv_index++, next_arg); } - argv = factory->CopyArray(argv, argvMayMaxLength, argvIndex); + argv = factory->CopyArray(argv, argv_may_max_length, argv_index); return argv.GetTaggedValue(); } void SlowRuntimeStub::ThrowDeleteSuperProperty(JSThread *thread) { INTERPRETER_TRACE(thread, ThrowDeleteSuperProperty); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle info = factory->NewFromCanBeCompressString("Can not delete super property"); - JSHandle errorObj = factory->NewJSError(base::ErrorType::REFERENCE_ERROR, info); - THROW_NEW_ERROR_AND_RETURN(thread, errorObj.GetTaggedValue()); + JSHandle error_obj = factory->NewJSError(base::ErrorType::REFERENCE_ERROR, info); + THROW_NEW_ERROR_AND_RETURN(thread, error_obj.GetTaggedValue()); } JSTaggedValue SlowRuntimeStub::NotifyInlineCache(JSThread *thread, JSFunction *func, JSMethod *method) @@ -1891,20 +1895,20 @@ JSTaggedValue SlowRuntimeStub::NotifyInlineCache(JSThread *thread, JSFunction *f if (method->GetICMapping() == nullptr) { return JSTaggedValue::Undefined(); } - uint32_t icSlotSize = method->GetSlotSize(); + uint32_t ic_slot_size = method->GetSlotSize(); static_assert(std::is_pointer::value); using ICMappingElementType = std::remove_pointer::type; - if (icSlotSize > std::numeric_limits::max()) { + if (ic_slot_size > std::numeric_limits::max()) { return JSTaggedValue::Undefined(); } ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); - JSHandle funcHandle(thread, func); - JSHandle profileTypeInfo = factory->NewProfileTypeInfo(icSlotSize); - funcHandle->SetProfileTypeInfo(thread, profileTypeInfo.GetTaggedValue()); + JSHandle func_handle(thread, func); + JSHandle profile_type_info = factory->NewProfileTypeInfo(ic_slot_size); + func_handle->SetProfileTypeInfo(thread, profile_type_info.GetTaggedValue()); - return profileTypeInfo.GetTaggedValue(); + return profile_type_info.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::ResolveClass(JSThread *thread, JSTaggedValue ctor, TaggedArray *literal, @@ -1912,21 +1916,21 @@ JSTaggedValue SlowRuntimeStub::ResolveClass(JSThread *thread, JSTaggedValue ctor { ASSERT(ctor.IsClassConstructor()); JSHandle cls(thread, ctor); - JSHandle literalBuffer(thread, literal); - JSHandle lexicalEnv(thread, lexenv); - JSHandle constpoolHandle(thread, constpool); + JSHandle literal_buffer(thread, literal); + JSHandle lexical_env(thread, lexenv); + JSHandle constpool_handle(thread, constpool); SetClassInheritanceRelationship(thread, ctor, base); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - uint32_t literalBufferLength = literalBuffer->GetLength(); + uint32_t literal_buffer_length = literal_buffer->GetLength(); // only traverse the value of key-value pair - for (uint32_t index = 1; index < literalBufferLength - 1; index += 2) { // 2: key-value pair - JSTaggedValue value = literalBuffer->Get(index); + for (uint32_t index = 1; index < literal_buffer_length - 1; index += 2) { // 2: key-value pair + JSTaggedValue value = literal_buffer->Get(index); if (LIKELY(value.IsJSFunction())) { - JSFunction::Cast(value.GetTaggedObject())->SetLexicalEnv(thread, lexicalEnv.GetTaggedValue()); - JSFunction::Cast(value.GetTaggedObject())->SetConstantPool(thread, constpoolHandle.GetTaggedValue()); + JSFunction::Cast(value.GetTaggedObject())->SetLexicalEnv(thread, lexical_env.GetTaggedValue()); + JSFunction::Cast(value.GetTaggedObject())->SetConstantPool(thread, constpool_handle.GetTaggedValue()); } } @@ -1938,54 +1942,54 @@ JSTaggedValue SlowRuntimeStub::ResolveClass(JSThread *thread, JSTaggedValue ctor JSTaggedValue SlowRuntimeStub::CloneClassFromTemplate(JSThread *thread, JSTaggedValue ctor, JSTaggedValue base, JSTaggedValue lexenv, ConstantPool *constpool) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); + const GlobalEnvConstants *global_const = thread->GlobalConstants(); ASSERT(ctor.IsClassConstructor()); - JSHandle lexenvHandle(thread, lexenv); - JSHandle constpoolHandle(thread, JSTaggedValue(constpool)); - JSHandle baseHandle(thread, base); + JSHandle lexenv_handle(thread, lexenv); + JSHandle constpool_handle(thread, JSTaggedValue(constpool)); + JSHandle base_handle(thread, base); JSHandle cls(thread, ctor); - JSHandle clsPrototype(thread, cls->GetFunctionPrototype()); + JSHandle cls_prototype(thread, cls->GetFunctionPrototype()); - bool canShareHClass = false; - if (cls->GetClass()->GetProto() == baseHandle.GetTaggedValue()) { - canShareHClass = true; + bool can_share_h_class = false; + if (cls->GetClass()->GetProto() == base_handle.GetTaggedValue()) { + can_share_h_class = true; } - JSHandle cloneClass = factory->CloneClassCtor(cls, lexenvHandle, canShareHClass); + JSHandle clone_class = factory->CloneClassCtor(cls, lexenv_handle, can_share_h_class); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - JSHandle cloneClassPrototype = - factory->CloneObjectLiteral(JSHandle(clsPrototype), lexenvHandle, constpoolHandle, canShareHClass); + JSHandle clone_class_prototype = factory->CloneObjectLiteral( + JSHandle(cls_prototype), lexenv_handle, constpool_handle, can_share_h_class); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // After clone both, reset "constructor" and "prototype" properties. - cloneClass->SetFunctionPrototype(thread, cloneClassPrototype.GetTaggedValue()); + clone_class->SetFunctionPrototype(thread, clone_class_prototype.GetTaggedValue()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - PropertyDescriptor ctorDesc(thread, JSHandle(cloneClass), true, false, true); - JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(cloneClassPrototype), - globalConst->GetHandledConstructorString(), ctorDesc); + PropertyDescriptor ctor_desc(thread, JSHandle(clone_class), true, false, true); + JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(clone_class_prototype), + global_const->GetHandledConstructorString(), ctor_desc); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - cloneClass->SetHomeObject(thread, cloneClassPrototype); + clone_class->SetHomeObject(thread, clone_class_prototype); - if (!canShareHClass) { - SetClassInheritanceRelationship(thread, cloneClass.GetTaggedValue(), baseHandle.GetTaggedValue()); + if (!can_share_h_class) { + SetClassInheritanceRelationship(thread, clone_class.GetTaggedValue(), base_handle.GetTaggedValue()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } - return cloneClass.GetTaggedValue(); + return clone_class.GetTaggedValue(); } JSTaggedValue SlowRuntimeStub::SetClassInheritanceRelationship(JSThread *thread, JSTaggedValue ctor, JSTaggedValue base) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); + const GlobalEnvConstants *global_const = thread->GlobalConstants(); JSHandle cls(thread, ctor); ASSERT(cls->IsJSFunction()); @@ -2004,30 +2008,30 @@ JSTaggedValue SlowRuntimeStub::SetClassInheritanceRelationship(JSThread *thread, * Function.prototype Object.prototype / null B ----> B.prototype */ - JSHandle parentPrototype; + JSHandle parent_prototype; // hole means parent is not present if (parent->IsHole()) { JSHandle::Cast(cls)->SetFunctionKind(thread, FunctionKind::CLASS_CONSTRUCTOR); - parentPrototype = env->GetObjectFunctionPrototype(); + parent_prototype = env->GetObjectFunctionPrototype(); parent.Update(env->GetFunctionPrototype().GetTaggedValue()); } else if (parent->IsNull()) { JSHandle::Cast(cls)->SetFunctionKind(thread, FunctionKind::DERIVED_CONSTRUCTOR); - parentPrototype = JSHandle(thread, JSTaggedValue::Null()); + parent_prototype = JSHandle(thread, JSTaggedValue::Null()); parent.Update(env->GetFunctionPrototype().GetTaggedValue()); } else if (!parent->IsConstructor()) { return ThrowTypeError(thread, "parent class is not constructor"); } else { JSHandle::Cast(cls)->SetFunctionKind(thread, FunctionKind::DERIVED_CONSTRUCTOR); - parentPrototype = - JSTaggedValue::GetProperty(thread, parent, globalConst->GetHandledPrototypeString()).GetValue(); - if (!parentPrototype->IsECMAObject() && !parentPrototype->IsNull()) { + parent_prototype = + JSTaggedValue::GetProperty(thread, parent, global_const->GetHandledPrototypeString()).GetValue(); + if (!parent_prototype->IsECMAObject() && !parent_prototype->IsNull()) { return ThrowTypeError(thread, "parent class have no valid prototype"); } } cls->GetTaggedObject()->GetClass()->SetPrototype(thread, parent); - JSHandle clsPrototype(thread, JSHandle(cls)->GetFunctionPrototype()); - clsPrototype->GetClass()->SetPrototype(thread, parentPrototype); + JSHandle cls_prototype(thread, JSHandle(cls)->GetFunctionPrototype()); + cls_prototype->GetClass()->SetPrototype(thread, parent_prototype); return JSTaggedValue::Undefined(); } @@ -2040,8 +2044,8 @@ JSTaggedValue SlowRuntimeStub::SetClassConstructorLength(JSThread *thread, JSTag if (LIKELY(!cls->GetClass()->IsDictionaryMode())) { cls->SetPropertyInlinedProps(thread, JSFunction::LENGTH_INLINE_PROPERTY_INDEX, length); } else { - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); - cls->UpdatePropertyInDictionary(thread, globalConst->GetLengthString(), length); + const GlobalEnvConstants *global_const = thread->GlobalConstants(); + cls->UpdatePropertyInDictionary(thread, global_const->GetLengthString(), length); } return JSTaggedValue::Undefined(); } diff --git a/runtime/interpreter/slow_runtime_stub.h b/runtime/interpreter/slow_runtime_stub.h index dd24a72c1..50e2e6e71 100644 --- a/runtime/interpreter/slow_runtime_stub.h +++ b/runtime/interpreter/slow_runtime_stub.h @@ -55,32 +55,32 @@ public: static JSTaggedValue DelObjProp(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop); static JSTaggedValue NewObjDynRange(JSThread *thread, uint16_t args_count, JSTaggedValue func, JSTaggedValue new_target, JSTaggedType *stkargs); - static JSTaggedValue CreateObjectWithExcludedKeys(JSThread *thread, uint16_t numKeys, JSTaggedValue objVal, + static JSTaggedValue CreateObjectWithExcludedKeys(JSThread *thread, uint16_t num_keys, JSTaggedValue obj_val, JSTaggedType *stkargs); static JSTaggedValue ExpDyn(JSThread *thread, JSTaggedValue base, JSTaggedValue exponent); static JSTaggedValue IsInDyn(JSThread *thread, JSTaggedValue prop, JSTaggedValue obj); static JSTaggedValue InstanceofDyn(JSThread *thread, JSTaggedValue obj, JSTaggedValue target); - static JSTaggedValue NewLexicalEnvDyn(JSThread *thread, uint16_t numVars); + static JSTaggedValue NewLexicalEnvDyn(JSThread *thread, uint16_t num_vars); static JSTaggedValue CreateIterResultObj(JSThread *thread, JSTaggedValue value, bool done); - static JSTaggedValue CreateGeneratorObj(JSThread *thread, JSTaggedValue genFunc); - static JSTaggedValue SetGeneratorState(JSThread *thread, JSTaggedValue genObj, uint8_t state); - static JSTaggedValue CreateAsyncGeneratorObj(JSThread *thread, JSTaggedValue genFunc); - static JSTaggedValue SuspendGenerator(JSThread *thread, JSTaggedValue genObj, JSTaggedValue value); - static JSTaggedValue SuspendAsyncGenerator(JSThread *thread, JSTaggedValue asyncGenObj, JSTaggedValue value); - static JSTaggedValue AsyncFunctionAwait(JSThread *thread, JSTaggedValue asyncFuncObj, JSTaggedValue value); - static JSTaggedValue AsyncFunctionResolveOrReject(JSThread *thread, JSTaggedValue asyncFuncObj, JSTaggedValue value, - bool is_resolve); - static JSTaggedValue AsyncGeneratorResolve(JSThread *thread, JSTaggedValue asyncGenObj, JSTaggedValue value); - static JSTaggedValue AsyncGeneratorReject(JSThread *thread, JSTaggedValue asyncGenObj, JSTaggedValue value); - static JSTaggedValue NewObjSpreadDyn(JSThread *thread, JSTaggedValue func, JSTaggedValue newTarget, + static JSTaggedValue CreateGeneratorObj(JSThread *thread, JSTaggedValue gen_func); + static JSTaggedValue SetGeneratorState(JSThread *thread, JSTaggedValue gen_obj, uint8_t state); + static JSTaggedValue CreateAsyncGeneratorObj(JSThread *thread, JSTaggedValue gen_func); + static JSTaggedValue SuspendGenerator(JSThread *thread, JSTaggedValue gen_obj, JSTaggedValue value); + static JSTaggedValue SuspendAsyncGenerator(JSThread *thread, JSTaggedValue async_gen_obj, JSTaggedValue value); + static JSTaggedValue AsyncFunctionAwait(JSThread *thread, JSTaggedValue async_func_obj, JSTaggedValue value); + static JSTaggedValue AsyncFunctionResolveOrReject(JSThread *thread, JSTaggedValue async_func_obj, + JSTaggedValue value, bool is_resolve); + static JSTaggedValue AsyncGeneratorResolve(JSThread *thread, JSTaggedValue async_gen_obj, JSTaggedValue value); + static JSTaggedValue AsyncGeneratorReject(JSThread *thread, JSTaggedValue async_gen_obj, JSTaggedValue value); + static JSTaggedValue NewObjSpreadDyn(JSThread *thread, JSTaggedValue func, JSTaggedValue new_target, JSTaggedValue array); static void ThrowUndefinedIfHole(JSThread *thread, JSTaggedValue obj); static void ThrowIfNotObject(JSThread *thread); static void ThrowThrowNotExists(JSThread *thread); static void ThrowPatternNonCoercible(JSThread *thread); - static JSTaggedValue ThrowIfSuperNotCorrectCall(JSThread *thread, uint16_t index, JSTaggedValue thisValue); + static JSTaggedValue ThrowIfSuperNotCorrectCall(JSThread *thread, uint16_t index, JSTaggedValue this_value); static void ThrowDeleteSuperProperty(JSThread *thread); static JSTaggedValue StOwnByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, JSTaggedValue value); @@ -91,8 +91,8 @@ public: const JSHandle &key, const JSHandle &value); static JSTaggedValue StOwnByValueWithNameSet(JSThread *thread, JSHandle obj, JSHandle key, JSHandle value); - static JSTaggedValue CreateEmptyArray(JSThread *thread, ObjectFactory *factory, JSHandle globalEnv); - static JSTaggedValue CreateEmptyObject(JSThread *thread, ObjectFactory *factory, JSHandle globalEnv); + static JSTaggedValue CreateEmptyArray(JSThread *thread, ObjectFactory *factory, JSHandle global_env); + static JSTaggedValue CreateEmptyObject(JSThread *thread, ObjectFactory *factory, JSHandle global_env); static JSTaggedValue CreateObjectWithBuffer(JSThread *thread, ObjectFactory *factory, JSObject *literal); static JSTaggedValue CreateObjectHavingMethod(JSThread *thread, ObjectFactory *factory, JSObject *literal, JSTaggedValue env, ConstantPool *constpool); @@ -104,33 +104,33 @@ public: static JSTaggedValue GetNextPropName(JSThread *thread, JSTaggedValue iter); static JSTaggedValue CopyDataProperties(JSThread *thread, JSTaggedValue dst, JSTaggedValue src); - static JSTaggedValue GetUnmappedArgs(JSThread *thread, uint32_t actualNumArgs, JSTaggedType *stkargs); - static JSTaggedValue CopyRestArgs(JSThread *thread, uint32_t restNumArgs, JSTaggedType *stkargs); + static JSTaggedValue GetUnmappedArgs(JSThread *thread, uint32_t actual_num_args, JSTaggedType *stkargs); + static JSTaggedValue CopyRestArgs(JSThread *thread, uint32_t rest_num_args, JSTaggedType *stkargs); static JSTaggedValue GetIterator(JSThread *thread, JSTaggedValue obj, bool async = false, JSTaggedValue method = JSTaggedValue::Hole()); static JSTaggedValue CloseIterator(JSThread *thread, JSTaggedValue iter); - static JSTaggedValue ImportModule(JSThread *thread, JSTaggedValue moduleName); - static void StModuleVar(JSThread *thread, JSTaggedValue exportName, JSTaggedValue exportObj); - static void CopyModule(JSThread *thread, JSTaggedValue srcModule); - static JSTaggedValue LdModvarByName(JSThread *thread, JSTaggedValue moduleObj, JSTaggedValue itemName); + static JSTaggedValue ImportModule(JSThread *thread, JSTaggedValue module_name); + static void StModuleVar(JSThread *thread, JSTaggedValue export_name, JSTaggedValue export_obj); + static void CopyModule(JSThread *thread, JSTaggedValue src_module); + static JSTaggedValue LdModvarByName(JSThread *thread, JSTaggedValue module_obj, JSTaggedValue item_name); static JSTaggedValue CreateRegExpWithLiteral(JSThread *thread, JSTaggedValue pattern, uint8_t flags); static JSTaggedValue DefineGetterSetterByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, JSTaggedValue getter, JSTaggedValue setter, bool flag); - static JSTaggedValue LdObjByIndex(JSThread *thread, JSTaggedValue obj, uint32_t idx, bool callGetter, + static JSTaggedValue LdObjByIndex(JSThread *thread, JSTaggedValue obj, uint32_t idx, bool call_getter, JSTaggedValue receiver); static JSTaggedValue StObjByIndex(JSThread *thread, JSTaggedValue obj, uint32_t idx, JSTaggedValue value); - static JSTaggedValue LdObjByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, bool callGetter, + static JSTaggedValue LdObjByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, bool call_getter, JSTaggedValue receiver); static JSTaggedValue StObjByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, JSTaggedValue value); - static JSTaggedValue LdObjByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, bool callGetter, + static JSTaggedValue LdObjByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, bool call_getter, JSTaggedValue receiver); static JSTaggedValue StObjByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop, JSTaggedValue value); static JSTaggedValue TryLdGlobalByName(JSThread *thread, JSTaggedValue global, JSTaggedValue prop); static JSTaggedValue LdGlobalVar(JSThread *thread, JSTaggedValue global, JSTaggedValue prop); static JSTaggedValue StGlobalVar(JSThread *thread, JSTaggedValue prop, JSTaggedValue value); - static JSTaggedValue StGlobalRecord(JSThread *thread, JSTaggedValue prop, JSTaggedValue value, bool isConst); + static JSTaggedValue StGlobalRecord(JSThread *thread, JSTaggedValue prop, JSTaggedValue value, bool is_const); static JSTaggedValue LdGlobalRecord(JSThread *thread, JSTaggedValue key, bool *found); static JSTaggedValue TryUpdateGlobalRecord(JSThread *thread, JSTaggedValue prop, JSTaggedValue value); static JSTaggedValue StArraySpread(JSThread *thread, JSTaggedValue dst, JSTaggedValue index, JSTaggedValue src); @@ -144,14 +144,15 @@ public: static JSTaggedValue DefineClass(JSThread *thread, JSFunction *func, TaggedArray *literal, JSTaggedValue proto, JSTaggedValue lexenv, ConstantPool *constpool); - static JSTaggedValue SuperCall(JSThread *thread, JSTaggedValue func, JSTaggedValue newTarget, uint16_t argsCount, + static JSTaggedValue SuperCall(JSThread *thread, JSTaggedValue func, JSTaggedValue new_target, uint16_t args_count, JSTaggedType *stkargs); - static JSTaggedValue SuperCallSpread(JSThread *thread, JSTaggedValue func, JSTaggedValue newTarget, + static JSTaggedValue SuperCallSpread(JSThread *thread, JSTaggedValue func, JSTaggedValue new_target, JSTaggedValue array); - static JSTaggedValue DefineMethod(JSThread *thread, JSMethod *method, const JSHandle &homeObject); - static JSTaggedValue LdSuperByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue key, JSTaggedValue thisFunc); + static JSTaggedValue DefineMethod(JSThread *thread, JSMethod *method, const JSHandle &home_object); + static JSTaggedValue LdSuperByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue key, + JSTaggedValue this_func); static JSTaggedValue StSuperByValue(JSThread *thread, JSTaggedValue obj, JSTaggedValue key, JSTaggedValue value, - JSTaggedValue thisFunc); + JSTaggedValue this_func); static JSTaggedValue NotifyInlineCache(JSThread *thread, JSFunction *func, JSMethod *method); static JSTaggedValue ThrowReferenceError(JSThread *thread, JSTaggedValue prop, const char *desc); -- Gitee