Commit dc13819f authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

[wasm] fix wasm atomic wait callback test on BE

Bug: v8:8075
Change-Id: I8547706b56bab28dc11685e73b5fc084c8f1bf69
Reviewed-on: https://chromium-review.googlesource.com/c/1480912
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59799}
parent 03e13f7a
...@@ -27668,7 +27668,7 @@ void AtomicsWaitCallbackCommon(v8::Isolate* isolate, Local<Value> sab, ...@@ -27668,7 +27668,7 @@ void AtomicsWaitCallbackCommon(v8::Isolate* isolate, Local<Value> sab,
info.action = AtomicsWaitCallbackAction::StopAndThrowInSecondCall; info.action = AtomicsWaitCallbackAction::StopAndThrowInSecondCall;
info.ncalls = 0; info.ncalls = 0;
CompileRun( CompileRun(
"int32arr[1] = 200;" "setArrayElemAs(1, 200);"
"wait(1, 200);"); "wait(1, 200);");
CHECK_EQ(info.ncalls, 2); CHECK_EQ(info.ncalls, 2);
CHECK(try_catch.HasCaught()); CHECK(try_catch.HasCaught());
...@@ -27686,7 +27686,7 @@ void AtomicsWaitCallbackCommon(v8::Isolate* isolate, Local<Value> sab, ...@@ -27686,7 +27686,7 @@ void AtomicsWaitCallbackCommon(v8::Isolate* isolate, Local<Value> sab,
info.action = AtomicsWaitCallbackAction::StopFromThreadAndThrow; info.action = AtomicsWaitCallbackAction::StopFromThreadAndThrow;
info.ncalls = 0; info.ncalls = 0;
CompileRun( CompileRun(
"int32arr[1] = 0;" "setArrayElemAs(1, 0);"
"wait(0, 0);"); "wait(0, 0);");
CHECK_EQ(info.ncalls, 2); CHECK_EQ(info.ncalls, 2);
CHECK(try_catch.HasCaught()); CHECK(try_catch.HasCaught());
...@@ -27702,6 +27702,9 @@ TEST(AtomicsWaitCallback) { ...@@ -27702,6 +27702,9 @@ TEST(AtomicsWaitCallback) {
const char* init = R"( const char* init = R"(
let sab = new SharedArrayBuffer(16); let sab = new SharedArrayBuffer(16);
let int32arr = new Int32Array(sab, 4); let int32arr = new Int32Array(sab, 4);
let setArrayElemAs = function(id, val) {
int32arr[id] = val;
};
let wait = function(id, val, timeout) { let wait = function(id, val, timeout) {
if(arguments.length == 2) return Atomics.wait(int32arr, id, val); if(arguments.length == 2) return Atomics.wait(int32arr, id, val);
return Atomics.wait(int32arr, id, val, timeout); return Atomics.wait(int32arr, id, val, timeout);
...@@ -27738,6 +27741,9 @@ TEST(WasmI32AtomicWaitCallback) { ...@@ -27738,6 +27741,9 @@ TEST(WasmI32AtomicWaitCallback) {
const char* init = R"( const char* init = R"(
let int32arr = new Int32Array(sab, 4); let int32arr = new Int32Array(sab, 4);
let setArrayElemAs = function(id, val) {
int32arr[id] = val;
};
let wait = function(id, val, timeout) { let wait = function(id, val, timeout) {
if(arguments.length === 2) if(arguments.length === 2)
return func(id << 2, val, -1); return func(id << 2, val, -1);
...@@ -27771,9 +27777,10 @@ TEST(WasmI64AtomicWaitCallback) { ...@@ -27771,9 +27777,10 @@ TEST(WasmI64AtomicWaitCallback) {
.FromJust()); .FromJust());
const char* init = R"( const char* init = R"(
// offset 12 below ensures that int32arr[1] and wait(1..) point to the let int64arr = new BigInt64Array(sab, 8);
// same address. let setArrayElemAs = function(id, val) {
let int32arr = new Int32Array(sab, 12); int64arr[id] = BigInt(val);
};
let wait = function(id, val, timeout) { let wait = function(id, val, timeout) {
if(arguments.length === 2) if(arguments.length === 2)
return func(id << 3, val, -1); return func(id << 3, val, -1);
......
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