Commit 96ad5ab3 authored by Igor Sheludko's avatar Igor Sheludko Committed by V8 LUCI CQ

[test] Fix %PrepareFunctionForOptimization() vs bytecode flushing

Ensure the bytecode array is available, before we put it to the
PendingOptimizationTable.

Bug: v8:12416
Change-Id: Ie4eb1a8a2ebdcdc0cfbfd7884eb081e156635a59
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3313108
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78293}
parent adc11330
......@@ -30,6 +30,11 @@ void PendingOptimizationTable::PreparedForOptimization(
if (allow_heuristic_optimization) {
status |= FunctionStatus::kAllowHeuristicOptimization;
}
Handle<SharedFunctionInfo> shared_info(function->shared(), isolate);
IsCompiledScope is_compiled_scope;
SharedFunctionInfo::EnsureBytecodeArrayAvailable(isolate, shared_info,
&is_compiled_scope);
Handle<ObjectHashTable> table =
isolate->heap()->pending_optimize_for_test_bytecode().IsUndefined()
......@@ -38,7 +43,7 @@ void PendingOptimizationTable::PreparedForOptimization(
isolate->heap()->pending_optimize_for_test_bytecode()),
isolate);
Handle<Tuple2> tuple = isolate->factory()->NewTuple2(
handle(function->shared().GetBytecodeArray(isolate), isolate),
handle(shared_info->GetBytecodeArray(isolate), isolate),
handle(Smi::FromInt(status), isolate), AllocationType::kYoung);
table =
ObjectHashTable::Put(table, handle(function->shared(), isolate), tuple);
......
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