| 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 |
| 11 // ------------------------------------------------------------------- | 11 // ------------------------------------------------------------------- |
| 12 // Imports | 12 // Imports |
| 13 | 13 |
| 14 var GlobalObject = global.Object; | 14 var GlobalObject = global.Object; |
| 15 var MathMax; | 15 var MaxSimple; |
| 16 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); | 16 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
| 17 | 17 |
| 18 utils.Import(function(from) { | 18 utils.Import(function(from) { |
| 19 MathMax = from.MathMax; | 19 MaxSimple = from.MaxSimple; |
| 20 }); | 20 }); |
| 21 | 21 |
| 22 // ------------------------------------------------------------------- | 22 // ------------------------------------------------------------------- |
| 23 | 23 |
| 24 | 24 |
| 25 function CheckSharedIntegerTypedArray(ia) { | 25 function CheckSharedIntegerTypedArray(ia) { |
| 26 if (!%IsSharedIntegerTypedArray(ia)) { | 26 if (!%IsSharedIntegerTypedArray(ia)) { |
| 27 throw MakeTypeError(kNotIntegerSharedTypedArray, ia); | 27 throw MakeTypeError(kNotIntegerSharedTypedArray, ia); |
| 28 } | 28 } |
| 29 } | 29 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { | 139 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { |
| 140 return UNDEFINED; | 140 return UNDEFINED; |
| 141 } | 141 } |
| 142 if (IS_UNDEFINED(timeout)) { | 142 if (IS_UNDEFINED(timeout)) { |
| 143 timeout = INFINITY; | 143 timeout = INFINITY; |
| 144 } else { | 144 } else { |
| 145 timeout = TO_NUMBER(timeout); | 145 timeout = TO_NUMBER(timeout); |
| 146 if (NUMBER_IS_NAN(timeout)) { | 146 if (NUMBER_IS_NAN(timeout)) { |
| 147 timeout = INFINITY; | 147 timeout = INFINITY; |
| 148 } else { | 148 } else { |
| 149 timeout = MathMax(0, timeout); | 149 timeout = MaxSimple(0, timeout); |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 return %AtomicsFutexWait(ia, index, value, timeout); | 152 return %AtomicsFutexWait(ia, index, value, timeout); |
| 153 } | 153 } |
| 154 | 154 |
| 155 function AtomicsFutexWakeJS(ia, index, count) { | 155 function AtomicsFutexWakeJS(ia, index, count) { |
| 156 CheckSharedInteger32TypedArray(ia); | 156 CheckSharedInteger32TypedArray(ia); |
| 157 index = TO_INTEGER(index); | 157 index = TO_INTEGER(index); |
| 158 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { | 158 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { |
| 159 return UNDEFINED; | 159 return UNDEFINED; |
| 160 } | 160 } |
| 161 count = MathMax(0, TO_INTEGER(count)); | 161 count = MaxSimple(0, TO_INTEGER(count)); |
| 162 return %AtomicsFutexWake(ia, index, count); | 162 return %AtomicsFutexWake(ia, index, count); |
| 163 } | 163 } |
| 164 | 164 |
| 165 function AtomicsFutexWakeOrRequeueJS(ia, index1, count, value, index2) { | 165 function AtomicsFutexWakeOrRequeueJS(ia, index1, count, value, index2) { |
| 166 CheckSharedInteger32TypedArray(ia); | 166 CheckSharedInteger32TypedArray(ia); |
| 167 index1 = TO_INTEGER(index1); | 167 index1 = TO_INTEGER(index1); |
| 168 count = MathMax(0, TO_INTEGER(count)); | 168 count = MaxSimple(0, TO_INTEGER(count)); |
| 169 value = TO_INT32(value); | 169 value = TO_INT32(value); |
| 170 index2 = TO_INTEGER(index2); | 170 index2 = TO_INTEGER(index2); |
| 171 if (index1 < 0 || index1 >= %_TypedArrayGetLength(ia) || | 171 if (index1 < 0 || index1 >= %_TypedArrayGetLength(ia) || |
| 172 index2 < 0 || index2 >= %_TypedArrayGetLength(ia)) { | 172 index2 < 0 || index2 >= %_TypedArrayGetLength(ia)) { |
| 173 return UNDEFINED; | 173 return UNDEFINED; |
| 174 } | 174 } |
| 175 return %AtomicsFutexWakeOrRequeue(ia, index1, count, value, index2); | 175 return %AtomicsFutexWakeOrRequeue(ia, index1, count, value, index2); |
| 176 } | 176 } |
| 177 | 177 |
| 178 // ------------------------------------------------------------------- | 178 // ------------------------------------------------------------------- |
| (...skipping 25 matching lines...) Expand all Loading... |
| 204 "or", AtomicsOrJS, | 204 "or", AtomicsOrJS, |
| 205 "xor", AtomicsXorJS, | 205 "xor", AtomicsXorJS, |
| 206 "exchange", AtomicsExchangeJS, | 206 "exchange", AtomicsExchangeJS, |
| 207 "isLockFree", AtomicsIsLockFreeJS, | 207 "isLockFree", AtomicsIsLockFreeJS, |
| 208 "futexWait", AtomicsFutexWaitJS, | 208 "futexWait", AtomicsFutexWaitJS, |
| 209 "futexWake", AtomicsFutexWakeJS, | 209 "futexWake", AtomicsFutexWakeJS, |
| 210 "futexWakeOrRequeue", AtomicsFutexWakeOrRequeueJS, | 210 "futexWakeOrRequeue", AtomicsFutexWakeOrRequeueJS, |
| 211 ]); | 211 ]); |
| 212 | 212 |
| 213 }) | 213 }) |
| OLD | NEW |