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

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

Issue 2571813002: [wasm] TrapIf and TrapUnless TurboFan operators implemented on ia32. (Closed)
Patch Set: Move TrapReasonToFunctionId from wasm-opcodes to wasm-compiler Created 4 years 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/ia32/instruction-selector-ia32.cc ('k') | src/wasm/wasm-opcodes.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 35d94ba04bee1d5d4b96fdbf61f931b477a15a7b..5cf64f0bcbf17d2f1701d786b863b29b8e5ee60a 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -168,20 +168,27 @@ class WasmTrapHelper : public ZoneObject {
return TrapIfEq64(reason, node, 0, position);
}
- int32_t GetFunctionIdForTrap(wasm::TrapReason reason) {
- int32_t trap_id;
+ Runtime::FunctionId GetFunctionIdForTrap(wasm::TrapReason reason) {
if (builder_->module_ && !builder_->module_->instance->context.is_null()) {
- trap_id = wasm::WasmOpcodes::TrapReasonToFunctionId(reason);
+ switch (reason) {
+#define TRAPREASON_TO_MESSAGE(name) \
+ case wasm::k##name: \
+ return Runtime::kThrowWasm##name;
+ FOREACH_WASM_TRAPREASON(TRAPREASON_TO_MESSAGE)
+#undef TRAPREASON_TO_MESSAGE
+ default:
+ UNREACHABLE();
+ return Runtime::kNumFunctions;
+ }
} else {
// We use Runtime::kNumFunctions as a marker to tell the code generator
// to generate a call to a testing c-function instead of a runtime
// function. This code should only be called from a cctest.
- trap_id = Runtime::kNumFunctions;
+ return Runtime::kNumFunctions;
}
- return trap_id;
}
-#if V8_TARGET_ARCH_X64
+#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
#define WASM_TRAP_IF_SUPPORTED
#endif
@@ -197,7 +204,7 @@ class WasmTrapHelper : public ZoneObject {
builder_->SetSourcePosition(node, position);
return;
}
-#endif // V8_TARGET_ARCH_X64
+#endif // WASM_TRAP_IF_SUPPORTED
BuildTrapIf(reason, cond, true, position);
}
@@ -214,7 +221,7 @@ class WasmTrapHelper : public ZoneObject {
builder_->SetSourcePosition(node, position);
return;
}
-#endif // V8_TARGET_ARCH_X64
+#endif // WASM_TRAP_IF_SUPPORTED
BuildTrapIf(reason, cond, false, position);
}
« no previous file with comments | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | src/wasm/wasm-opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698