OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function(global, utils) { | 5 (function(global, utils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } else { | 116 } else { |
117 timeout = MaxSimple(0, timeout); | 117 timeout = MaxSimple(0, timeout); |
118 } | 118 } |
119 } | 119 } |
120 return %AtomicsWait(ia, index, value, timeout); | 120 return %AtomicsWait(ia, index, value, timeout); |
121 } | 121 } |
122 | 122 |
123 function AtomicsWakeJS(ia, index, count) { | 123 function AtomicsWakeJS(ia, index, count) { |
124 CheckSharedInteger32TypedArray(ia); | 124 CheckSharedInteger32TypedArray(ia); |
125 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); | 125 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); |
126 count = MaxSimple(0, TO_INTEGER(count)); | 126 if (IS_UNDEFINED(count)) { |
| 127 count = INFINITY; |
| 128 } else { |
| 129 count = MaxSimple(0, TO_INTEGER(count)); |
| 130 } |
127 return %AtomicsWake(ia, index, count); | 131 return %AtomicsWake(ia, index, count); |
128 } | 132 } |
129 | 133 |
130 // ------------------------------------------------------------------- | 134 // ------------------------------------------------------------------- |
131 | 135 |
132 var Atomics = global.Atomics; | 136 var Atomics = global.Atomics; |
133 | 137 |
134 // The Atomics global is defined by the bootstrapper. | 138 // The Atomics global is defined by the bootstrapper. |
135 | 139 |
136 %AddNamedProperty(Atomics, toStringTagSymbol, "Atomics", READ_ONLY | DONT_ENUM); | 140 %AddNamedProperty(Atomics, toStringTagSymbol, "Atomics", READ_ONLY | DONT_ENUM); |
137 | 141 |
138 utils.InstallFunctions(Atomics, DONT_ENUM, [ | 142 utils.InstallFunctions(Atomics, DONT_ENUM, [ |
139 // TODO(binji): remove the rest of the (non futex) Atomics functions as they | 143 // TODO(binji): remove the rest of the (non futex) Atomics functions as they |
140 // become builtins. | 144 // become builtins. |
141 "compareExchange", AtomicsCompareExchangeJS, | 145 "compareExchange", AtomicsCompareExchangeJS, |
142 "add", AtomicsAddJS, | 146 "add", AtomicsAddJS, |
143 "sub", AtomicsSubJS, | 147 "sub", AtomicsSubJS, |
144 "and", AtomicsAndJS, | 148 "and", AtomicsAndJS, |
145 "or", AtomicsOrJS, | 149 "or", AtomicsOrJS, |
146 "xor", AtomicsXorJS, | 150 "xor", AtomicsXorJS, |
147 "exchange", AtomicsExchangeJS, | 151 "exchange", AtomicsExchangeJS, |
148 "isLockFree", AtomicsIsLockFreeJS, | 152 "isLockFree", AtomicsIsLockFreeJS, |
149 "wait", AtomicsWaitJS, | 153 "wait", AtomicsWaitJS, |
150 "wake", AtomicsWakeJS, | 154 "wake", AtomicsWakeJS, |
151 ]); | 155 ]); |
152 | 156 |
153 }) | 157 }) |
OLD | NEW |