Commit 7c3ee1c8 authored by Deepti Gandluri's avatar Deepti Gandluri Committed by Commit Bot

[wasm] Rename Atomics Wake operator to Notify.

Change-Id: Ie080683af1d990e5205c75a2a199f0581d826811
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511630
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Reviewed-by: 's avatarBen Smith <binji@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60135}
parent 4f170010
...@@ -1142,7 +1142,7 @@ namespace internal { ...@@ -1142,7 +1142,7 @@ namespace internal {
/* Wasm */ \ /* Wasm */ \
ASM(WasmCompileLazy, Dummy) \ ASM(WasmCompileLazy, Dummy) \
TFC(WasmAllocateHeapNumber, AllocateHeapNumber) \ TFC(WasmAllocateHeapNumber, AllocateHeapNumber) \
TFC(WasmAtomicWake, WasmAtomicWake) \ TFC(WasmAtomicNotify, WasmAtomicNotify) \
TFC(WasmI32AtomicWait, WasmI32AtomicWait) \ TFC(WasmI32AtomicWait, WasmI32AtomicWait) \
TFC(WasmI64AtomicWait, WasmI64AtomicWait) \ TFC(WasmI64AtomicWait, WasmI64AtomicWait) \
TFC(WasmCallJavaScript, CallTrampoline) \ TFC(WasmCallJavaScript, CallTrampoline) \
...@@ -1449,7 +1449,7 @@ namespace internal { ...@@ -1449,7 +1449,7 @@ namespace internal {
#define WASM_RUNTIME_STUB_LIST(V, VTRAP) \ #define WASM_RUNTIME_STUB_LIST(V, VTRAP) \
FOREACH_WASM_TRAPREASON(VTRAP) \ FOREACH_WASM_TRAPREASON(VTRAP) \
V(WasmAllocateHeapNumber) \ V(WasmAllocateHeapNumber) \
V(WasmAtomicWake) \ V(WasmAtomicNotify) \
V(WasmI32AtomicWait) \ V(WasmI32AtomicWait) \
V(WasmI64AtomicWait) \ V(WasmI64AtomicWait) \
V(WasmCallJavaScript) \ V(WasmCallJavaScript) \
......
...@@ -105,7 +105,7 @@ TF_BUILTIN(WasmThrow, WasmBuiltinsAssembler) { ...@@ -105,7 +105,7 @@ TF_BUILTIN(WasmThrow, WasmBuiltinsAssembler) {
TailCallRuntimeWithCEntry(Runtime::kThrow, centry, context, exception); TailCallRuntimeWithCEntry(Runtime::kThrow, centry, context, exception);
} }
TF_BUILTIN(WasmAtomicWake, WasmBuiltinsAssembler) { TF_BUILTIN(WasmAtomicNotify, WasmBuiltinsAssembler) {
TNode<Uint32T> address = TNode<Uint32T> address =
UncheckedCast<Uint32T>(Parameter(Descriptor::kAddress)); UncheckedCast<Uint32T>(Parameter(Descriptor::kAddress));
TNode<Uint32T> count = UncheckedCast<Uint32T>(Parameter(Descriptor::kCount)); TNode<Uint32T> count = UncheckedCast<Uint32T>(Parameter(Descriptor::kCount));
...@@ -125,7 +125,7 @@ TF_BUILTIN(WasmAtomicWake, WasmBuiltinsAssembler) { ...@@ -125,7 +125,7 @@ TF_BUILTIN(WasmAtomicWake, WasmBuiltinsAssembler) {
StoreHeapNumberValue(count_heap, ChangeUint32ToFloat64(count)); StoreHeapNumberValue(count_heap, ChangeUint32ToFloat64(count));
TNode<Smi> result_smi = UncheckedCast<Smi>(CallRuntimeWithCEntry( TNode<Smi> result_smi = UncheckedCast<Smi>(CallRuntimeWithCEntry(
Runtime::kWasmAtomicWake, centry, NoContextConstant(), instance, Runtime::kWasmAtomicNotify, centry, NoContextConstant(), instance,
address_heap, count_heap)); address_heap, count_heap));
ReturnRaw(SmiToInt32(result_smi)); ReturnRaw(SmiToInt32(result_smi));
} }
......
...@@ -4339,21 +4339,21 @@ Node* WasmGraphBuilder::AtomicOp(wasm::WasmOpcode opcode, Node* const* inputs, ...@@ -4339,21 +4339,21 @@ Node* WasmGraphBuilder::AtomicOp(wasm::WasmOpcode opcode, Node* const* inputs,
} }
ATOMIC_STORE_LIST(BUILD_ATOMIC_STORE_OP) ATOMIC_STORE_LIST(BUILD_ATOMIC_STORE_OP)
#undef BUILD_ATOMIC_STORE_OP #undef BUILD_ATOMIC_STORE_OP
case wasm::kExprAtomicWake: { case wasm::kExprAtomicNotify: {
Node* index = CheckBoundsAndAlignment( Node* index = CheckBoundsAndAlignment(
wasm::ValueTypes::MemSize(MachineType::Uint32()), inputs[0], offset, wasm::ValueTypes::MemSize(MachineType::Uint32()), inputs[0], offset,
position); position);
// Now that we've bounds-checked, compute the effective address. // Now that we've bounds-checked, compute the effective address.
Node* address = graph()->NewNode(mcgraph()->machine()->Int32Add(), Node* address = graph()->NewNode(mcgraph()->machine()->Int32Add(),
Uint32Constant(offset), index); Uint32Constant(offset), index);
WasmAtomicWakeDescriptor interface_descriptor; WasmAtomicNotifyDescriptor interface_descriptor;
auto call_descriptor = Linkage::GetStubCallDescriptor( auto call_descriptor = Linkage::GetStubCallDescriptor(
mcgraph()->zone(), interface_descriptor, mcgraph()->zone(), interface_descriptor,
interface_descriptor.GetStackParameterCount(), interface_descriptor.GetStackParameterCount(),
CallDescriptor::kNoFlags, Operator::kNoProperties, CallDescriptor::kNoFlags, Operator::kNoProperties,
StubCallMode::kCallWasmRuntimeStub); StubCallMode::kCallWasmRuntimeStub);
Node* call_target = mcgraph()->RelocatableIntPtrConstant( Node* call_target = mcgraph()->RelocatableIntPtrConstant(
wasm::WasmCode::kWasmAtomicWake, RelocInfo::WASM_STUB_CALL); wasm::WasmCode::kWasmAtomicNotify, RelocInfo::WASM_STUB_CALL);
node = graph()->NewNode(mcgraph()->common()->Call(call_descriptor), node = graph()->NewNode(mcgraph()->common()->Call(call_descriptor),
call_target, address, inputs[1], Effect(), call_target, address, inputs[1], Effect(),
Control()); Control());
......
...@@ -364,7 +364,7 @@ void WasmThrowDescriptor::InitializePlatformSpecific( ...@@ -364,7 +364,7 @@ void WasmThrowDescriptor::InitializePlatformSpecific(
DefaultInitializePlatformSpecific(data, kParameterCount); DefaultInitializePlatformSpecific(data, kParameterCount);
} }
void WasmAtomicWakeDescriptor::InitializePlatformSpecific( void WasmAtomicNotifyDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
DefaultInitializePlatformSpecific(data, kParameterCount); DefaultInitializePlatformSpecific(data, kParameterCount);
} }
......
...@@ -78,7 +78,7 @@ namespace internal { ...@@ -78,7 +78,7 @@ namespace internal {
V(TypeConversionStackParameter) \ V(TypeConversionStackParameter) \
V(Typeof) \ V(Typeof) \
V(Void) \ V(Void) \
V(WasmAtomicWake) \ V(WasmAtomicNotify) \
V(WasmI32AtomicWait) \ V(WasmI32AtomicWait) \
V(WasmI64AtomicWait) \ V(WasmI64AtomicWait) \
V(WasmMemoryGrow) \ V(WasmMemoryGrow) \
...@@ -1178,13 +1178,13 @@ class BigIntToI64Descriptor final : public CallInterfaceDescriptor { ...@@ -1178,13 +1178,13 @@ class BigIntToI64Descriptor final : public CallInterfaceDescriptor {
DECLARE_DESCRIPTOR(BigIntToI64Descriptor, CallInterfaceDescriptor) DECLARE_DESCRIPTOR(BigIntToI64Descriptor, CallInterfaceDescriptor)
}; };
class WasmAtomicWakeDescriptor final : public CallInterfaceDescriptor { class WasmAtomicNotifyDescriptor final : public CallInterfaceDescriptor {
public: public:
DEFINE_PARAMETERS_NO_CONTEXT(kAddress, kCount) DEFINE_PARAMETERS_NO_CONTEXT(kAddress, kCount)
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::Uint32(), // result 1 DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::Uint32(), // result 1
MachineType::Uint32(), // kAddress MachineType::Uint32(), // kAddress
MachineType::Uint32()) // kCount MachineType::Uint32()) // kCount
DECLARE_DESCRIPTOR(WasmAtomicWakeDescriptor, CallInterfaceDescriptor) DECLARE_DESCRIPTOR(WasmAtomicNotifyDescriptor, CallInterfaceDescriptor)
}; };
class WasmI32AtomicWaitDescriptor final : public CallInterfaceDescriptor { class WasmI32AtomicWaitDescriptor final : public CallInterfaceDescriptor {
......
...@@ -264,7 +264,7 @@ Handle<JSArrayBuffer> getSharedArrayBuffer(Handle<WasmInstanceObject> instance, ...@@ -264,7 +264,7 @@ Handle<JSArrayBuffer> getSharedArrayBuffer(Handle<WasmInstanceObject> instance,
return array_buffer; return array_buffer;
} }
RUNTIME_FUNCTION(Runtime_WasmAtomicWake) { RUNTIME_FUNCTION(Runtime_WasmAtomicNotify) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(3, args.length()); DCHECK_EQ(3, args.length());
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0); CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
......
...@@ -534,7 +534,7 @@ namespace internal { ...@@ -534,7 +534,7 @@ namespace internal {
F(ThrowWasmStackOverflow, 0, 1) \ F(ThrowWasmStackOverflow, 0, 1) \
F(WasmI32AtomicWait, 4, 1) \ F(WasmI32AtomicWait, 4, 1) \
F(WasmI64AtomicWait, 5, 1) \ F(WasmI64AtomicWait, 5, 1) \
F(WasmAtomicWake, 3, 1) \ F(WasmAtomicNotify, 3, 1) \
F(WasmExceptionGetValues, 1, 1) \ F(WasmExceptionGetValues, 1, 1) \
F(WasmExceptionGetTag, 1, 1) \ F(WasmExceptionGetTag, 1, 1) \
F(WasmMemoryGrow, 2, 1) \ F(WasmMemoryGrow, 2, 1) \
......
...@@ -61,7 +61,7 @@ struct WasmException; ...@@ -61,7 +61,7 @@ struct WasmException;
(message))) (message)))
#define ATOMIC_OP_LIST(V) \ #define ATOMIC_OP_LIST(V) \
V(AtomicWake, Uint32) \ V(AtomicNotify, Uint32) \
V(I32AtomicWait, Uint32) \ V(I32AtomicWait, Uint32) \
V(I64AtomicWait, Uint32) \ V(I64AtomicWait, Uint32) \
V(I32AtomicLoad, Uint32) \ V(I32AtomicLoad, Uint32) \
......
...@@ -268,7 +268,7 @@ const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) { ...@@ -268,7 +268,7 @@ const char* WasmOpcodes::OpcodeName(WasmOpcode opcode) {
CASE_S1x16_OP(AllTrue, "all_true") CASE_S1x16_OP(AllTrue, "all_true")
// Atomic operations. // Atomic operations.
CASE_OP(AtomicWake, "atomic_wake") CASE_OP(AtomicNotify, "atomic_notify")
CASE_INT_OP(AtomicWait, "atomic_wait") CASE_INT_OP(AtomicWait, "atomic_wait")
CASE_UNSIGNED_ALL_OP(AtomicLoad, "atomic_load") CASE_UNSIGNED_ALL_OP(AtomicLoad, "atomic_load")
CASE_UNSIGNED_ALL_OP(AtomicStore, "atomic_store") CASE_UNSIGNED_ALL_OP(AtomicStore, "atomic_store")
......
...@@ -423,7 +423,7 @@ bool IsJSCompatibleSignature(const FunctionSig* sig, bool hasBigIntFeature); ...@@ -423,7 +423,7 @@ bool IsJSCompatibleSignature(const FunctionSig* sig, bool hasBigIntFeature);
V(TableCopy, 0xfc0e, v_iii) V(TableCopy, 0xfc0e, v_iii)
#define FOREACH_ATOMIC_OPCODE(V) \ #define FOREACH_ATOMIC_OPCODE(V) \
V(AtomicWake, 0xfe00, i_ii) \ V(AtomicNotify, 0xfe00, i_ii) \
V(I32AtomicWait, 0xfe01, i_iil) \ V(I32AtomicWait, 0xfe01, i_iil) \
V(I64AtomicWait, 0xfe02, i_ill) \ V(I64AtomicWait, 0xfe02, i_ill) \
V(I32AtomicLoad, 0xfe10, i_i) \ V(I32AtomicLoad, 0xfe10, i_i) \
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
load("test/mjsunit/wasm/wasm-module-builder.js"); load("test/mjsunit/wasm/wasm-module-builder.js");
function WasmAtomicWake(memory, offset, index, num) { function WasmAtomicNotify(memory, offset, index, num) {
let builder = new WasmModuleBuilder(); let builder = new WasmModuleBuilder();
builder.addImportedMemory("m", "memory", 0, 20, "shared"); builder.addImportedMemory("m", "memory", 0, 20, "shared");
builder.addFunction("main", kSig_i_ii) builder.addFunction("main", kSig_i_ii)
...@@ -17,7 +17,7 @@ function WasmAtomicWake(memory, offset, index, num) { ...@@ -17,7 +17,7 @@ function WasmAtomicWake(memory, offset, index, num) {
kExprGetLocal, 0, kExprGetLocal, 0,
kExprGetLocal, 1, kExprGetLocal, 1,
kAtomicPrefix, kAtomicPrefix,
kExprAtomicWake, /* alignment */ 0, offset]) kExprAtomicNotify, /* alignment */ 0, offset])
.exportAs("main"); .exportAs("main");
// Instantiate module, get function exports // Instantiate module, get function exports
...@@ -84,7 +84,7 @@ function WasmI64AtomicWait(memory, offset, index, val_low, ...@@ -84,7 +84,7 @@ function WasmI64AtomicWait(memory, offset, index, val_low,
// Valid indexes are 0-65535 (1 page). // Valid indexes are 0-65535 (1 page).
[-2, 65536, 0xffffffff].forEach(function(invalidIndex) { [-2, 65536, 0xffffffff].forEach(function(invalidIndex) {
assertThrows(function() { assertThrows(function() {
WasmAtomicWake(memory, 0, invalidIndex, -1); WasmAtomicNotify(memory, 0, invalidIndex, -1);
}, Error); }, Error);
assertThrows(function() { assertThrows(function() {
WasmI32AtomicWait(memory, 0, invalidIndex, 0, -1); WasmI32AtomicWait(memory, 0, invalidIndex, 0, -1);
...@@ -93,7 +93,7 @@ function WasmI64AtomicWait(memory, offset, index, val_low, ...@@ -93,7 +93,7 @@ function WasmI64AtomicWait(memory, offset, index, val_low,
WasmI64AtomicWait(memory, 0, invalidIndex, 0, 0, -1); WasmI64AtomicWait(memory, 0, invalidIndex, 0, 0, -1);
}, Error); }, Error);
assertThrows(function() { assertThrows(function() {
WasmAtomicWake(memory, invalidIndex, 0, -1); WasmAtomicNotify(memory, invalidIndex, 0, -1);
}, Error); }, Error);
assertThrows(function() { assertThrows(function() {
WasmI32AtomicWait(memory, invalidIndex, 0, 0, -1); WasmI32AtomicWait(memory, invalidIndex, 0, 0, -1);
...@@ -102,7 +102,7 @@ function WasmI64AtomicWait(memory, offset, index, val_low, ...@@ -102,7 +102,7 @@ function WasmI64AtomicWait(memory, offset, index, val_low,
WasmI64AtomicWait(memory, invalidIndex, 0, 0, 0, -1); WasmI64AtomicWait(memory, invalidIndex, 0, 0, 0, -1);
}, Error); }, Error);
assertThrows(function() { assertThrows(function() {
WasmAtomicWake(memory, invalidIndex/2, invalidIndex/2, -1); WasmAtomicNotify(memory, invalidIndex/2, invalidIndex/2, -1);
}, Error); }, Error);
assertThrows(function() { assertThrows(function() {
WasmI32AtomicWait(memory, invalidIndex/2, invalidIndex/2, 0, -1); WasmI32AtomicWait(memory, invalidIndex/2, invalidIndex/2, 0, -1);
...@@ -119,10 +119,10 @@ function WasmI64AtomicWait(memory, offset, index, val_low, ...@@ -119,10 +119,10 @@ function WasmI64AtomicWait(memory, offset, index, val_low,
// Wait and wake must be 4 byte aligned. // Wait and wake must be 4 byte aligned.
[1, 2, 3].forEach(function(invalid) { [1, 2, 3].forEach(function(invalid) {
assertThrows(function() { assertThrows(function() {
WasmAtomicWake(memory, invalid, 0, -1) WasmAtomicNotify(memory, invalid, 0, -1)
}, Error); }, Error);
assertThrows(function() { assertThrows(function() {
WasmAtomicWake(memory, 0, invalid, -1) WasmAtomicNotify(memory, 0, invalid, -1)
}, Error); }, Error);
assertThrows(function() { assertThrows(function() {
WasmI32AtomicWait(memory, invalid, 0, 0, -1) WasmI32AtomicWait(memory, invalid, 0, 0, -1)
...@@ -196,7 +196,7 @@ function WasmI64AtomicWait(memory, offset, index, val_low, ...@@ -196,7 +196,7 @@ function WasmI64AtomicWait(memory, offset, index, val_low,
let memory = new WebAssembly.Memory({initial: 1, maximum: 1, shared: true}); let memory = new WebAssembly.Memory({initial: 1, maximum: 1, shared: true});
[-1, 0, 4, 100, 0xffffffff].forEach(function(count) { [-1, 0, 4, 100, 0xffffffff].forEach(function(count) {
WasmAtomicWake(memory, 0, 0, count); WasmAtomicNotify(memory, 0, 0, count);
}); });
})(); })();
...@@ -299,13 +299,13 @@ if (this.Worker) { ...@@ -299,13 +299,13 @@ if (this.Worker) {
if (num >= numWorkers) { if (num >= numWorkers) {
// if numWorkers or more is passed to wake, numWorkers workers should be // if numWorkers or more is passed to wake, numWorkers workers should be
// woken. // woken.
assertEquals(numWorkers, WasmAtomicWake(memory, 0, index, num)); assertEquals(numWorkers, WasmAtomicNotify(memory, 0, index, num));
} else { } else {
// if num < numWorkers is passed to wake, num workers should be woken. // if num < numWorkers is passed to wake, num workers should be woken.
// Then the remaining workers are woken for the next part // Then the remaining workers are woken for the next part
assertEquals(num, WasmAtomicWake(memory, 0, index, num)); assertEquals(num, WasmAtomicNotify(memory, 0, index, num));
assertEquals(numWorkers-num, assertEquals(numWorkers-num,
WasmAtomicWake(memory, 0, index, numWorkers)); WasmAtomicNotify(memory, 0, index, numWorkers));
} }
for (let id = 0; id < numWorkers; id++) { for (let id = 0; id < numWorkers; id++) {
assertEquals(msg, workers[id].getMessage()); assertEquals(msg, workers[id].getMessage());
......
...@@ -387,7 +387,7 @@ let kExprElemDrop = 0x0d; ...@@ -387,7 +387,7 @@ let kExprElemDrop = 0x0d;
let kExprTableCopy = 0x0e; let kExprTableCopy = 0x0e;
// Atomic opcodes. // Atomic opcodes.
let kExprAtomicWake = 0x00; let kExprAtomicNotify = 0x00;
let kExprI32AtomicWait = 0x01; let kExprI32AtomicWait = 0x01;
let kExprI64AtomicWait = 0x02; let kExprI64AtomicWait = 0x02;
let kExprI32AtomicLoad = 0x10; let kExprI32AtomicLoad = 0x10;
......
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