Skip to content

Commit e2bb253

Browse files
committed
Fix #5349: Rename Atomics.wake to Atomics.notify, per ES spec change.
1 parent ecaae5b commit e2bb253

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

lib/Runtime/Base/JnDirectFields.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ ENTRY(compareExchange)
731731
ENTRY(exchange)
732732
ENTRY(isLockFree)
733733
ENTRY(wait)
734-
ENTRY(wake)
734+
ENTRY(notify)
735735

736736
ENTRY(column)
737737
ENTRY(url)

lib/Runtime/Library/AtomicsObject.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ namespace Js
231231
: scriptContext->GetLibrary()->CreateStringFromCppLiteral(_u("timed-out"));
232232
}
233233

234-
Var AtomicsObject::EntryWake(RecyclableObject* function, CallInfo callInfo, ...)
234+
Var AtomicsObject::EntryNotify(RecyclableObject* function, CallInfo callInfo, ...)
235235
{
236-
ATOMICS_FUNCTION_ENTRY_CHECKS(2, "Atomics.wake");
236+
ATOMICS_FUNCTION_ENTRY_CHECKS(2, "Atomics.notify");
237237

238238
uint32 accessIndex = 0;
239239
TypedArrayBase *typedArrayBase = ValidateAndGetTypedArray(args[1], args[2], &accessIndex, scriptContext, true /*onlyInt32*/);

lib/Runtime/Library/AtomicsObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace Js
2424
static FunctionInfo Store;
2525
static FunctionInfo Sub;
2626
static FunctionInfo Wait;
27-
static FunctionInfo Wake;
27+
static FunctionInfo Notify;
2828
static FunctionInfo Xor;
2929
};
3030

@@ -38,7 +38,7 @@ namespace Js
3838
static Var EntryStore(RecyclableObject* function, CallInfo callInfo, ...);
3939
static Var EntrySub(RecyclableObject* function, CallInfo callInfo, ...);
4040
static Var EntryWait(RecyclableObject* function, CallInfo callInfo, ...);
41-
static Var EntryWake(RecyclableObject* function, CallInfo callInfo, ...);
41+
static Var EntryNotify(RecyclableObject* function, CallInfo callInfo, ...);
4242
static Var EntryXor(RecyclableObject* function, CallInfo callInfo, ...);
4343

4444
private:

lib/Runtime/Library/JavascriptBuiltInFunctionList.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ BUILTIN(AtomicsObject, Or, EntryOr, FunctionInfo::ErrorOnNew)
501501
BUILTIN(AtomicsObject, Store, EntryStore, FunctionInfo::ErrorOnNew)
502502
BUILTIN(AtomicsObject, Sub, EntrySub, FunctionInfo::ErrorOnNew)
503503
BUILTIN(AtomicsObject, Wait, EntryWait, FunctionInfo::ErrorOnNew)
504-
BUILTIN(AtomicsObject, Wake, EntryWake, FunctionInfo::ErrorOnNew)
504+
BUILTIN(AtomicsObject, Notify, EntryNotify, FunctionInfo::ErrorOnNew)
505505
BUILTIN(AtomicsObject, Xor, EntryXor, FunctionInfo::ErrorOnNew)
506506

507507
#undef BUILTIN_TEMPLATE

lib/Runtime/Library/JavascriptLibrary.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,7 @@ namespace Js
18241824
library->AddFunctionToLibraryObject(atomicsObject, PropertyIds::store, &AtomicsObject::EntryInfo::Store, 3);
18251825
library->AddFunctionToLibraryObject(atomicsObject, PropertyIds::sub, &AtomicsObject::EntryInfo::Sub, 3);
18261826
library->AddFunctionToLibraryObject(atomicsObject, PropertyIds::wait, &AtomicsObject::EntryInfo::Wait, 4);
1827-
library->AddFunctionToLibraryObject(atomicsObject, PropertyIds::wake, &AtomicsObject::EntryInfo::Wake, 3);
1827+
library->AddFunctionToLibraryObject(atomicsObject, PropertyIds::notify, &AtomicsObject::EntryInfo::Notify, 3);
18281828
library->AddFunctionToLibraryObject(atomicsObject, PropertyIds::xor_, &AtomicsObject::EntryInfo::Xor, 3);
18291829

