[wasm][cleanup] CompileCWasmEntry should never fail
This changes the return type of {CompileCWasmEntry} from a {MaybeHandle} to {Handle}. All call sites used {ToHandleChecked} anyway, and if compiling a c-wasm-entry failed, something seriously went wrong. Hence fail immediately during compilation, instead of returning an empty handle and then failing later. R=jkummerow@chromium.org Change-Id: I19d85e907670c92da74c9a7ab2d9b646682a02cd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2237133 Commit-Queue: Clemens Backes <clemensb@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#68279}
This commit is contained in:
parent
e51ad7e339
commit
e33c15f6bd
@ -6790,8 +6790,7 @@ MaybeHandle<Code> CompileJSToJSWrapper(Isolate* isolate,
|
||||
return code;
|
||||
}
|
||||
|
||||
MaybeHandle<Code> CompileCWasmEntry(Isolate* isolate,
|
||||
const wasm::FunctionSig* sig) {
|
||||
Handle<Code> CompileCWasmEntry(Isolate* isolate, const wasm::FunctionSig* sig) {
|
||||
std::unique_ptr<Zone> zone =
|
||||
std::make_unique<Zone>(isolate->allocator(), ZONE_NAME);
|
||||
Graph* graph = new (zone.get()) Graph(zone.get());
|
||||
@ -6836,14 +6835,11 @@ MaybeHandle<Code> CompileCWasmEntry(Isolate* isolate,
|
||||
Code::C_WASM_ENTRY, std::move(name_buffer),
|
||||
AssemblerOptions::Default(isolate)));
|
||||
|
||||
if (job->ExecuteJob(isolate->counters()->runtime_call_stats()) ==
|
||||
CompilationJob::FAILED ||
|
||||
job->FinalizeJob(isolate) == CompilationJob::FAILED) {
|
||||
return {};
|
||||
}
|
||||
Handle<Code> code = job->compilation_info()->code();
|
||||
CHECK_NE(job->ExecuteJob(isolate->counters()->runtime_call_stats()),
|
||||
CompilationJob::FAILED);
|
||||
CHECK_NE(job->FinalizeJob(isolate), CompilationJob::FAILED);
|
||||
|
||||
return code;
|
||||
return job->compilation_info()->code();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -138,8 +138,8 @@ enum CWasmEntryParameters {
|
||||
|
||||
// Compiles a stub with C++ linkage, to be called from Execution::CallWasm,
|
||||
// which knows how to feed it its parameters.
|
||||
V8_EXPORT_PRIVATE MaybeHandle<Code> CompileCWasmEntry(Isolate*,
|
||||
const wasm::FunctionSig*);
|
||||
V8_EXPORT_PRIVATE Handle<Code> CompileCWasmEntry(Isolate*,
|
||||
const wasm::FunctionSig*);
|
||||
|
||||
// Values from the instance object are cached between Wasm-level function calls.
|
||||
// This struct allows the SSA environment handling this cache to be defined
|
||||
|
@ -1375,7 +1375,7 @@ void PrepareFunctionData(i::Isolate* isolate,
|
||||
if (!function_data->c_wrapper_code().IsSmi()) return;
|
||||
// Compile wrapper code.
|
||||
i::Handle<i::Code> wrapper_code =
|
||||
i::compiler::CompileCWasmEntry(isolate, sig).ToHandleChecked();
|
||||
i::compiler::CompileCWasmEntry(isolate, sig);
|
||||
function_data->set_c_wrapper_code(*wrapper_code);
|
||||
// Compute packed args size.
|
||||
function_data->set_packed_args_size(
|
||||
|
@ -353,8 +353,7 @@ Maybe<std::string> DebugEvaluateImpl(
|
||||
|
||||
// TODO(wasm): Cache this code.
|
||||
Handle<Code> wasm_entry =
|
||||
compiler::CompileCWasmEntry(isolate, entry_point->sig())
|
||||
.ToHandleChecked();
|
||||
compiler::CompileCWasmEntry(isolate, entry_point->sig());
|
||||
|
||||
CWasmArgumentsPacker packer(4 /* uint32_t return value, no parameters. */);
|
||||
Execution::CallWasm(isolate, wasm_entry, entry_point->GetWasmCallTarget(),
|
||||
|
@ -40,8 +40,7 @@ class CWasmEntryArgTester {
|
||||
runner_.Build(code.data(), code.data() + code.size());
|
||||
wasm_code_ = runner_.builder().GetFunctionCode(0);
|
||||
Handle<WasmInstanceObject> instance(runner_.builder().instance_object());
|
||||
c_wasm_entry_ =
|
||||
compiler::CompileCWasmEntry(isolate_, sig_).ToHandleChecked();
|
||||
c_wasm_entry_ = compiler::CompileCWasmEntry(isolate_, sig_);
|
||||
}
|
||||
|
||||
template <typename... Rest>
|
||||
|
Loading…
Reference in New Issue
Block a user