Commit 165eb801 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Extend interpreter exception support to Simd128.

R=clemensh@chromium.org
TEST=mjsunit/wasm/exceptions-simd-interpreter
BUG=v8:8091

Change-Id: Id0b5da98bbfb91c7a5a878681d7fffe81233284f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1552794
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60655}
parent 818b50cb
......@@ -2467,9 +2467,19 @@ class ThreadImpl {
EncodeI64ExceptionValue(encoded_values, &encoded_index, f64);
break;
}
case kWasmAnyRef:
UNIMPLEMENTED();
case kWasmS128: {
int4 s128 = value.to_s128().to_i32x4();
EncodeI32ExceptionValue(encoded_values, &encoded_index, s128.val[0]);
EncodeI32ExceptionValue(encoded_values, &encoded_index, s128.val[1]);
EncodeI32ExceptionValue(encoded_values, &encoded_index, s128.val[2]);
EncodeI32ExceptionValue(encoded_values, &encoded_index, s128.val[3]);
break;
}
case kWasmAnyRef: {
Handle<Object> anyref = value.to_anyref();
encoded_values->set(encoded_index++, *anyref);
break;
}
default:
UNREACHABLE();
}
......@@ -2553,9 +2563,21 @@ class ThreadImpl {
value = WasmValue(Float64::FromBits(f64_bits));
break;
}
case kWasmAnyRef:
UNIMPLEMENTED();
case kWasmS128: {
int4 s128 = {0, 0, 0, 0};
uint32_t* vals = reinterpret_cast<uint32_t*>(s128.val);
DecodeI32ExceptionValue(encoded_values, &encoded_index, &vals[0]);
DecodeI32ExceptionValue(encoded_values, &encoded_index, &vals[1]);
DecodeI32ExceptionValue(encoded_values, &encoded_index, &vals[2]);
DecodeI32ExceptionValue(encoded_values, &encoded_index, &vals[3]);
value = WasmValue(Simd128(s128));
break;
}
case kWasmAnyRef: {
Handle<Object> anyref(encoded_values->get(encoded_index++), isolate_);
value = WasmValue(anyref);
break;
}
default:
UNREACHABLE();
}
......@@ -3309,6 +3331,7 @@ class ThreadImpl {
void TraceValueStack() {
#ifdef DEBUG
if (!FLAG_trace_wasm_interpreter) return;
HandleScope handle_scope(isolate_); // Avoid leaking handles.
Frame* top = frames_.size() > 0 ? &frames_.back() : nullptr;
sp_t sp = top ? top->sp : 0;
sp_t plimit = top ? top->plimit() : 0;
......@@ -3339,7 +3362,7 @@ class ThreadImpl {
// when there is more state to know what type of values are on the
// stack, the right format should be printed here.
int4 s = val.to_s128().to_i32x4();
PrintF("i32x4:%d %d %d %d", s.val[0], s.val[1], s.val[2], s.val[3]);
PrintF("i32x4:%d,%d,%d,%d", s.val[0], s.val[1], s.val[2], s.val[3]);
break;
}
case kWasmAnyRef: {
......
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-eh --experimental-wasm-simd --allow-natives-syntax
// Flags: --wasm-interpret-all
// This is just a wrapper for existing exception handling test cases that runs
// with the --wasm-interpret-all flag added. If we ever decide to add a test
// variant for this, then we can remove this file.
load("test/mjsunit/wasm/exceptions-simd.js");
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