Commit c4b17749 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[runtime] Fix raw objects around side-effect check

PerformSideEffectCheckAtBytecode calls Isolate::TerminateExecution on
failure, which can allocate. We can avoid Handles by only accessing the
frame's function object after the side effect check.

Bug: v8:9991
Change-Id: Iac74f8cf5ff0840a18c59faab4c256a3fa9d5b25
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1989825
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65612}
parent ec803eee
......@@ -66,10 +66,6 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) {
DCHECK(it.frame()->is_interpreted());
InterpretedFrame* interpreted_frame =
reinterpret_cast<InterpretedFrame*>(it.frame());
SharedFunctionInfo shared = interpreted_frame->function().shared();
BytecodeArray bytecode_array = shared.GetBytecodeArray();
int bytecode_offset = interpreted_frame->GetBytecodeOffset();
Bytecode bytecode = Bytecodes::FromByte(bytecode_array.get(bytecode_offset));
bool side_effect_check_failed = false;
if (isolate->debug_execution_mode() == DebugInfo::kSideEffects) {
......@@ -77,6 +73,13 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) {
!isolate->debug()->PerformSideEffectCheckAtBytecode(interpreted_frame);
}
// Make sure to only access these objects after the side effect check, as the
// check can allocate on failure.
SharedFunctionInfo shared = interpreted_frame->function().shared();
BytecodeArray bytecode_array = shared.GetBytecodeArray();
int bytecode_offset = interpreted_frame->GetBytecodeOffset();
Bytecode bytecode = Bytecodes::FromByte(bytecode_array.get(bytecode_offset));
if (Bytecodes::Returns(bytecode)) {
// If we are returning (or suspending), reset the bytecode array on the
// interpreted stack frame to the non-debug variant so that the interpreter
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment