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

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

Issue 2383613002: Revert of [WASM] Implements catch for the wasm low level exception mechanism. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/frames.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 cca472fb5606002c99c55962dd9a20da45eb0ef4..7837a64c9012562ece864f6e8810a07af6386e30 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -335,19 +335,6 @@
bool WasmGraphBuilder::IsPhiWithMerge(Node* phi, Node* merge) {
return phi && IrOpcode::IsPhiOpcode(phi->opcode()) &&
NodeProperties::GetControlInput(phi) == merge;
-}
-
-bool WasmGraphBuilder::ThrowsException(Node* node, Node** if_success,
- Node** if_exception) {
- if (node->op()->HasProperty(compiler::Operator::kNoThrow)) {
- return false;
- }
-
- *if_success = graph()->NewNode(jsgraph()->common()->IfSuccess(), node);
- *if_exception =
- graph()->NewNode(jsgraph()->common()->IfException(), node, node);
-
- return true;
}
void WasmGraphBuilder::AppendToMerge(Node* merge, Node* from) {
@@ -1737,43 +1724,6 @@
arraysize(parameters), effect_, *control_);
}
-Node* WasmGraphBuilder::Catch(Node* input, wasm::WasmCodePosition position) {
- CommonOperatorBuilder* common = jsgraph()->common();
-
- Node* parameters[] = {input}; // caught value
- Node* value =
- BuildCallToRuntime(Runtime::kWasmGetCaughtExceptionValue, jsgraph(),
- module_->instance->context, parameters,
- arraysize(parameters), effect_, *control_);
-
- Node* is_smi;
- Node* is_heap;
- Branch(BuildTestNotSmi(value), &is_heap, &is_smi);
-
- // is_heap
- Node* heap_f64 = BuildLoadHeapNumberValue(value, is_heap);
- // *control_ needs to point to the current control dependency (is_heap) in
- // case BuildI32SConvertF64 needs to insert nodes that depend on the "current"
- // control node.
- *control_ = is_heap;
- Node* heap_i32 = BuildI32SConvertF64(heap_f64, position);
- // *control_ contains the control node that should be used when merging the
- // result for the catch clause. It may be different than *control_ because
- // BuildI32SConvertF64 may introduce a new control node (used for trapping if
- // heap_f64 cannot be converted to an i32.
- is_heap = *control_;
-
- // is_smi
- Node* smi_i32 = BuildChangeSmiToInt32(value);
-
- Node* merge = graph()->NewNode(common->Merge(2), is_heap, is_smi);
- Node* value_i32 = graph()->NewNode(
- common->Phi(MachineRepresentation::kWord32, 2), heap_i32, smi_i32, merge);
-
- *control_ = merge;
- return value_i32;
-}
-
Node* WasmGraphBuilder::BuildI32DivS(Node* left, Node* right,
wasm::WasmCodePosition position) {
MachineOperatorBuilder* m = jsgraph()->machine();
@@ -2042,9 +1992,8 @@
return call;
}
-Node* WasmGraphBuilder::BuildWasmCall(wasm::FunctionSig* sig, Node** args,
- Node*** rets,
- wasm::WasmCodePosition position) {
+Node** WasmGraphBuilder::BuildWasmCall(wasm::FunctionSig* sig, Node** args,
+ wasm::WasmCodePosition position) {
const size_t params = sig->parameter_count();
const size_t extra = 2; // effect and control inputs.
const size_t count = 1 + params + extra;
@@ -2064,24 +2013,24 @@
*effect_ = call;
size_t ret_count = sig->return_count();
- if (ret_count == 0) return call; // No return value.
-
- *rets = Buffer(ret_count);
+ if (ret_count == 0) return nullptr; // No return value.
+
+ Node** rets = Buffer(ret_count);
if (ret_count == 1) {
// Only a single return value.
- (*rets)[0] = call;
+ rets[0] = call;
} else {
// Create projections for all return values.
for (size_t i = 0; i < ret_count; i++) {
- (*rets)[i] = graph()->NewNode(jsgraph()->common()->Projection(i), call,
- graph()->start());
- }
- }
- return call;
-}
-
-Node* WasmGraphBuilder::CallDirect(uint32_t index, Node** args, Node*** rets,
- wasm::WasmCodePosition position) {
+ rets[i] = graph()->NewNode(jsgraph()->common()->Projection(i), call,
+ graph()->start());
+ }
+ }
+ return rets;
+}
+
+Node** WasmGraphBuilder::CallDirect(uint32_t index, Node** args,
+ wasm::WasmCodePosition position) {
DCHECK_NULL(args[0]);
// Add code object as constant.
@@ -2090,11 +2039,11 @@
args[0] = HeapConstant(code);
wasm::FunctionSig* sig = module_->GetFunctionSignature(index);
- return BuildWasmCall(sig, args, rets, position);
-}
-
-Node* WasmGraphBuilder::CallIndirect(uint32_t index, Node** args, Node*** rets,
- wasm::WasmCodePosition position) {
+ return BuildWasmCall(sig, args, position);
+}
+
+Node** WasmGraphBuilder::CallIndirect(uint32_t index, Node** args,
+ wasm::WasmCodePosition position) {
DCHECK_NOT_NULL(args[0]);
DCHECK(module_ && module_->instance);
@@ -2117,11 +2066,11 @@
} else {
// No function table. Generate a trap and return a constant.
trap_->AddTrapIfFalse(wasm::kTrapFuncInvalid, Int32Constant(0), position);
- (*rets) = Buffer(sig->return_count());
+ Node** rets = Buffer(sig->return_count());
for (size_t i = 0; i < sig->return_count(); i++) {
- (*rets)[i] = trap_->GetTrapValue(sig->GetReturn(i));
- }
- return trap_->GetTrapValue(sig);
+ rets[i] = trap_->GetTrapValue(sig->GetReturn(i));
+ }
+ return rets;
}
Node* table = FunctionTable(0);
@@ -2155,7 +2104,7 @@
*effect_, *control_);
args[0] = load_code;
- return BuildWasmCall(sig, args, rets, position);
+ return BuildWasmCall(sig, args, position);
}
Node* WasmGraphBuilder::BuildI32Rol(Node* left, Node* right) {
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698