Index: src/js/harmony-atomics.js |
diff --git a/src/js/harmony-atomics.js b/src/js/harmony-atomics.js |
index bfbf0c505e54bab3ff298f370de8d54c903114af..ffcfd66407b1e0bb2a9a43885d6b5a832914a71b 100644 |
--- a/src/js/harmony-atomics.js |
+++ b/src/js/harmony-atomics.js |
@@ -13,10 +13,12 @@ |
var GlobalObject = global.Object; |
var MaxSimple; |
+var MinSimple; |
var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
utils.Import(function(from) { |
MaxSimple = from.MaxSimple; |
+ MinSimple = from.MinSimple; |
}); |
// ------------------------------------------------------------------- |
@@ -123,7 +125,12 @@ function AtomicsWaitJS(ia, index, value, timeout) { |
function AtomicsWakeJS(ia, index, count) { |
CheckSharedInteger32TypedArray(ia); |
index = ValidateIndex(index, %_TypedArrayGetLength(ia)); |
- count = MaxSimple(0, TO_INTEGER(count)); |
+ if (IS_UNDEFINED(count)) { |
+ count = kMaxUint32; |
+ } else { |
+ // Clamp to [0, kMaxUint32]. |
+ count = MinSimple(MaxSimple(0, TO_INTEGER(count)), kMaxUint32); |
+ } |
return %AtomicsWake(ia, index, count); |
} |