Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: src/js/harmony-atomics.js

Issue 2623633003: [Atomics] Make Atomics.exchange a builtin using TF (Closed)
Patch Set: [Atomics] Make Atomics.exchange a builtin using TF Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 return %_AtomicsOr(ia, index, value); 86 return %_AtomicsOr(ia, index, value);
87 } 87 }
88 88
89 function AtomicsXorJS(ia, index, value) { 89 function AtomicsXorJS(ia, index, value) {
90 CheckSharedIntegerTypedArray(ia); 90 CheckSharedIntegerTypedArray(ia);
91 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); 91 index = ValidateIndex(index, %_TypedArrayGetLength(ia));
92 value = TO_NUMBER(value); 92 value = TO_NUMBER(value);
93 return %_AtomicsXor(ia, index, value); 93 return %_AtomicsXor(ia, index, value);
94 } 94 }
95 95
96 function AtomicsExchangeJS(ia, index, value) {
97 CheckSharedIntegerTypedArray(ia);
98 index = ValidateIndex(index, %_TypedArrayGetLength(ia));
99 value = TO_NUMBER(value);
100 return %_AtomicsExchange(ia, index, value);
101 }
102
103 function AtomicsIsLockFreeJS(size) { 96 function AtomicsIsLockFreeJS(size) {
104 return %_AtomicsIsLockFree(size); 97 return %_AtomicsIsLockFree(size);
105 } 98 }
106 99
107 function AtomicsWaitJS(ia, index, value, timeout) { 100 function AtomicsWaitJS(ia, index, value, timeout) {
108 CheckSharedInteger32TypedArray(ia); 101 CheckSharedInteger32TypedArray(ia);
109 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); 102 index = ValidateIndex(index, %_TypedArrayGetLength(ia));
110 if (IS_UNDEFINED(timeout)) { 103 if (IS_UNDEFINED(timeout)) {
111 timeout = INFINITY; 104 timeout = INFINITY;
112 } else { 105 } else {
(...skipping 24 matching lines...) Expand all
137 130
138 utils.InstallFunctions(Atomics, DONT_ENUM, [ 131 utils.InstallFunctions(Atomics, DONT_ENUM, [
139 // TODO(binji): remove the rest of the (non futex) Atomics functions as they 132 // TODO(binji): remove the rest of the (non futex) Atomics functions as they
140 // become builtins. 133 // become builtins.
141 "compareExchange", AtomicsCompareExchangeJS, 134 "compareExchange", AtomicsCompareExchangeJS,
142 "add", AtomicsAddJS, 135 "add", AtomicsAddJS,
143 "sub", AtomicsSubJS, 136 "sub", AtomicsSubJS,
144 "and", AtomicsAndJS, 137 "and", AtomicsAndJS,
145 "or", AtomicsOrJS, 138 "or", AtomicsOrJS,
146 "xor", AtomicsXorJS, 139 "xor", AtomicsXorJS,
147 "exchange", AtomicsExchangeJS,
148 "isLockFree", AtomicsIsLockFreeJS, 140 "isLockFree", AtomicsIsLockFreeJS,
149 "wait", AtomicsWaitJS, 141 "wait", AtomicsWaitJS,
150 "wake", AtomicsWakeJS, 142 "wake", AtomicsWakeJS,
151 ]); 143 ]);
152 144
153 }) 145 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698