18301830
if (atomicsObject->GetScriptContext()->GetConfig()->IsES6ToStringTagEnabled())
@@ -7389,7 +7389,7 @@ namespace Js
73897389
REG_OBJECTS_LIB_FUNC(store, AtomicsObject::EntryStore);
73907390
REG_OBJECTS_LIB_FUNC(sub, AtomicsObject::EntrySub);
73917391
REG_OBJECTS_LIB_FUNC(wait, AtomicsObject::EntryWait);
7392-
REG_OBJECTS_LIB_FUNC(wake, AtomicsObject::EntryWake);
7392+
REG_OBJECTS_LIB_FUNC(notify, AtomicsObject::EntryNotify);
73937393
REG_OBJECTS_LIB_FUNC(xor_, AtomicsObject::EntryXor);
73947394

73957395
return hr;

test/es7/atomics_test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var atomicsFunctionsList = [
2525

2626
var atomicsFunctionsList2 = [
2727
{op : Atomics.wait, fullname: "Atomics.wait", onlyInt32:true, length : 4},
28-
{op : Atomics.wake, fullname: "Atomics.wake", onlyInt32:true, length : 3},
28+
{op : Atomics.notify, fullname: "Atomics.notify", onlyInt32:true, length : 3},
2929
];
3030

3131
var allAtomicsFunctionsList = [...atomicsFunctionsList, ...atomicsFunctionsList2, {op : Atomics.isLockFree, fullname: "Atomics.isLockFree", length : 1}];
@@ -199,23 +199,23 @@ var tests = [{
199199
}
200200
},
201201
{
202-
name : "Atomics.wake negative scenario",
202+
name : "Atomics.notify negative scenario",
203203
body : function () {
204204
[[0, 4, 4], [3, 2, 8]].forEach(function([offset, length, elements]) {
205205
var sab = makeSharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * elements);
206206
var view = new Int32Array(sab, offset * Int32Array.BYTES_PER_ELEMENT, length);
207207

208-
assert.throws(() => Atomics.wake(view), RangeError, "Calling Atomics.wake with 1 param only is not valid", "Atomics.wake: function called with too few arguments");
208+
assert.throws(() => Atomics.notify(view), RangeError, "Calling Atomics.notify with 1 param only is not valid", "Atomics.notify: function called with too few arguments");
209209
[undefined, 1.1, "hi", NaN, {}].forEach(function (index) {
210-
Atomics.wake(view, index, 1);
210+
Atomics.notify(view, index, 1);
211211
});
212212

213213
[-1, Infinity, -Infinity].forEach(function (index) {
214-
assert.throws(() => Atomics.wake(view, index, 1), RangeError, "Only positive interger allowed, not " + index, "Access index is out of range");
214+
assert.throws(() => Atomics.notify(view, index, 1), RangeError, "Only positive interger allowed, not " + index, "Access index is out of range");
215215
});
216216

217-
assert.throws(() => Atomics.wake(view, elements, 1), RangeError, "index is out of bound " + elements, "Access index is out of range");
218-
assert.throws(() => Atomics.wake(view, length, 1), RangeError, "index is out of bound " + length, "Access index is out of range");
217+
assert.throws(() => Atomics.notify(view, elements, 1), RangeError, "index is out of bound " + elements, "Access index is out of range");
218+
assert.throws(() => Atomics.notify(view, length, 1), RangeError, "index is out of bound " + length, "Access index is out of range");
219219
});
220220
}
221221
},

0 commit comments

Comments
 (0)