Commit 0db5e7b8 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[TurboFan] Return MaybeHandle from TurboFan compiler

TurboFan returned null handles if compilation did not succeed. This CL
changes that to a MaybeHandle to make it explicit that client code needs
to handle the error.

Bug: v8:7856
Change-Id: I6087e6263faa1150b9788213dd22c398b4a2fc2d
Reviewed-on: https://chromium-review.googlesource.com/1104688
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53824}
parent 6394fd35
...@@ -178,19 +178,22 @@ Handle<Code> CodeAssembler::GenerateCode(CodeAssemblerState* state) { ...@@ -178,19 +178,22 @@ Handle<Code> CodeAssembler::GenerateCode(CodeAssemblerState* state) {
bool should_optimize_jumps = bool should_optimize_jumps =
rasm->isolate()->serializer_enabled() && FLAG_turbo_rewrite_far_jumps; rasm->isolate()->serializer_enabled() && FLAG_turbo_rewrite_far_jumps;
Handle<Code> code = Pipeline::GenerateCodeForCodeStub( Handle<Code> code =
rasm->isolate(), rasm->call_descriptor(), rasm->graph(), schedule, Pipeline::GenerateCodeForCodeStub(
state->kind_, state->name_, state->stub_key_, state->builtin_index_, rasm->isolate(), rasm->call_descriptor(), rasm->graph(), schedule,
should_optimize_jumps ? &jump_opt : nullptr, rasm->poisoning_level()); state->kind_, state->name_, state->stub_key_, state->builtin_index_,
should_optimize_jumps ? &jump_opt : nullptr, rasm->poisoning_level())
.ToHandleChecked();
if (jump_opt.is_optimizable()) { if (jump_opt.is_optimizable()) {
jump_opt.set_optimizing(); jump_opt.set_optimizing();
// Regenerate machine code // Regenerate machine code
code = Pipeline::GenerateCodeForCodeStub( code = Pipeline::GenerateCodeForCodeStub(
rasm->isolate(), rasm->call_descriptor(), rasm->graph(), schedule, rasm->isolate(), rasm->call_descriptor(), rasm->graph(),
state->kind_, state->name_, state->stub_key_, state->builtin_index_, schedule, state->kind_, state->name_, state->stub_key_,
&jump_opt, rasm->poisoning_level()); state->builtin_index_, &jump_opt, rasm->poisoning_level())
.ToHandleChecked();
} }
state->code_generated_ = true; state->code_generated_ = true;
......
...@@ -356,10 +356,10 @@ Handle<ByteArray> CodeGenerator::GetSourcePositionTable() { ...@@ -356,10 +356,10 @@ Handle<ByteArray> CodeGenerator::GetSourcePositionTable() {
return source_position_table_builder_.ToSourcePositionTable(isolate()); return source_position_table_builder_.ToSourcePositionTable(isolate());
} }
Handle<Code> CodeGenerator::FinalizeCode() { MaybeHandle<Code> CodeGenerator::FinalizeCode() {
if (result_ != kSuccess) { if (result_ != kSuccess) {
tasm()->AbortedCodeGeneration(); tasm()->AbortedCodeGeneration();
return Handle<Code>(); return MaybeHandle<Code>();
} }
// Allocate the source position table. // Allocate the source position table.
...@@ -381,10 +381,11 @@ Handle<Code> CodeGenerator::FinalizeCode() { ...@@ -381,10 +381,11 @@ Handle<Code> CodeGenerator::FinalizeCode() {
source_positions, deopt_data, kMovable, info()->stub_key(), true, source_positions, deopt_data, kMovable, info()->stub_key(), true,
frame()->GetTotalFrameSlotCount(), safepoints()->GetCodeOffset(), frame()->GetTotalFrameSlotCount(), safepoints()->GetCodeOffset(),
handler_table_offset_); handler_table_offset_);
Handle<Code> code; Handle<Code> code;
if (!maybe_code.ToHandle(&code)) { if (!maybe_code.ToHandle(&code)) {
tasm()->AbortedCodeGeneration(); tasm()->AbortedCodeGeneration();
return Handle<Code>(); return MaybeHandle<Code>();
} }
isolate()->counters()->total_compiled_code_size()->Increment( isolate()->counters()->total_compiled_code_size()->Increment(
code->raw_instruction_size()); code->raw_instruction_size());
......
...@@ -88,9 +88,9 @@ class CodeGenerator final : public GapResolver::Assembler { ...@@ -88,9 +88,9 @@ class CodeGenerator final : public GapResolver::Assembler {
// Generate native code. After calling AssembleCode, call FinalizeCode to // Generate native code. After calling AssembleCode, call FinalizeCode to
// produce the actual code object. If an error occurs during either phase, // produce the actual code object. If an error occurs during either phase,
// FinalizeCode returns a null handle. // FinalizeCode returns an empty MaybeHandle.
void AssembleCode(); // Does not need to run on main thread. void AssembleCode(); // Does not need to run on main thread.
Handle<Code> FinalizeCode(); MaybeHandle<Code> FinalizeCode();
Handle<ByteArray> GetSourcePositionTable(); Handle<ByteArray> GetSourcePositionTable();
......
...@@ -222,8 +222,8 @@ class PipelineData { ...@@ -222,8 +222,8 @@ class PipelineData {
bool verify_graph() const { return verify_graph_; } bool verify_graph() const { return verify_graph_; }
void set_verify_graph(bool value) { verify_graph_ = value; } void set_verify_graph(bool value) { verify_graph_ = value; }
Handle<Code> code() { return code_; } MaybeHandle<Code> code() { return code_; }
void set_code(Handle<Code> code) { void set_code(MaybeHandle<Code> code) {
DCHECK(code_.is_null()); DCHECK(code_.is_null());
code_ = code; code_ = code;
} }
...@@ -404,7 +404,7 @@ class PipelineData { ...@@ -404,7 +404,7 @@ class PipelineData {
bool verify_graph_ = false; bool verify_graph_ = false;
int start_source_position_ = kNoSourcePosition; int start_source_position_ = kNoSourcePosition;
base::Optional<OsrHelper> osr_helper_; base::Optional<OsrHelper> osr_helper_;
Handle<Code> code_ = Handle<Code>::null(); MaybeHandle<Code> code_;
CodeGenerator* code_generator_ = nullptr; CodeGenerator* code_generator_ = nullptr;
// All objects in the following group of fields are allocated in graph_zone_. // All objects in the following group of fields are allocated in graph_zone_.
...@@ -485,11 +485,11 @@ class PipelineImpl final { ...@@ -485,11 +485,11 @@ class PipelineImpl final {
void AssembleCode(Linkage* linkage); void AssembleCode(Linkage* linkage);
// Step D. Run the code finalization pass. // Step D. Run the code finalization pass.
Handle<Code> FinalizeCode(); MaybeHandle<Code> FinalizeCode();
void VerifyGeneratedCodeIsIdempotent(); void VerifyGeneratedCodeIsIdempotent();
void RunPrintAndVerify(const char* phase, bool untyped = false); void RunPrintAndVerify(const char* phase, bool untyped = false);
Handle<Code> GenerateCode(CallDescriptor* call_descriptor); MaybeHandle<Code> GenerateCode(CallDescriptor* call_descriptor);
void AllocateRegisters(const RegisterConfiguration* config, void AllocateRegisters(const RegisterConfiguration* config,
CallDescriptor* call_descriptor, bool run_verifier); CallDescriptor* call_descriptor, bool run_verifier);
...@@ -910,8 +910,9 @@ PipelineCompilationJob::Status PipelineCompilationJob::ExecuteJobImpl() { ...@@ -910,8 +910,9 @@ PipelineCompilationJob::Status PipelineCompilationJob::ExecuteJobImpl() {
PipelineCompilationJob::Status PipelineCompilationJob::FinalizeJobImpl( PipelineCompilationJob::Status PipelineCompilationJob::FinalizeJobImpl(
Isolate* isolate) { Isolate* isolate) {
Handle<Code> code = pipeline_.FinalizeCode(); MaybeHandle<Code> maybe_code = pipeline_.FinalizeCode();
if (code.is_null()) { Handle<Code> code;
if (!maybe_code.ToHandle(&code)) {
if (compilation_info()->bailout_reason() == BailoutReason::kNoReason) { if (compilation_info()->bailout_reason() == BailoutReason::kNoReason) {
return AbortOptimization(BailoutReason::kCodeGenerationFailed); return AbortOptimization(BailoutReason::kCodeGenerationFailed);
} }
...@@ -2081,7 +2082,7 @@ bool PipelineImpl::OptimizeGraph(Linkage* linkage) { ...@@ -2081,7 +2082,7 @@ bool PipelineImpl::OptimizeGraph(Linkage* linkage) {
return SelectInstructions(linkage); return SelectInstructions(linkage);
} }
Handle<Code> Pipeline::GenerateCodeForCodeStub( MaybeHandle<Code> Pipeline::GenerateCodeForCodeStub(
Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph, Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph,
Schedule* schedule, Code::Kind kind, const char* debug_name, Schedule* schedule, Code::Kind kind, const char* debug_name,
uint32_t stub_key, int32_t builtin_index, JumpOptimizationInfo* jump_opt, uint32_t stub_key, int32_t builtin_index, JumpOptimizationInfo* jump_opt,
...@@ -2134,8 +2135,8 @@ Handle<Code> Pipeline::GenerateCodeForCodeStub( ...@@ -2134,8 +2135,8 @@ Handle<Code> Pipeline::GenerateCodeForCodeStub(
} }
// static // static
Handle<Code> Pipeline::GenerateCodeForTesting(OptimizedCompilationInfo* info, MaybeHandle<Code> Pipeline::GenerateCodeForTesting(
Isolate* isolate) { OptimizedCompilationInfo* info, Isolate* isolate) {
ZoneStats zone_stats(isolate->allocator()); ZoneStats zone_stats(isolate->allocator());
std::unique_ptr<PipelineStatistics> pipeline_statistics( std::unique_ptr<PipelineStatistics> pipeline_statistics(
CreatePipelineStatistics(Handle<Script>::null(), info, isolate, CreatePipelineStatistics(Handle<Script>::null(), info, isolate,
...@@ -2146,23 +2147,23 @@ Handle<Code> Pipeline::GenerateCodeForTesting(OptimizedCompilationInfo* info, ...@@ -2146,23 +2147,23 @@ Handle<Code> Pipeline::GenerateCodeForTesting(OptimizedCompilationInfo* info,
Linkage linkage(Linkage::ComputeIncoming(data.instruction_zone(), info)); Linkage linkage(Linkage::ComputeIncoming(data.instruction_zone(), info));
Deoptimizer::EnsureCodeForMaxDeoptimizationEntries(isolate); Deoptimizer::EnsureCodeForMaxDeoptimizationEntries(isolate);
if (!pipeline.CreateGraph()) return Handle<Code>::null(); if (!pipeline.CreateGraph()) return MaybeHandle<Code>();
if (!pipeline.OptimizeGraph(&linkage)) return Handle<Code>::null(); if (!pipeline.OptimizeGraph(&linkage)) return MaybeHandle<Code>();
pipeline.AssembleCode(&linkage); pipeline.AssembleCode(&linkage);
return pipeline.FinalizeCode(); return pipeline.FinalizeCode();
} }
// static // static
Handle<Code> Pipeline::GenerateCodeForTesting(OptimizedCompilationInfo* info, MaybeHandle<Code> Pipeline::GenerateCodeForTesting(
Isolate* isolate, Graph* graph, OptimizedCompilationInfo* info, Isolate* isolate, Graph* graph,
Schedule* schedule) { Schedule* schedule) {
auto call_descriptor = Linkage::ComputeIncoming(info->zone(), info); auto call_descriptor = Linkage::ComputeIncoming(info->zone(), info);
return GenerateCodeForTesting(info, isolate, call_descriptor, graph, return GenerateCodeForTesting(info, isolate, call_descriptor, graph,
schedule); schedule);
} }
// static // static
Handle<Code> Pipeline::GenerateCodeForTesting( MaybeHandle<Code> Pipeline::GenerateCodeForTesting(
OptimizedCompilationInfo* info, Isolate* isolate, OptimizedCompilationInfo* info, Isolate* isolate,
CallDescriptor* call_descriptor, Graph* graph, Schedule* schedule, CallDescriptor* call_descriptor, Graph* graph, Schedule* schedule,
SourcePositionTable* source_positions) { SourcePositionTable* source_positions) {
...@@ -2437,12 +2438,15 @@ std::ostream& operator<<(std::ostream& out, const BlockStartsAsJSON& s) { ...@@ -2437,12 +2438,15 @@ std::ostream& operator<<(std::ostream& out, const BlockStartsAsJSON& s) {
return out; return out;
} }
Handle<Code> PipelineImpl::FinalizeCode() { MaybeHandle<Code> PipelineImpl::FinalizeCode() {
PipelineData* data = this->data_; PipelineData* data = this->data_;
Run<FinalizeCodePhase>(); Run<FinalizeCodePhase>();
Handle<Code> code = data->code(); MaybeHandle<Code> maybe_code = data->code();
if (code.is_null()) return code; Handle<Code> code;
if (!maybe_code.ToHandle(&code)) {
return maybe_code;
}
if (data->profiler_data()) { if (data->profiler_data()) {
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
...@@ -2486,11 +2490,11 @@ Handle<Code> PipelineImpl::FinalizeCode() { ...@@ -2486,11 +2490,11 @@ Handle<Code> PipelineImpl::FinalizeCode() {
return code; return code;
} }
Handle<Code> PipelineImpl::GenerateCode(CallDescriptor* call_descriptor) { MaybeHandle<Code> PipelineImpl::GenerateCode(CallDescriptor* call_descriptor) {
Linkage linkage(call_descriptor); Linkage linkage(call_descriptor);
// Perform instruction selection and register allocation. // Perform instruction selection and register allocation.
if (!SelectInstructions(&linkage)) return Handle<Code>(); if (!SelectInstructions(&linkage)) return MaybeHandle<Code>();
// Generate the final machine code. // Generate the final machine code.
AssembleCode(&linkage); AssembleCode(&linkage);
......
...@@ -56,7 +56,7 @@ class Pipeline : public AllStatic { ...@@ -56,7 +56,7 @@ class Pipeline : public AllStatic {
// Run the pipeline on a machine graph and generate code. The {schedule} must // Run the pipeline on a machine graph and generate code. The {schedule} must
// be valid, hence the given {graph} does not need to be schedulable. // be valid, hence the given {graph} does not need to be schedulable.
static Handle<Code> GenerateCodeForCodeStub( static MaybeHandle<Code> GenerateCodeForCodeStub(
Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph, Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph,
Schedule* schedule, Code::Kind kind, const char* debug_name, Schedule* schedule, Code::Kind kind, const char* debug_name,
uint32_t stub_key, int32_t builtin_index, JumpOptimizationInfo* jump_opt, uint32_t stub_key, int32_t builtin_index, JumpOptimizationInfo* jump_opt,
...@@ -64,14 +64,14 @@ class Pipeline : public AllStatic { ...@@ -64,14 +64,14 @@ class Pipeline : public AllStatic {
// Run the entire pipeline and generate a handle to a code object suitable for // Run the entire pipeline and generate a handle to a code object suitable for
// testing. // testing.
static Handle<Code> GenerateCodeForTesting(OptimizedCompilationInfo* info, static MaybeHandle<Code> GenerateCodeForTesting(
Isolate* isolate); OptimizedCompilationInfo* info, Isolate* isolate);
// Run the pipeline on a machine graph and generate code. If {schedule} is // Run the pipeline on a machine graph and generate code. If {schedule} is
// {nullptr}, then compute a new schedule for code generation. // {nullptr}, then compute a new schedule for code generation.
static Handle<Code> GenerateCodeForTesting(OptimizedCompilationInfo* info, static MaybeHandle<Code> GenerateCodeForTesting(
Isolate* isolate, Graph* graph, OptimizedCompilationInfo* info, Isolate* isolate, Graph* graph,
Schedule* schedule = nullptr); Schedule* schedule = nullptr);
// Run just the register allocator phases. // Run just the register allocator phases.
V8_EXPORT_PRIVATE static bool AllocateRegistersForTesting( V8_EXPORT_PRIVATE static bool AllocateRegistersForTesting(
...@@ -80,7 +80,7 @@ class Pipeline : public AllStatic { ...@@ -80,7 +80,7 @@ class Pipeline : public AllStatic {
// Run the pipeline on a machine graph and generate code. If {schedule} is // Run the pipeline on a machine graph and generate code. If {schedule} is
// {nullptr}, then compute a new schedule for code generation. // {nullptr}, then compute a new schedule for code generation.
V8_EXPORT_PRIVATE static Handle<Code> GenerateCodeForTesting( V8_EXPORT_PRIVATE static MaybeHandle<Code> GenerateCodeForTesting(
OptimizedCompilationInfo* info, Isolate* isolate, OptimizedCompilationInfo* info, Isolate* isolate,
CallDescriptor* call_descriptor, Graph* graph, CallDescriptor* call_descriptor, Graph* graph,
Schedule* schedule = nullptr, Schedule* schedule = nullptr,
......
...@@ -4711,9 +4711,9 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -4711,9 +4711,9 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
}; };
} // namespace } // namespace
Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::WasmModule* module, MaybeHandle<Code> CompileJSToWasmWrapper(
Address call_target, uint32_t index, Isolate* isolate, wasm::WasmModule* module, Address call_target,
wasm::UseTrapHandler use_trap_handler) { uint32_t index, wasm::UseTrapHandler use_trap_handler) {
const wasm::WasmFunction* func = &module->functions[index]; const wasm::WasmFunction* func = &module->functions[index];
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -4761,10 +4761,14 @@ Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::WasmModule* module, ...@@ -4761,10 +4761,14 @@ Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::WasmModule* module,
CallDescriptor* incoming = Linkage::GetJSCallDescriptor( CallDescriptor* incoming = Linkage::GetJSCallDescriptor(
&zone, false, params + 1, CallDescriptor::kNoFlags); &zone, false, params + 1, CallDescriptor::kNoFlags);
Handle<Code> code = MaybeHandle<Code> maybe_code =
Pipeline::GenerateCodeForTesting(&info, isolate, incoming, &graph); Pipeline::GenerateCodeForTesting(&info, isolate, incoming, &graph);
Handle<Code> code;
if (!maybe_code.ToHandle(&code)) {
return maybe_code;
}
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code && !code.is_null()) { if (FLAG_print_opt_code) {
CodeTracer::Scope tracing_scope(isolate->GetCodeTracer()); CodeTracer::Scope tracing_scope(isolate->GetCodeTracer());
OFStream os(tracing_scope.file()); OFStream os(tracing_scope.file());
code->Disassemble(func_name.start(), os); code->Disassemble(func_name.start(), os);
...@@ -4779,10 +4783,10 @@ Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::WasmModule* module, ...@@ -4779,10 +4783,10 @@ Handle<Code> CompileJSToWasmWrapper(Isolate* isolate, wasm::WasmModule* module,
return code; return code;
} }
Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target, MaybeHandle<Code> CompileWasmToJSWrapper(
wasm::FunctionSig* sig, uint32_t index, Isolate* isolate, Handle<JSReceiver> target, wasm::FunctionSig* sig,
wasm::ModuleOrigin origin, uint32_t index, wasm::ModuleOrigin origin,
wasm::UseTrapHandler use_trap_handler) { wasm::UseTrapHandler use_trap_handler) {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Create the Graph // Create the Graph
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -4832,10 +4836,14 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target, ...@@ -4832,10 +4836,14 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target,
incoming = GetI32WasmCallDescriptor(&zone, incoming); incoming = GetI32WasmCallDescriptor(&zone, incoming);
} }
Handle<Code> code = Pipeline::GenerateCodeForTesting( MaybeHandle<Code> maybe_code = Pipeline::GenerateCodeForTesting(
&info, isolate, incoming, &graph, nullptr, source_position_table); &info, isolate, incoming, &graph, nullptr, source_position_table);
Handle<Code> code;
if (!maybe_code.ToHandle(&code)) {
return maybe_code;
}
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code && !code.is_null()) { if (FLAG_print_opt_code) {
CodeTracer::Scope tracing_scope(isolate->GetCodeTracer()); CodeTracer::Scope tracing_scope(isolate->GetCodeTracer());
OFStream os(tracing_scope.file()); OFStream os(tracing_scope.file());
code->Disassemble(func_name.start(), os); code->Disassemble(func_name.start(), os);
...@@ -4850,8 +4858,9 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target, ...@@ -4850,8 +4858,9 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target,
return code; return code;
} }
Handle<Code> CompileWasmInterpreterEntry(Isolate* isolate, uint32_t func_index, MaybeHandle<Code> CompileWasmInterpreterEntry(Isolate* isolate,
wasm::FunctionSig* sig) { uint32_t func_index,
wasm::FunctionSig* sig) {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Create the Graph // Create the Graph
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -4872,49 +4881,49 @@ Handle<Code> CompileWasmInterpreterEntry(Isolate* isolate, uint32_t func_index, ...@@ -4872,49 +4881,49 @@ Handle<Code> CompileWasmInterpreterEntry(Isolate* isolate, uint32_t func_index,
builder.set_effect_ptr(&effect); builder.set_effect_ptr(&effect);
builder.BuildWasmInterpreterEntry(func_index); builder.BuildWasmInterpreterEntry(func_index);
Handle<Code> code = Handle<Code>::null(); // Schedule and compile to machine code.
{ CallDescriptor* incoming = GetWasmCallDescriptor(&zone, sig);
// Schedule and compile to machine code. if (machine.Is32()) {
CallDescriptor* incoming = GetWasmCallDescriptor(&zone, sig); incoming = GetI32WasmCallDescriptor(&zone, incoming);
if (machine.Is32()) { }
incoming = GetI32WasmCallDescriptor(&zone, incoming);
}
#ifdef DEBUG #ifdef DEBUG
EmbeddedVector<char, 32> func_name; EmbeddedVector<char, 32> func_name;
func_name.Truncate( func_name.Truncate(
SNPrintF(func_name, "wasm-interpreter-entry#%d", func_index)); SNPrintF(func_name, "wasm-interpreter-entry#%d", func_index));
#else #else
Vector<const char> func_name = CStrVector("wasm-interpreter-entry"); Vector<const char> func_name = CStrVector("wasm-interpreter-entry");
#endif #endif
OptimizedCompilationInfo info(func_name, &zone, OptimizedCompilationInfo info(func_name, &zone, Code::WASM_INTERPRETER_ENTRY);
Code::WASM_INTERPRETER_ENTRY);
if (info.trace_turbo_graph_enabled()) { // Simple textual RPO. if (info.trace_turbo_graph_enabled()) { // Simple textual RPO.
StdoutStream{} << "-- Wasm interpreter entry graph -- " << std::endl StdoutStream{} << "-- Wasm interpreter entry graph -- " << std::endl
<< AsRPO(graph); << AsRPO(graph);
} }
code = Pipeline::GenerateCodeForTesting(&info, isolate, incoming, &graph, MaybeHandle<Code> maybe_code = Pipeline::GenerateCodeForTesting(
nullptr); &info, isolate, incoming, &graph, nullptr);
Handle<Code> code;
if (!maybe_code.ToHandle(&code)) {
return maybe_code;
}
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code && !code.is_null()) { if (FLAG_print_opt_code) {
CodeTracer::Scope tracing_scope(isolate->GetCodeTracer()); CodeTracer::Scope tracing_scope(isolate->GetCodeTracer());
OFStream os(tracing_scope.file()); OFStream os(tracing_scope.file());
code->Disassemble(func_name.start(), os); code->Disassemble(func_name.start(), os);
} }
#endif #endif
if (must_record_function_compilation(isolate)) { if (must_record_function_compilation(isolate)) {
RecordFunctionCompilation(CodeEventListener::STUB_TAG, isolate, code, RecordFunctionCompilation(CodeEventListener::STUB_TAG, isolate, code,
"%.*s", func_name.length(), func_name.start()); "%.*s", func_name.length(), func_name.start());
}
} }
return code; return maybe_code;
} }
Handle<Code> CompileCWasmEntry(Isolate* isolate, wasm::FunctionSig* sig) { MaybeHandle<Code> CompileCWasmEntry(Isolate* isolate, wasm::FunctionSig* sig) {
Zone zone(isolate->allocator(), ZONE_NAME); Zone zone(isolate->allocator(), ZONE_NAME);
Graph graph(&zone); Graph graph(&zone);
CommonOperatorBuilder common(&zone); CommonOperatorBuilder common(&zone);
...@@ -4960,10 +4969,14 @@ Handle<Code> CompileCWasmEntry(Isolate* isolate, wasm::FunctionSig* sig) { ...@@ -4960,10 +4969,14 @@ Handle<Code> CompileCWasmEntry(Isolate* isolate, wasm::FunctionSig* sig) {
StdoutStream{} << "-- C Wasm entry graph -- " << std::endl << AsRPO(graph); StdoutStream{} << "-- C Wasm entry graph -- " << std::endl << AsRPO(graph);
} }
Handle<Code> code = MaybeHandle<Code> maybe_code =
Pipeline::GenerateCodeForTesting(&info, isolate, incoming, &graph); Pipeline::GenerateCodeForTesting(&info, isolate, incoming, &graph);
Handle<Code> code;
if (!maybe_code.ToHandle(&code)) {
return maybe_code;
}
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code && !code.is_null()) { if (FLAG_print_opt_code) {
CodeTracer::Scope tracing_scope(isolate->GetCodeTracer()); CodeTracer::Scope tracing_scope(isolate->GetCodeTracer());
OFStream os(tracing_scope.file()); OFStream os(tracing_scope.file());
code->Disassemble(debug_name, os); code->Disassemble(debug_name, os);
......
...@@ -107,21 +107,20 @@ class TurbofanWasmCompilationUnit { ...@@ -107,21 +107,20 @@ class TurbofanWasmCompilationUnit {
}; };
// Wraps a JS function, producing a code object that can be called from wasm. // Wraps a JS function, producing a code object that can be called from wasm.
Handle<Code> CompileWasmToJSWrapper(Isolate*, Handle<JSReceiver> target, MaybeHandle<Code> CompileWasmToJSWrapper(Isolate*, Handle<JSReceiver> target,
wasm::FunctionSig*, uint32_t index, wasm::FunctionSig*, uint32_t index,
wasm::ModuleOrigin, wasm::UseTrapHandler); wasm::ModuleOrigin,
wasm::UseTrapHandler);
// Wraps a given wasm code object, producing a code object. // Wraps a given wasm code object, producing a code object.
V8_EXPORT_PRIVATE Handle<Code> CompileJSToWasmWrapper(Isolate*, V8_EXPORT_PRIVATE MaybeHandle<Code> CompileJSToWasmWrapper(
wasm::WasmModule*, Isolate*, wasm::WasmModule*, Address call_target, uint32_t index,
Address call_target, wasm::UseTrapHandler);
uint32_t index,
wasm::UseTrapHandler);
// Compiles a stub that redirects a call to a wasm function to the wasm // Compiles a stub that redirects a call to a wasm function to the wasm
// interpreter. It's ABI compatible with the compiled wasm function. // interpreter. It's ABI compatible with the compiled wasm function.
Handle<Code> CompileWasmInterpreterEntry(Isolate*, uint32_t func_index, MaybeHandle<Code> CompileWasmInterpreterEntry(Isolate*, uint32_t func_index,
wasm::FunctionSig*); wasm::FunctionSig*);
// Helper function to get the offset into a fixed array for a given {index}. // Helper function to get the offset into a fixed array for a given {index}.
// TODO(titzer): access-builder.h is not accessible outside compiler. Move? // TODO(titzer): access-builder.h is not accessible outside compiler. Move?
...@@ -138,7 +137,7 @@ enum CWasmEntryParameters { ...@@ -138,7 +137,7 @@ enum CWasmEntryParameters {
// Compiles a stub with JS linkage, taking parameters as described by // Compiles a stub with JS linkage, taking parameters as described by
// {CWasmEntryParameters}. It loads the wasm parameters from the argument // {CWasmEntryParameters}. It loads the wasm parameters from the argument
// buffer and calls the wasm function given as first parameter. // buffer and calls the wasm function given as first parameter.
Handle<Code> CompileCWasmEntry(Isolate* isolate, wasm::FunctionSig* sig); MaybeHandle<Code> CompileCWasmEntry(Isolate* isolate, wasm::FunctionSig* sig);
// Values from the instance object are cached between WASM-level function calls. // Values from the instance object are cached between WASM-level function calls.
// This struct allows the SSA environment handling this cache to be defined // This struct allows the SSA environment handling this cache to be defined
......
...@@ -216,8 +216,10 @@ class JSToWasmWrapperCache { ...@@ -216,8 +216,10 @@ class JSToWasmWrapperCache {
} }
} }
Handle<Code> code = compiler::CompileJSToWasmWrapper( Handle<Code> code =
isolate, module, call_target, index, use_trap_handler); compiler::CompileJSToWasmWrapper(isolate, module, call_target, index,
use_trap_handler)
.ToHandleChecked();
if (!is_import) { if (!is_import) {
uint32_t new_cache_idx = sig_map_.FindOrInsert(func->sig); uint32_t new_cache_idx = sig_map_.FindOrInsert(func->sig);
DCHECK_EQ(code_cache_.size(), new_cache_idx); DCHECK_EQ(code_cache_.size(), new_cache_idx);
...@@ -2163,9 +2165,11 @@ int InstanceBuilder::ProcessImports(Handle<WasmInstanceObject> instance) { ...@@ -2163,9 +2165,11 @@ int InstanceBuilder::ProcessImports(Handle<WasmInstanceObject> instance) {
} else { } else {
// The imported function is a callable. // The imported function is a callable.
Handle<JSReceiver> js_receiver(JSReceiver::cast(*value), isolate_); Handle<JSReceiver> js_receiver(JSReceiver::cast(*value), isolate_);
Handle<Code> wrapper_code = compiler::CompileWasmToJSWrapper( Handle<Code> wrapper_code =
isolate_, js_receiver, expected_sig, func_index, module_->origin, compiler::CompileWasmToJSWrapper(
use_trap_handler()); isolate_, js_receiver, expected_sig, func_index,
module_->origin, use_trap_handler())
.ToHandleChecked();
RecordStats(*wrapper_code, counters()); RecordStats(*wrapper_code, counters());
WasmCode* wasm_code = native_module->AddCodeCopy( WasmCode* wasm_code = native_module->AddCodeCopy(
......
...@@ -676,10 +676,10 @@ void WasmDebugInfo::RedirectToInterpreter(Handle<WasmDebugInfo> debug_info, ...@@ -676,10 +676,10 @@ void WasmDebugInfo::RedirectToInterpreter(Handle<WasmDebugInfo> debug_info,
DCHECK_GT(module->functions.size(), func_index); DCHECK_GT(module->functions.size(), func_index);
if (!interpreted_functions->get(func_index)->IsUndefined(isolate)) continue; if (!interpreted_functions->get(func_index)->IsUndefined(isolate)) continue;
Handle<Code> new_code = compiler::CompileWasmInterpreterEntry( MaybeHandle<Code> new_code = compiler::CompileWasmInterpreterEntry(
isolate, func_index, module->functions[func_index].sig); isolate, func_index, module->functions[func_index].sig);
const wasm::WasmCode* wasm_new_code = const wasm::WasmCode* wasm_new_code = native_module->AddInterpreterEntry(
native_module->AddInterpreterEntry(new_code, func_index); new_code.ToHandleChecked(), func_index);
const wasm::WasmCode* old_code = const wasm::WasmCode* old_code =
native_module->code(static_cast<uint32_t>(func_index)); native_module->code(static_cast<uint32_t>(func_index));
Handle<Foreign> foreign_holder = isolate->factory()->NewForeign( Handle<Foreign> foreign_holder = isolate->factory()->NewForeign(
...@@ -770,7 +770,8 @@ Handle<JSFunction> WasmDebugInfo::GetCWasmEntry( ...@@ -770,7 +770,8 @@ Handle<JSFunction> WasmDebugInfo::GetCWasmEntry(
debug_info->set_c_wasm_entries(*entries); debug_info->set_c_wasm_entries(*entries);
} }
DCHECK(entries->get(index)->IsUndefined(isolate)); DCHECK(entries->get(index)->IsUndefined(isolate));
Handle<Code> new_entry_code = compiler::CompileCWasmEntry(isolate, sig); Handle<Code> new_entry_code =
compiler::CompileCWasmEntry(isolate, sig).ToHandleChecked();
Handle<WasmExportedFunctionData> function_data = Handle<WasmExportedFunctionData> function_data =
Handle<WasmExportedFunctionData>::cast(isolate->factory()->NewStruct( Handle<WasmExportedFunctionData>::cast(isolate->factory()->NewStruct(
WASM_EXPORTED_FUNCTION_DATA_TYPE, TENURED)); WASM_EXPORTED_FUNCTION_DATA_TYPE, TENURED));
......
...@@ -150,8 +150,8 @@ Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) { ...@@ -150,8 +150,8 @@ Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
CHECK(info.shared_info()->HasBytecodeArray()); CHECK(info.shared_info()->HasBytecodeArray());
JSFunction::EnsureFeedbackVector(function); JSFunction::EnsureFeedbackVector(function);
Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, isolate); Handle<Code> code =
CHECK(!code.is_null()); Pipeline::GenerateCodeForTesting(&info, isolate).ToHandleChecked();
info.dependencies()->Commit(code); info.dependencies()->Commit(code);
info.context()->native_context()->AddOptimizedCode(*code); info.context()->native_context()->AddOptimizedCode(*code);
function->set_code(*code); function->set_code(*code);
...@@ -165,8 +165,8 @@ Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) { ...@@ -165,8 +165,8 @@ Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) {
Zone zone(isolate->allocator(), ZONE_NAME); Zone zone(isolate->allocator(), ZONE_NAME);
OptimizedCompilationInfo info(&zone, isolate, shared, function); OptimizedCompilationInfo info(&zone, isolate, shared, function);
Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, isolate, graph); Handle<Code> code =
CHECK(!code.is_null()); Pipeline::GenerateCodeForTesting(&info, isolate, graph).ToHandleChecked();
function->set_code(*code); function->set_code(*code);
return function; return function;
} }
......
...@@ -1106,7 +1106,7 @@ class CodeGeneratorTester { ...@@ -1106,7 +1106,7 @@ class CodeGeneratorTester {
generator_->FinishCode(); generator_->FinishCode();
generator_->safepoints()->Emit(generator_->tasm(), generator_->safepoints()->Emit(generator_->tasm(),
frame_.GetTotalFrameSlotCount()); frame_.GetTotalFrameSlotCount());
return generator_->FinalizeCode(); return generator_->FinalizeCode().ToHandleChecked();
} }
Handle<Code> FinalizeForExecuting() { Handle<Code> FinalizeForExecuting() {
......
...@@ -163,8 +163,10 @@ void TestReturnMultipleValues(MachineType type) { ...@@ -163,8 +163,10 @@ void TestReturnMultipleValues(MachineType type) {
OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(), OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(),
Code::WASM_FUNCTION); Code::WASM_FUNCTION);
Handle<Code> code = Pipeline::GenerateCodeForTesting( Handle<Code> code =
&info, handles.main_isolate(), desc, m.graph(), m.Export()); Pipeline::GenerateCodeForTesting(&info, handles.main_isolate(), desc,
m.graph(), m.Export())
.ToHandleChecked();
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
if (FLAG_print_code) { if (FLAG_print_code) {
StdoutStream os; StdoutStream os;
...@@ -256,8 +258,10 @@ void ReturnLastValue(MachineType type) { ...@@ -256,8 +258,10 @@ void ReturnLastValue(MachineType type) {
OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(), OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(),
Code::WASM_FUNCTION); Code::WASM_FUNCTION);
Handle<Code> code = Pipeline::GenerateCodeForTesting( Handle<Code> code =
&info, handles.main_isolate(), desc, m.graph(), m.Export()); Pipeline::GenerateCodeForTesting(&info, handles.main_isolate(), desc,
m.graph(), m.Export())
.ToHandleChecked();
std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule( std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule(
handles.main_isolate(), code->raw_instruction_size()); handles.main_isolate(), code->raw_instruction_size());
...@@ -316,8 +320,10 @@ void ReturnSumOfReturns(MachineType type) { ...@@ -316,8 +320,10 @@ void ReturnSumOfReturns(MachineType type) {
OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(), OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(),
Code::WASM_FUNCTION); Code::WASM_FUNCTION);
Handle<Code> code = Pipeline::GenerateCodeForTesting( Handle<Code> code =
&info, handles.main_isolate(), desc, m.graph(), m.Export()); Pipeline::GenerateCodeForTesting(&info, handles.main_isolate(), desc,
m.graph(), m.Export())
.ToHandleChecked();
std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule( std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule(
handles.main_isolate(), code->raw_instruction_size()); handles.main_isolate(), code->raw_instruction_size());
......
...@@ -128,7 +128,8 @@ class BytecodeGraphTester { ...@@ -128,7 +128,8 @@ class BytecodeGraphTester {
compilation_info.ReopenHandlesInNewHandleScope(); compilation_info.ReopenHandlesInNewHandleScope();
Handle<Code> code = Handle<Code> code =
Pipeline::GenerateCodeForTesting(&compilation_info, isolate_); Pipeline::GenerateCodeForTesting(&compilation_info, isolate_)
.ToHandleChecked();
function->set_code(*code); function->set_code(*code);
return function; return function;
......
...@@ -258,8 +258,8 @@ Handle<Code> CompileGraph(const char* name, CallDescriptor* call_descriptor, ...@@ -258,8 +258,8 @@ Handle<Code> CompileGraph(const char* name, CallDescriptor* call_descriptor,
OptimizedCompilationInfo info(ArrayVector("testing"), graph->zone(), OptimizedCompilationInfo info(ArrayVector("testing"), graph->zone(),
Code::STUB); Code::STUB);
Handle<Code> code = Pipeline::GenerateCodeForTesting( Handle<Code> code = Pipeline::GenerateCodeForTesting(
&info, isolate, call_descriptor, graph, schedule); &info, isolate, call_descriptor, graph, schedule)
CHECK(!code.is_null()); .ToHandleChecked();
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code) { if (FLAG_print_opt_code) {
StdoutStream os; StdoutStream os;
......
...@@ -42,7 +42,7 @@ TestingModuleBuilder::TestingModuleBuilder( ...@@ -42,7 +42,7 @@ TestingModuleBuilder::TestingModuleBuilder(
if (maybe_import) { if (maybe_import) {
// Manually compile a wasm to JS wrapper and insert it into the instance. // Manually compile a wasm to JS wrapper and insert it into the instance.
CodeSpaceMemoryModificationScope modification_scope(isolate_->heap()); CodeSpaceMemoryModificationScope modification_scope(isolate_->heap());
Handle<Code> code = compiler::CompileWasmToJSWrapper( MaybeHandle<Code> code = compiler::CompileWasmToJSWrapper(
isolate_, maybe_import->js_function, maybe_import->sig, isolate_, maybe_import->js_function, maybe_import->sig,
maybe_import_index, test_module_->origin, maybe_import_index, test_module_->origin,
trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler
...@@ -51,7 +51,8 @@ TestingModuleBuilder::TestingModuleBuilder( ...@@ -51,7 +51,8 @@ TestingModuleBuilder::TestingModuleBuilder(
native_module_->SetNumFunctionsForTesting(maybe_import_index + 1); native_module_->SetNumFunctionsForTesting(maybe_import_index + 1);
} }
auto wasm_to_js_wrapper = native_module_->AddCodeCopy( auto wasm_to_js_wrapper = native_module_->AddCodeCopy(
code, wasm::WasmCode::kWasmToJsWrapper, maybe_import_index); code.ToHandleChecked(), wasm::WasmCode::kWasmToJsWrapper,
maybe_import_index);
ImportedFunctionEntry(instance_object_, maybe_import_index) ImportedFunctionEntry(instance_object_, maybe_import_index)
.set_wasm_to_js(*maybe_import->js_function, wasm_to_js_wrapper); .set_wasm_to_js(*maybe_import->js_function, wasm_to_js_wrapper);
...@@ -119,9 +120,10 @@ Handle<JSFunction> TestingModuleBuilder::WrapCode(uint32_t index) { ...@@ -119,9 +120,10 @@ Handle<JSFunction> TestingModuleBuilder::WrapCode(uint32_t index) {
// Wrap the code so it can be called as a JS function. // Wrap the code so it can be called as a JS function.
Link(); Link();
wasm::WasmCode* code = native_module_->code(index); wasm::WasmCode* code = native_module_->code(index);
Handle<Code> ret_code = compiler::CompileJSToWasmWrapper( MaybeHandle<Code> maybe_ret_code = compiler::CompileJSToWasmWrapper(
isolate_, test_module_ptr_, code->instruction_start(), index, isolate_, test_module_ptr_, code->instruction_start(), index,
trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler : kNoTrapHandler); trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler : kNoTrapHandler);
Handle<Code> ret_code = maybe_ret_code.ToHandleChecked();
Handle<JSFunction> ret = WasmExportedFunction::New( Handle<JSFunction> ret = WasmExportedFunction::New(
isolate_, instance_object(), MaybeHandle<String>(), isolate_, instance_object(), MaybeHandle<String>(),
static_cast<int>(index), static_cast<int>(index),
...@@ -339,7 +341,8 @@ void WasmFunctionWrapper::Init(CallDescriptor* call_descriptor, ...@@ -339,7 +341,8 @@ void WasmFunctionWrapper::Init(CallDescriptor* call_descriptor,
} }
Handle<Code> WasmFunctionWrapper::GetWrapperCode() { Handle<Code> WasmFunctionWrapper::GetWrapperCode() {
if (code_.is_null()) { Handle<Code> code;
if (!code_.ToHandle(&code)) {
Isolate* isolate = CcTest::InitIsolateOnce(); Isolate* isolate = CcTest::InitIsolateOnce();
auto call_descriptor = auto call_descriptor =
...@@ -364,18 +367,18 @@ Handle<Code> WasmFunctionWrapper::GetWrapperCode() { ...@@ -364,18 +367,18 @@ Handle<Code> WasmFunctionWrapper::GetWrapperCode() {
Code::C_WASM_ENTRY); Code::C_WASM_ENTRY);
code_ = compiler::Pipeline::GenerateCodeForTesting( code_ = compiler::Pipeline::GenerateCodeForTesting(
&info, isolate, call_descriptor, graph(), nullptr); &info, isolate, call_descriptor, graph(), nullptr);
CHECK(!code_.is_null()); code = code_.ToHandleChecked();
#ifdef ENABLE_DISASSEMBLER #ifdef ENABLE_DISASSEMBLER
if (FLAG_print_opt_code) { if (FLAG_print_opt_code) {
CodeTracer::Scope tracing_scope(isolate->GetCodeTracer()); CodeTracer::Scope tracing_scope(isolate->GetCodeTracer());
OFStream os(tracing_scope.file()); OFStream os(tracing_scope.file());
code_->Disassemble("wasm wrapper", os); code->Disassemble("wasm wrapper", os);
} }
#endif #endif
} }
return code_; return code;
} }
void WasmFunctionCompiler::Build(const byte* start, const byte* end) { void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
......
...@@ -299,7 +299,7 @@ class WasmFunctionWrapper : private compiler::GraphAndBuilders { ...@@ -299,7 +299,7 @@ class WasmFunctionWrapper : private compiler::GraphAndBuilders {
private: private:
Node* inner_code_node_; Node* inner_code_node_;
Node* context_address_; Node* context_address_;
Handle<Code> code_; MaybeHandle<Code> code_;
Signature<MachineType>* signature_; Signature<MachineType>* signature_;
}; };
......
...@@ -256,8 +256,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ...@@ -256,8 +256,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
OptimizedCompilationInfo info(ArrayVector("testing"), &zone, OptimizedCompilationInfo info(ArrayVector("testing"), &zone,
Code::WASM_FUNCTION); Code::WASM_FUNCTION);
Handle<Code> code = Pipeline::GenerateCodeForTesting( Handle<Code> code =
&info, i_isolate, desc, callee.graph(), callee.Export()); Pipeline::GenerateCodeForTesting(&info, i_isolate, desc, callee.graph(),
callee.Export())
.ToHandleChecked();
std::unique_ptr<wasm::NativeModule> module = std::unique_ptr<wasm::NativeModule> module =
AllocateNativeModule(i_isolate, code->raw_instruction_size()); AllocateNativeModule(i_isolate, code->raw_instruction_size());
...@@ -300,8 +302,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { ...@@ -300,8 +302,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Call the wrapper. // Call the wrapper.
OptimizedCompilationInfo wrapper_info(ArrayVector("wrapper"), &zone, OptimizedCompilationInfo wrapper_info(ArrayVector("wrapper"), &zone,
Code::STUB); Code::STUB);
Handle<Code> wrapper_code = Pipeline::GenerateCodeForTesting( Handle<Code> wrapper_code =
&wrapper_info, i_isolate, wrapper_desc, caller.graph(), caller.Export()); Pipeline::GenerateCodeForTesting(&wrapper_info, i_isolate, wrapper_desc,
caller.graph(), caller.Export())
.ToHandleChecked();
auto fn = GeneratedCode<int32_t>::FromCode(*wrapper_code); auto fn = GeneratedCode<int32_t>::FromCode(*wrapper_code);
int result = fn.Call(); int result = fn.Call();
......
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