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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 function AtomicsExchangeJS(ia, index, value) { | 96 function AtomicsExchangeJS(ia, index, value) { |
97 CheckSharedIntegerTypedArray(ia); | 97 CheckSharedIntegerTypedArray(ia); |
98 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); | 98 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); |
99 value = TO_NUMBER(value); | 99 value = TO_NUMBER(value); |
100 return %_AtomicsExchange(ia, index, value); | 100 return %_AtomicsExchange(ia, index, value); |
101 } | 101 } |
102 | 102 |
103 function AtomicsIsLockFreeJS(size) { | 103 function AtomicsIsLockFreeJS(size) { |
104 return %_AtomicsIsLockFree(size); | 104 return %_AtomicsIsLockFree(TO_INTEGER(size)); |
105 } | 105 } |
106 | 106 |
107 function AtomicsWaitJS(ia, index, value, timeout) { | 107 function AtomicsWaitJS(ia, index, value, timeout) { |
108 CheckSharedInteger32TypedArray(ia); | 108 CheckSharedInteger32TypedArray(ia); |
109 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); | 109 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); |
110 if (IS_UNDEFINED(timeout)) { | 110 if (IS_UNDEFINED(timeout)) { |
111 timeout = INFINITY; | 111 timeout = INFINITY; |
112 } else { | 112 } else { |
113 timeout = TO_NUMBER(timeout); | 113 timeout = TO_NUMBER(timeout); |
114 if (NUMBER_IS_NAN(timeout)) { | 114 if (NUMBER_IS_NAN(timeout)) { |
(...skipping 29 matching lines...) Expand all Loading... |
144 "and", AtomicsAndJS, | 144 "and", AtomicsAndJS, |
145 "or", AtomicsOrJS, | 145 "or", AtomicsOrJS, |
146 "xor", AtomicsXorJS, | 146 "xor", AtomicsXorJS, |
147 "exchange", AtomicsExchangeJS, | 147 "exchange", AtomicsExchangeJS, |
148 "isLockFree", AtomicsIsLockFreeJS, | 148 "isLockFree", AtomicsIsLockFreeJS, |
149 "wait", AtomicsWaitJS, | 149 "wait", AtomicsWaitJS, |
150 "wake", AtomicsWakeJS, | 150 "wake", AtomicsWakeJS, |
151 ]); | 151 ]); |
152 | 152 |
153 }) | 153 }) |
OLD | NEW |