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

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

Issue 1318713007: [Atomics] Remove support for atomic accesses on floating-point values. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: feedback Created 5 years, 3 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 | « no previous file | src/runtime/runtime-atomics.cc » ('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 MathMax;
16 var ToNumber; 16 var ToNumber;
17 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); 17 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
18 18
19 utils.Import(function(from) { 19 utils.Import(function(from) {
20 MathMax = from.MathMax; 20 MathMax = from.MathMax;
21 ToNumber = from.ToNumber; 21 ToNumber = from.ToNumber;
22 }); 22 });
23 23
24 // ------------------------------------------------------------------- 24 // -------------------------------------------------------------------
25 25
26 26
27 function CheckSharedTypedArray(sta) {
28 if (!%IsSharedTypedArray(sta)) {
29 throw MakeTypeError(kNotSharedTypedArray, sta);
30 }
31 }
32
33 function CheckSharedIntegerTypedArray(ia) { 27 function CheckSharedIntegerTypedArray(ia) {
34 if (!%IsSharedIntegerTypedArray(ia)) { 28 if (!%IsSharedIntegerTypedArray(ia)) {
35 throw MakeTypeError(kNotIntegerSharedTypedArray, ia); 29 throw MakeTypeError(kNotIntegerSharedTypedArray, ia);
36 } 30 }
37 } 31 }
38 32
39 function CheckSharedInteger32TypedArray(ia) { 33 function CheckSharedInteger32TypedArray(ia) {
40 CheckSharedIntegerTypedArray(ia); 34 CheckSharedIntegerTypedArray(ia);
41 if (%_ClassOf(ia) !== 'Int32Array') { 35 if (%_ClassOf(ia) !== 'Int32Array') {
42 throw MakeTypeError(kNotInt32SharedTypedArray, ia); 36 throw MakeTypeError(kNotInt32SharedTypedArray, ia);
43 } 37 }
44 } 38 }
45 39
46 //------------------------------------------------------------------- 40 //-------------------------------------------------------------------
47 41
48 function AtomicsCompareExchangeJS(sta, index, oldValue, newValue) { 42 function AtomicsCompareExchangeJS(sta, index, oldValue, newValue) {
49 CheckSharedTypedArray(sta); 43 CheckSharedIntegerTypedArray(sta);
50 index = $toInteger(index); 44 index = $toInteger(index);
51 if (index < 0 || index >= %_TypedArrayGetLength(sta)) { 45 if (index < 0 || index >= %_TypedArrayGetLength(sta)) {
52 return UNDEFINED; 46 return UNDEFINED;
53 } 47 }
54 oldValue = ToNumber(oldValue); 48 oldValue = ToNumber(oldValue);
55 newValue = ToNumber(newValue); 49 newValue = ToNumber(newValue);
56 return %_AtomicsCompareExchange(sta, index, oldValue, newValue); 50 return %_AtomicsCompareExchange(sta, index, oldValue, newValue);
57 } 51 }
58 52
59 function AtomicsLoadJS(sta, index) { 53 function AtomicsLoadJS(sta, index) {
60 CheckSharedTypedArray(sta); 54 CheckSharedIntegerTypedArray(sta);
61 index = $toInteger(index); 55 index = $toInteger(index);
62 if (index < 0 || index >= %_TypedArrayGetLength(sta)) { 56 if (index < 0 || index >= %_TypedArrayGetLength(sta)) {
63 return UNDEFINED; 57 return UNDEFINED;
64 } 58 }
65 return %_AtomicsLoad(sta, index); 59 return %_AtomicsLoad(sta, index);
66 } 60 }
67 61
68 function AtomicsStoreJS(sta, index, value) { 62 function AtomicsStoreJS(sta, index, value) {
69 CheckSharedTypedArray(sta); 63 CheckSharedIntegerTypedArray(sta);
70 index = $toInteger(index); 64 index = $toInteger(index);
71 if (index < 0 || index >= %_TypedArrayGetLength(sta)) { 65 if (index < 0 || index >= %_TypedArrayGetLength(sta)) {
72 return UNDEFINED; 66 return UNDEFINED;
73 } 67 }
74 value = ToNumber(value); 68 value = ToNumber(value);
75 return %_AtomicsStore(sta, index, value); 69 return %_AtomicsStore(sta, index, value);
76 } 70 }
77 71
78 function AtomicsAddJS(ia, index, value) { 72 function AtomicsAddJS(ia, index, value) {
79 CheckSharedIntegerTypedArray(ia); 73 CheckSharedIntegerTypedArray(ia);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 "or", AtomicsOrJS, 206 "or", AtomicsOrJS,
213 "xor", AtomicsXorJS, 207 "xor", AtomicsXorJS,
214 "exchange", AtomicsExchangeJS, 208 "exchange", AtomicsExchangeJS,
215 "isLockFree", AtomicsIsLockFreeJS, 209 "isLockFree", AtomicsIsLockFreeJS,
216 "futexWait", AtomicsFutexWaitJS, 210 "futexWait", AtomicsFutexWaitJS,
217 "futexWake", AtomicsFutexWakeJS, 211 "futexWake", AtomicsFutexWakeJS,
218 "futexWakeOrRequeue", AtomicsFutexWakeOrRequeueJS, 212 "futexWakeOrRequeue", AtomicsFutexWakeOrRequeueJS,
219 ]); 213 ]);
220 214
221 }) 215 })
OLDNEW
« no previous file with comments | « no previous file | src/runtime/runtime-atomics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698