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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 return %_AtomicsOr(ia, index, value); | 88 return %_AtomicsOr(ia, index, value); |
89 } | 89 } |
90 | 90 |
91 function AtomicsXorJS(ia, index, value) { | 91 function AtomicsXorJS(ia, index, value) { |
92 CheckSharedIntegerTypedArray(ia); | 92 CheckSharedIntegerTypedArray(ia); |
93 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); | 93 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); |
94 value = TO_NUMBER(value); | 94 value = TO_NUMBER(value); |
95 return %_AtomicsXor(ia, index, value); | 95 return %_AtomicsXor(ia, index, value); |
96 } | 96 } |
97 | 97 |
98 function AtomicsExchangeJS(ia, index, value) { | |
99 CheckSharedIntegerTypedArray(ia); | |
100 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); | |
101 value = TO_NUMBER(value); | |
102 return %_AtomicsExchange(ia, index, value); | |
103 } | |
104 | |
105 function AtomicsIsLockFreeJS(size) { | 98 function AtomicsIsLockFreeJS(size) { |
106 return %_AtomicsIsLockFree(TO_INTEGER(size)); | 99 return %_AtomicsIsLockFree(TO_INTEGER(size)); |
107 } | 100 } |
108 | 101 |
109 function AtomicsWaitJS(ia, index, value, timeout) { | 102 function AtomicsWaitJS(ia, index, value, timeout) { |
110 CheckSharedInteger32TypedArray(ia); | 103 CheckSharedInteger32TypedArray(ia); |
111 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); | 104 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); |
112 if (IS_UNDEFINED(timeout)) { | 105 if (IS_UNDEFINED(timeout)) { |
113 timeout = INFINITY; | 106 timeout = INFINITY; |
114 } else { | 107 } else { |
(...skipping 29 matching lines...) Expand all Loading... |
144 | 137 |
145 utils.InstallFunctions(Atomics, DONT_ENUM, [ | 138 utils.InstallFunctions(Atomics, DONT_ENUM, [ |
146 // TODO(binji): remove the rest of the (non futex) Atomics functions as they | 139 // TODO(binji): remove the rest of the (non futex) Atomics functions as they |
147 // become builtins. | 140 // become builtins. |
148 "compareExchange", AtomicsCompareExchangeJS, | 141 "compareExchange", AtomicsCompareExchangeJS, |
149 "add", AtomicsAddJS, | 142 "add", AtomicsAddJS, |
150 "sub", AtomicsSubJS, | 143 "sub", AtomicsSubJS, |
151 "and", AtomicsAndJS, | 144 "and", AtomicsAndJS, |
152 "or", AtomicsOrJS, | 145 "or", AtomicsOrJS, |
153 "xor", AtomicsXorJS, | 146 "xor", AtomicsXorJS, |
154 "exchange", AtomicsExchangeJS, | |
155 "isLockFree", AtomicsIsLockFreeJS, | 147 "isLockFree", AtomicsIsLockFreeJS, |
156 "wait", AtomicsWaitJS, | 148 "wait", AtomicsWaitJS, |
157 "wake", AtomicsWakeJS, | 149 "wake", AtomicsWakeJS, |
158 ]); | 150 ]); |
159 | 151 |
160 }) | 152 }) |
OLD | NEW |