Lines Matching +full:- +full:- +full:-
2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
7 * http://www.apache.org/licenses/LICENSE-2.0
21 #include "ecmascript/stubs/runtime_stubs-inl.h"
26 explicit FrameWriter(Deoptimizier *deoptimizier) : thread_(deoptimizier->GetThread()) in FrameWriter()
28 JSTaggedType *prevSp = const_cast<JSTaggedType *>(thread_->GetCurrentSPFrame()); in FrameWriter()
34 *(--top_) = value; in PushValue()
39 *(--top_) = value; in PushRawValue()
44 return !thread_->DoStackOverflowCheck(top_ - size); in Reserve()
76 ASSERT(index < static_cast<size_t>(start_ - top_)); in ReviseValueByIndex()
91 JSRuntimeOptions options = thread_->GetEcmaVM()->GetJSOptions(); in Deoptimizier()
135 // +--------------------------+ ---------------
139 // |--------------------------| |
141 // +--------------------------+ ---------------
143 // |--------------------------| |
145 // |--------------------------| OptimizedJSFunction FrameType:OPTIMIZED_JS_FUNCTIO…
147 // |--------------------------| |
148 // | call-target | |
149 // |--------------------------| |
151 // |--------------------------| |
153 // +--------------------------+ ---------------
155 // |--------------------------| |
157 // |--------------------------| __llvm_deoptimize FrameType:OPTIMIZED_FRAME
159 // |--------------------------| |
162 // +--------------------------+ ---------------
164 // |--------------------------| |
166 // |--------------------------| DeoptHandlerAsm FrameType:ASM_BRIDGE_FRAME
168 // |--------------------------| |
170 // |--------------------------| |
172 // +--------------------------+ ---------------
177 // |--------------------------| ---------------
181 // +----------------------------------+---------+
185 // |----------------------------------| |
187 // +----------------------------------+---------+
189 // |----------------------------------| |
191 // |----------------------------------| ASM_INTERPRETER_BRIDGE_FRAME
193 // |----------------------------------| |
195 // +----------------------------------+---------+
197 // |----------------------------------|
198 // | argv[n-1] |
199 // |----------------------------------|
201 // |----------------------------------|
203 // |----------------------------------|
205 // |----------------------------------|
207 // |----------------------------------|
209 // +----------------------------------+--------+
213 // |----------------------------------| |
215 // |----------------------------------| |
217 // |----------------------------------| AsmInterpretedFrame 0
219 // |----------------------------------| |
221 // |----------------------------------| |
223 // |----------------------------------| |
225 // |----------------------------------| |
226 // | call-target | v
227 // +----------------------------------+--------+
228 // | argv[n-1] |
229 // |----------------------------------|
231 // |----------------------------------|
233 // |----------------------------------|
235 // |----------------------------------|
237 // |----------------------------------|
239 // +----------------------------------+--------+
243 // |----------------------------------| |
245 // |----------------------------------| |
247 // |----------------------------------| AsmInterpretedFrame 1
249 // |----------------------------------| |
251 // |----------------------------------| |
253 // |----------------------------------| |
255 // |----------------------------------| |
256 // | call-target | v
257 // +----------------------------------+--------+
261 // +----------------------------------+--------+
267 frame->GetFuncCalleeRegAndOffset(it, calleeRegInfo); in AssistCollectDeoptBundleVec()
271 auto preFrameSp = frame->ComputePrevFrameSp(it); in AssistCollectDeoptBundleVec()
272 frameArgc_ = frame->GetArgc(preFrameSp); in AssistCollectDeoptBundleVec()
273 frameArgvs_ = frame->GetArgv(preFrameSp); in AssistCollectDeoptBundleVec()
275 stackContext_.returnAddr_ = frame->GetReturnAddr(); in AssistCollectDeoptBundleVec()
276 stackContext_.callerFp_ = reinterpret_cast<uintptr_t>(frame->GetPrevFrameFp()); in AssistCollectDeoptBundleVec()
281 JSTaggedType *lastLeave = const_cast<JSTaggedType *>(thread_->GetLastLeaveFrame()); in CollectDeoptBundleVec()
290 frame->GetDeoptBundleInfo(it, deoptBundle); in CollectDeoptBundleVec()
297 frame->GetDeoptBundleInfo(it, deoptBundle); in CollectDeoptBundleVec()
304 sp -= TYPE_GLUE_SLOT; in CollectDeoptBundleVec()
305 calleeRegAddr_ = sp - numCalleeRegs_; in CollectDeoptBundleVec()
324 Method *method = callTarget->GetCallTarget(); in GetMethod()
348 declaredNumArgs = static_cast<int32_t>(method->GetNumArgsWithCallField()); in CollectVirtualRegisters()
351 actualNumArgs = static_cast<int32_t>(method->GetNumArgsWithCallField()); in CollectVirtualRegisters()
352 declaredNumArgs = static_cast<int32_t>(method->GetNumArgsWithCallField()); in CollectVirtualRegisters()
355 int32_t callFieldNumVregs = static_cast<int32_t>(method->GetNumVregsWithCallField()); in CollectVirtualRegisters()
364 frameWriter->PushValue(value.GetRawData()); in CollectVirtualRegisters()
367 static_cast<int32_t>(method->GetNumRevervedArgs()) - 1; in CollectVirtualRegisters()
368 if (!frameWriter->Reserve(static_cast<size_t>(virtualIndex))) { in CollectVirtualRegisters()
371 for (int32_t i = static_cast<int32_t>(declaredNumArgs - 1); i >= 0; i--) { in CollectVirtualRegisters()
377 frameWriter->PushValue(value.GetRawData()); in CollectVirtualRegisters()
378 virtualIndex--; in CollectVirtualRegisters()
382 if (method->HaveThisWithCallField()) { in CollectVirtualRegisters()
385 frameWriter->PushValue(value.GetRawData()); in CollectVirtualRegisters()
386 virtualIndex--; in CollectVirtualRegisters()
388 if (method->HaveNewTargetWithCallField()) { in CollectVirtualRegisters()
391 frameWriter->PushValue(value.GetRawData()); in CollectVirtualRegisters()
392 virtualIndex--; in CollectVirtualRegisters()
394 if (method->HaveFuncWithCallField()) { in CollectVirtualRegisters()
397 frameWriter->PushValue(value.GetRawData()); in CollectVirtualRegisters()
398 virtualIndex--; in CollectVirtualRegisters()
402 for (int32_t i = virtualIndex; i >= 0; i--) { in CollectVirtualRegisters()
404 frameWriter->PushValue(value.GetRawData()); in CollectVirtualRegisters()
405 virtualIndex--; in CollectVirtualRegisters()
407 … // revise correct a0 - aN virtual regs , for example: ldobjbyname key; sta a2; update value to a2 in CollectVirtualRegisters()
408 // +--------------------------+ ^ in CollectVirtualRegisters()
410 // +--------------------------+ | in CollectVirtualRegisters()
412 // +--------------------------+ | in CollectVirtualRegisters()
414 // +--------------------------+ revise correct vreg in CollectVirtualRegisters()
416 // +--------------------------+ | in CollectVirtualRegisters()
418 // |--------------------------| v in CollectVirtualRegisters()
419 // | v0 - vN | in CollectVirtualRegisters()
420 // sp --> |--------------------------| in CollectVirtualRegisters()
422 static_cast<int32_t>(method->GetNumRevervedArgs()); in CollectVirtualRegisters()
427 frameWriter->ReviseValueByIndex(value.GetRawData(), i); in CollectVirtualRegisters()
435 if (thread_->IsPGOProfilerEnable()) { in Dump()
437 auto profileTypeInfo = function->GetProfileTypeInfo(); in Dump()
447 const uint8_t *pc = GetMethod(callTarget)->GetBytecodeArray() + pc_.at(depth); in Dump()
463 return "DeoptType-" + std::to_string(static_cast<uint8_t>(type)); in DisplayItems()
467 // |--------------------------| --------------> start(n)
473 // |---------------------------
475 // +--------------------------+ --------------> end(n)
476 // | outputcounts | outputcounts = end(n) - start(n)
477 // |--------------------------| --------------> start(n-1)
483 // |-------------------------------------------
485 // +--------------------------+ --------------> end(n-1)
486 // | outputcounts | outputcounts = end(n-1) - start(n-1)
487 // |--------------------------| --------------> start(n-1)
489 // +--------------------------+ ---------------
494 // |--------------------------| ---------------
500 for (int32_t curDepth = static_cast<int32_t>(inlineDepth_); curDepth >= 0; curDepth--) { in ConstructAsmInterpretFrame()
508 const uint8_t *resumePc = method->GetBytecodeArray() + pc_.at(curDepth); in ConstructAsmInterpretFrame()
511 statePtr->function = callTarget; in ConstructAsmInterpretFrame()
512 statePtr->acc = acc; in ConstructAsmInterpretFrame()
513 statePtr->env = GetDeoptValue(curDepth, static_cast<int32_t>(SpecVregIndex::ENV_INDEX)); in ConstructAsmInterpretFrame()
514 statePtr->callSize = GetCallSize(curDepth, resumePc); in ConstructAsmInterpretFrame()
515 statePtr->fp = 0; // need update in ConstructAsmInterpretFrame()
516 statePtr->thisObj = thisObj; in ConstructAsmInterpretFrame()
517 statePtr->pc = resumePc; in ConstructAsmInterpretFrame()
518 // -uintptr_t skip lr in ConstructAsmInterpretFrame()
520 …statePtr->base.prev = reinterpret_cast<JSTaggedType *>(stackContext_.callFrameTop_ - sizeof(uintpt… in ConstructAsmInterpretFrame()
522 statePtr->base.prev = 0; // need update in ConstructAsmInterpretFrame()
525 statePtr->base.type = FrameType::ASM_INTERPRETER_FRAME; in ConstructAsmInterpretFrame()
529 auto outputCount = start - end; in ConstructAsmInterpretFrame()
544 if (jsFunc->GetMachineCode().IsMachineCodeObject()) { in ResetJitHotness()
545 JSTaggedValue profileTypeInfoVal = jsFunc->GetProfileTypeInfo(); in ResetJitHotness()
548 profileTypeInfo->SetJitHotnessCnt(0); in ResetJitHotness()
551 uint16_t threshold = profileTypeInfo->GetJitHotnessThreshold(); in ResetJitHotness()
553 profileTypeInfo->SetJitHotnessThreshold(threshold); in ResetJitHotness()
554 …ProfileTypeInfoCell::Cast(jsFunc->GetRawProfileTypeInfo())->SetMachineCode(thread_, JSTaggedValue:… in ResetJitHotness()
555 Method *method = Method::Cast(jsFunc->GetMethod().GetTaggedObject()); in ResetJitHotness()
556 …LOG_JIT(DEBUG) << "reset jit hotness for func: " << method->GetMethodName() << ", threshold:" << t… in ResetJitHotness()
563 if (func->GetMachineCode().IsMachineCodeObject()) { in ClearCompiledCodeStatusWhenDeopt()
564 Jit::GetInstance()->GetJitDfx()->SetJitDeoptCount(); in ClearCompiledCodeStatusWhenDeopt()
566 if (func->IsCompiledCode()) { in ClearCompiledCodeStatusWhenDeopt()
567 bool isFastCall = func->IsCompiledFastCall(); // get this flag before clear it in ClearCompiledCodeStatusWhenDeopt()
569 … isFastCall ? thread_->GetRTInterface(kungfu::RuntimeStubCSigns::ID_FastCallToAsmInterBridge) in ClearCompiledCodeStatusWhenDeopt()
570 … : thread_->GetRTInterface(kungfu::RuntimeStubCSigns::ID_AOTCallToAsmInterBridge); in ClearCompiledCodeStatusWhenDeopt()
571 func->SetCodeEntry(entry); in ClearCompiledCodeStatusWhenDeopt()
572 method->ClearAOTStatusWhenDeopt(entry); in ClearCompiledCodeStatusWhenDeopt()
573 func->ClearCompiledCodeFlags(); in ClearCompiledCodeStatusWhenDeopt()
575 func->ClearMachineCode(thread_); in ClearCompiledCodeStatusWhenDeopt()
585 if (func->GetMachineCode().IsMachineCodeObject()) { in UpdateAndDumpDeoptInfo()
586 MachineCode *machineCode = MachineCode::Cast(func->GetMachineCode().GetTaggedObject()); in UpdateAndDumpDeoptInfo()
588 machineCode->GetOSROffset() != MachineCode::INVALID_OSR_OFFSET) { in UpdateAndDumpDeoptInfo()
589 machineCode->SetOsrDeoptFlag(true); in UpdateAndDumpDeoptInfo()
597 uint8_t deoptThreshold = method->GetDeoptThreshold(); in UpdateAndDumpDeoptInfo()
599 method->SetDeoptType(type); in UpdateAndDumpDeoptInfo()
600 method->SetDeoptThreshold(--deoptThreshold); in UpdateAndDumpDeoptInfo()
623 return -((-index << shift) | depth); in EncodeDeoptVregIndex()
640 return -((-id) >> shift); in DecodeVregIndex()
645 size_t mask = (1 << shift) - 1; in DecodeDeoptDepth()
649 return (-id) & mask; in DecodeDeoptDepth()