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

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

Issue 1394303003: Revert of Use simple/fast macro version of MinMax in JS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « src/harmony-array.js ('k') | src/harmony-typedarray.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 // ------------------------------------------------------------------- 11 // -------------------------------------------------------------------
12 // Imports 12 // Imports
13 13
14 var GlobalObject = global.Object; 14 var GlobalObject = global.Object;
15 var MathMax;
15 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); 16 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
16 17
18 utils.Import(function(from) {
19 MathMax = from.MathMax;
20 });
21
17 // ------------------------------------------------------------------- 22 // -------------------------------------------------------------------
18 23
19 24
20 function CheckSharedIntegerTypedArray(ia) { 25 function CheckSharedIntegerTypedArray(ia) {
21 if (!%IsSharedIntegerTypedArray(ia)) { 26 if (!%IsSharedIntegerTypedArray(ia)) {
22 throw MakeTypeError(kNotIntegerSharedTypedArray, ia); 27 throw MakeTypeError(kNotIntegerSharedTypedArray, ia);
23 } 28 }
24 } 29 }
25 30
26 function CheckSharedInteger32TypedArray(ia) { 31 function CheckSharedInteger32TypedArray(ia) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { 139 if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
135 return UNDEFINED; 140 return UNDEFINED;
136 } 141 }
137 if (IS_UNDEFINED(timeout)) { 142 if (IS_UNDEFINED(timeout)) {
138 timeout = INFINITY; 143 timeout = INFINITY;
139 } else { 144 } else {
140 timeout = TO_NUMBER(timeout); 145 timeout = TO_NUMBER(timeout);
141 if (NUMBER_IS_NAN(timeout)) { 146 if (NUMBER_IS_NAN(timeout)) {
142 timeout = INFINITY; 147 timeout = INFINITY;
143 } else { 148 } else {
144 timeout = MAX_SIMPLE(0, timeout); 149 timeout = MathMax(0, timeout);
145 } 150 }
146 } 151 }
147 return %AtomicsFutexWait(ia, index, value, timeout); 152 return %AtomicsFutexWait(ia, index, value, timeout);
148 } 153 }
149 154
150 function AtomicsFutexWakeJS(ia, index, count) { 155 function AtomicsFutexWakeJS(ia, index, count) {
151 CheckSharedInteger32TypedArray(ia); 156 CheckSharedInteger32TypedArray(ia);
152 index = TO_INTEGER(index); 157 index = TO_INTEGER(index);
153 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { 158 if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
154 return UNDEFINED; 159 return UNDEFINED;
155 } 160 }
156 count = MAX_SIMPLE(0, TO_INTEGER(count)); 161 count = MathMax(0, TO_INTEGER(count));
157 return %AtomicsFutexWake(ia, index, count); 162 return %AtomicsFutexWake(ia, index, count);
158 } 163 }
159 164
160 function AtomicsFutexWakeOrRequeueJS(ia, index1, count, value, index2) { 165 function AtomicsFutexWakeOrRequeueJS(ia, index1, count, value, index2) {
161 CheckSharedInteger32TypedArray(ia); 166 CheckSharedInteger32TypedArray(ia);
162 index1 = TO_INTEGER(index1); 167 index1 = TO_INTEGER(index1);
163 count = MAX_SIMPLE(0, TO_INTEGER(count)); 168 count = MathMax(0, TO_INTEGER(count));
164 value = TO_INT32(value); 169 value = TO_INT32(value);
165 index2 = TO_INTEGER(index2); 170 index2 = TO_INTEGER(index2);
166 if (index1 < 0 || index1 >= %_TypedArrayGetLength(ia) || 171 if (index1 < 0 || index1 >= %_TypedArrayGetLength(ia) ||
167 index2 < 0 || index2 >= %_TypedArrayGetLength(ia)) { 172 index2 < 0 || index2 >= %_TypedArrayGetLength(ia)) {
168 return UNDEFINED; 173 return UNDEFINED;
169 } 174 }
170 return %AtomicsFutexWakeOrRequeue(ia, index1, count, value, index2); 175 return %AtomicsFutexWakeOrRequeue(ia, index1, count, value, index2);
171 } 176 }
172 177
173 // ------------------------------------------------------------------- 178 // -------------------------------------------------------------------
(...skipping 25 matching lines...) Expand all
199 "or", AtomicsOrJS, 204 "or", AtomicsOrJS,
200 "xor", AtomicsXorJS, 205 "xor", AtomicsXorJS,
201 "exchange", AtomicsExchangeJS, 206 "exchange", AtomicsExchangeJS,
202 "isLockFree", AtomicsIsLockFreeJS, 207 "isLockFree", AtomicsIsLockFreeJS,
203 "futexWait", AtomicsFutexWaitJS, 208 "futexWait", AtomicsFutexWaitJS,
204 "futexWake", AtomicsFutexWakeJS, 209 "futexWake", AtomicsFutexWakeJS,
205 "futexWakeOrRequeue", AtomicsFutexWakeOrRequeueJS, 210 "futexWakeOrRequeue", AtomicsFutexWakeOrRequeueJS,
206 ]); 211 ]);
207 212
208 }) 213 })
OLDNEW
« no previous file with comments | « src/harmony-array.js ('k') | src/harmony-typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698