Commit dc4cbcb9 authored by Shu-yu Guo's avatar Shu-yu Guo Committed by V8 LUCI CQ

Retain current code in EnsureBytecodeArrayAvailable if not compiled

IsCompiledScope retains code to protect against code flushing. The
current API is easily misused by forgetting to initialize
IsCompiledScope with a SFI's current state.

Change-Id: Ie8ab60acc4fb85c4b8b76c52040976e2e34f9d5e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3674117Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80896}
parent c48f5fdf
......@@ -32,7 +32,7 @@ void PendingOptimizationTable::PreparedForOptimization(
}
Handle<SharedFunctionInfo> shared_info(function->shared(), isolate);
IsCompiledScope is_compiled_scope = shared_info->is_compiled_scope(isolate);
IsCompiledScope is_compiled_scope;
SharedFunctionInfo::EnsureBytecodeArrayAvailable(isolate, shared_info,
&is_compiled_scope);
......
......@@ -725,6 +725,8 @@ void SharedFunctionInfo::EnsureBytecodeArrayAvailable(
FATAL("Failed to compile shared info that was already compiled before");
}
DCHECK(shared_info->GetBytecodeArray(isolate).HasSourcePositionTable());
} else {
*is_compiled_scope = shared_info->is_compiled_scope(isolate);
}
}
......
......@@ -605,7 +605,7 @@ class SharedFunctionInfo
static void EnsureBytecodeArrayAvailable(
Isolate* isolate, Handle<SharedFunctionInfo> shared_info,
IsCompiledScope* is_compiled,
IsCompiledScope* is_compiled_scope,
CreateSourcePositions flag = CreateSourcePositions::kNo);
inline bool CanCollectSourcePosition(Isolate* isolate);
......
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