Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: src/compiler/wasm-compiler.cc

Issue 1874383002: [wasm] Throw real Error on wasm trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@trapreasons-to-messages
Patch Set: remove a TODO Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index fd697f717cc38e2e6a24d6fa199578d97f63460c..4129a36ee45ba91c6b2dd7d3424bd8587987b29e 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -193,12 +193,13 @@ class WasmTrapHelper : public ZoneObject {
}
void BuildTrapCode(wasm::TrapReason reason) {
- Node* exception =
- builder_->String(wasm::WasmOpcodes::TrapReasonMessage(reason));
+ Node* message_id = builder_->NumberConstant(
+ wasm::WasmOpcodes::TrapReasonToMessageId(reason));
Node* end;
Node** control_ptr = builder_->control_;
Node** effect_ptr = builder_->effect_;
wasm::ModuleEnv* module = builder_->module_;
+ DCHECK(traps_[reason] == NULL);
*control_ptr = traps_[reason] =
graph()->NewNode(common()->Merge(1), *control_ptr);
*effect_ptr = effects_[reason] =
@@ -206,14 +207,14 @@ class WasmTrapHelper : public ZoneObject {
if (module && !module->instance->context.is_null()) {
// Use the module context to call the runtime to throw an exception.
- Runtime::FunctionId f = Runtime::kThrow;
+ Runtime::FunctionId f = Runtime::kThrowWasmError;
const Runtime::Function* fun = Runtime::FunctionForId(f);
CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(
jsgraph()->zone(), f, fun->nargs, Operator::kNoProperties,
CallDescriptor::kNoFlags);
Node* inputs[] = {
jsgraph()->CEntryStubConstant(fun->result_size), // C entry
- exception, // exception
+ message_id, // message id
jsgraph()->ExternalConstant(
ExternalReference(f, jsgraph()->isolate())), // ref
jsgraph()->Int32Constant(fun->nargs), // arity
@@ -344,6 +345,9 @@ Node* WasmGraphBuilder::EffectPhi(unsigned count, Node** effects,
buf);
}
+Node* WasmGraphBuilder::NumberConstant(int32_t value) {
+ return jsgraph()->Constant(value);
+}
Node* WasmGraphBuilder::Int32Constant(int32_t value) {
return jsgraph()->Int32Constant(value);
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698