diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc index 8e48448d63..d651f86fc5 100644 --- a/src/compiler/wasm-compiler.cc +++ b/src/compiler/wasm-compiler.cc @@ -2258,13 +2258,14 @@ Node* WasmGraphBuilder::GetExceptionTag(Node* except_obj) { return BuildCallToRuntime(Runtime::kWasmExceptionGetTag, &except_obj, 1); } -Vector WasmGraphBuilder::GetExceptionValues( - Node* except_obj, const wasm::WasmException* exception) { +Node* WasmGraphBuilder::GetExceptionValues(Node* except_obj, + const wasm::WasmException* exception, + Vector values) { Node* values_array = BuildCallToRuntime(Runtime::kWasmExceptionGetValues, &except_obj, 1); uint32_t index = 0; const wasm::WasmExceptionSig* sig = exception->sig; - Vector values = Buffer(sig->parameter_count()); + DCHECK_EQ(sig->parameter_count(), values.size()); for (size_t i = 0; i < sig->parameter_count(); ++i) { Node* value; switch (sig->GetParam(i)) { @@ -2310,7 +2311,7 @@ Vector WasmGraphBuilder::GetExceptionValues( values[i] = value; } DCHECK_EQ(index, WasmExceptionPackage::GetEncodedSize(exception)); - return values; + return values_array; } Node* WasmGraphBuilder::BuildI32DivS(Node* left, Node* right, diff --git a/src/compiler/wasm-compiler.h b/src/compiler/wasm-compiler.h index 039799b7ca..debdb7c147 100644 --- a/src/compiler/wasm-compiler.h +++ b/src/compiler/wasm-compiler.h @@ -223,8 +223,9 @@ class WasmGraphBuilder { Node* ExceptionTagEqual(Node* caught_tag, Node* expected_tag); Node* LoadExceptionTagFromTable(uint32_t exception_index); Node* GetExceptionTag(Node* except_obj); - Vector GetExceptionValues(Node* except_obj, - const wasm::WasmException* exception); + Node* GetExceptionValues(Node* except_obj, + const wasm::WasmException* exception, + Vector values_out); bool IsPhiWithMerge(Node* phi, Node* merge); bool ThrowsException(Node* node, Node** if_success, Node** if_exception); void AppendToMerge(Node* merge, Node* from); diff --git a/src/wasm/graph-builder-interface.cc b/src/wasm/graph-builder-interface.cc index 2bb5d21a8d..f1b0c4a010 100644 --- a/src/wasm/graph-builder-interface.cc +++ b/src/wasm/graph-builder-interface.cc @@ -490,12 +490,11 @@ class WasmGraphBuildingInterface { // If the tags match we extract the values from the exception object and // push them onto the operand stack using the passed {values} vector. SetEnv(if_match_env); - // TODO(mstarzinger): Can't use BUILD() here, GetExceptionValues() returns - // TFNode** rather than TFNode*. Fix to add landing pads. - Vector caught_values = - builder_->GetExceptionValues(exception.node, imm.exception); + base::SmallVector caught_values(values.size()); + Vector caught_vector = VectorOf(caught_values); + BUILD(GetExceptionValues, exception.node, imm.exception, caught_vector); for (size_t i = 0, e = values.size(); i < e; ++i) { - values[i].node = caught_values[i]; + values[i].node = caught_vector[i]; } BrOrRet(decoder, depth); @@ -660,6 +659,7 @@ class WasmGraphBuildingInterface { SsaEnv* exception_env = Split(decoder, success_env); exception_env->control = if_exception; + exception_env->effect = if_exception; TryInfo* try_info = current_try_info(decoder); Goto(decoder, exception_env, try_info->catch_env); if (try_info->exception == nullptr) {