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

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

Issue 2339053003: [V8][Wasm] Wasm throws. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addresses comments. Created 4 years, 3 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 f9620ac34939f6de8b4464b4b72920a2def7bdef..6c50183beeadd533a25f44d1196b153b8cfe5534 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -1703,6 +1703,29 @@ Node* WasmGraphBuilder::GrowMemory(Node* input) {
return result;
}
+Node* WasmGraphBuilder::Throw(Node* input) {
+ MachineOperatorBuilder* machine = jsgraph()->machine();
+
+ // Pass the thrown value as two SMIs:
+ //
+ // upper = static_cast<uint32_t>(input) >> 16;
+ // lower = input & 0xFFFF;
+ //
+ // This is needed because we can't safely call BuildChangeInt32ToTagged from
+ // this method.
+ //
+ // TODO(wasm): figure out how to properly pass this to the runtime function.
+ Node* upper = BuildChangeInt32ToSmi(
+ graph()->NewNode(machine->Word32Shr(), input, Int32Constant(16)));
+ Node* lower = BuildChangeInt32ToSmi(
+ graph()->NewNode(machine->Word32And(), input, Int32Constant(0xFFFFu)));
+
+ Node* parameters[] = {lower, upper}; // thrown value
+ return BuildCallToRuntime(Runtime::kWasmThrow, jsgraph(),
+ module_->instance->context, parameters,
+ arraysize(parameters), effect_, *control_);
+}
+
Node* WasmGraphBuilder::BuildI32DivS(Node* left, Node* right,
wasm::WasmCodePosition position) {
MachineOperatorBuilder* m = jsgraph()->machine();
« 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