Commit b67f096e authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Switch {GetExceptionValues} away from {Buffer}.

This switches the {WasmGraphBuilder::GetExceptionValues} to use a proper
vector instead of the deprecated {Buffer} method. This also addresses a
TODO about missing landing pads for the above affected method.

R=clemensb@chromium.org

Change-Id: I33ba7d712a00f2a284ec159a501bcd90e02a3a51
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1859620
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64276}
parent a4677f3a
......@@ -2258,13 +2258,14 @@ Node* WasmGraphBuilder::GetExceptionTag(Node* except_obj) {
return BuildCallToRuntime(Runtime::kWasmExceptionGetTag, &except_obj, 1);
}
Vector<Node*> WasmGraphBuilder::GetExceptionValues(
Node* except_obj, const wasm::WasmException* exception) {
Node* WasmGraphBuilder::GetExceptionValues(Node* except_obj,
const wasm::WasmException* exception,
Vector<Node*> values) {
Node* values_array =
BuildCallToRuntime(Runtime::kWasmExceptionGetValues, &except_obj, 1);
uint32_t index = 0;
const wasm::WasmExceptionSig* sig = exception->sig;
Vector<Node*> 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<Node*> WasmGraphBuilder::GetExceptionValues(
values[i] = value;
}
DCHECK_EQ(index, WasmExceptionPackage::GetEncodedSize(exception));
return values;
return values_array;
}
Node* WasmGraphBuilder::BuildI32DivS(Node* left, Node* right,
......
......@@ -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<Node*> GetExceptionValues(Node* except_obj,
const wasm::WasmException* exception);
Node* GetExceptionValues(Node* except_obj,
const wasm::WasmException* exception,
Vector<Node*> values_out);
bool IsPhiWithMerge(Node* phi, Node* merge);
bool ThrowsException(Node* node, Node** if_success, Node** if_exception);
void AppendToMerge(Node* merge, Node* from);
......
......@@ -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<TFNode*> caught_values =
builder_->GetExceptionValues(exception.node, imm.exception);
base::SmallVector<TFNode*, 8> caught_values(values.size());
Vector<TFNode*> 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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment