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

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

Issue 1302533002: Native context: debug.js does not load from js builtins object anymore. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: make importing requirement more explicit Created 5 years, 4 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-object.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
16 var MathMax; 15 var MathMax;
16 var ToNumber;
17 17
18 utils.Import(function(from) { 18 utils.Import(function(from) {
19 MathMax = from.MathMax; 19 MathMax = from.MathMax;
20 ToNumber = from.ToNumber;
20 }); 21 });
21 22
22 // ------------------------------------------------------------------- 23 // -------------------------------------------------------------------
23 24
24 25
25 function CheckSharedTypedArray(sta) { 26 function CheckSharedTypedArray(sta) {
26 if (!%IsSharedTypedArray(sta)) { 27 if (!%IsSharedTypedArray(sta)) {
27 throw MakeTypeError(kNotSharedTypedArray, sta); 28 throw MakeTypeError(kNotSharedTypedArray, sta);
28 } 29 }
29 } 30 }
(...skipping 12 matching lines...) Expand all
42 } 43 }
43 44
44 //------------------------------------------------------------------- 45 //-------------------------------------------------------------------
45 46
46 function AtomicsCompareExchangeJS(sta, index, oldValue, newValue) { 47 function AtomicsCompareExchangeJS(sta, index, oldValue, newValue) {
47 CheckSharedTypedArray(sta); 48 CheckSharedTypedArray(sta);
48 index = $toInteger(index); 49 index = $toInteger(index);
49 if (index < 0 || index >= %_TypedArrayGetLength(sta)) { 50 if (index < 0 || index >= %_TypedArrayGetLength(sta)) {
50 return UNDEFINED; 51 return UNDEFINED;
51 } 52 }
52 oldValue = $toNumber(oldValue); 53 oldValue = ToNumber(oldValue);
53 newValue = $toNumber(newValue); 54 newValue = ToNumber(newValue);
54 return %_AtomicsCompareExchange(sta, index, oldValue, newValue); 55 return %_AtomicsCompareExchange(sta, index, oldValue, newValue);
55 } 56 }
56 57
57 function AtomicsLoadJS(sta, index) { 58 function AtomicsLoadJS(sta, index) {
58 CheckSharedTypedArray(sta); 59 CheckSharedTypedArray(sta);
59 index = $toInteger(index); 60 index = $toInteger(index);
60 if (index < 0 || index >= %_TypedArrayGetLength(sta)) { 61 if (index < 0 || index >= %_TypedArrayGetLength(sta)) {
61 return UNDEFINED; 62 return UNDEFINED;
62 } 63 }
63 return %_AtomicsLoad(sta, index); 64 return %_AtomicsLoad(sta, index);
64 } 65 }
65 66
66 function AtomicsStoreJS(sta, index, value) { 67 function AtomicsStoreJS(sta, index, value) {
67 CheckSharedTypedArray(sta); 68 CheckSharedTypedArray(sta);
68 index = $toInteger(index); 69 index = $toInteger(index);
69 if (index < 0 || index >= %_TypedArrayGetLength(sta)) { 70 if (index < 0 || index >= %_TypedArrayGetLength(sta)) {
70 return UNDEFINED; 71 return UNDEFINED;
71 } 72 }
72 value = $toNumber(value); 73 value = ToNumber(value);
73 return %_AtomicsStore(sta, index, value); 74 return %_AtomicsStore(sta, index, value);
74 } 75 }
75 76
76 function AtomicsAddJS(ia, index, value) { 77 function AtomicsAddJS(ia, index, value) {
77 CheckSharedIntegerTypedArray(ia); 78 CheckSharedIntegerTypedArray(ia);
78 index = $toInteger(index); 79 index = $toInteger(index);
79 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { 80 if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
80 return UNDEFINED; 81 return UNDEFINED;
81 } 82 }
82 value = $toNumber(value); 83 value = ToNumber(value);
83 return %_AtomicsAdd(ia, index, value); 84 return %_AtomicsAdd(ia, index, value);
84 } 85 }
85 86
86 function AtomicsSubJS(ia, index, value) { 87 function AtomicsSubJS(ia, index, value) {
87 CheckSharedIntegerTypedArray(ia); 88 CheckSharedIntegerTypedArray(ia);
88 index = $toInteger(index); 89 index = $toInteger(index);
89 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { 90 if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
90 return UNDEFINED; 91 return UNDEFINED;
91 } 92 }
92 value = $toNumber(value); 93 value = ToNumber(value);
93 return %_AtomicsSub(ia, index, value); 94 return %_AtomicsSub(ia, index, value);
94 } 95 }
95 96
96 function AtomicsAndJS(ia, index, value) { 97 function AtomicsAndJS(ia, index, value) {
97 CheckSharedIntegerTypedArray(ia); 98 CheckSharedIntegerTypedArray(ia);
98 index = $toInteger(index); 99 index = $toInteger(index);
99 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { 100 if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
100 return UNDEFINED; 101 return UNDEFINED;
101 } 102 }
102 value = $toNumber(value); 103 value = ToNumber(value);
103 return %_AtomicsAnd(ia, index, value); 104 return %_AtomicsAnd(ia, index, value);
104 } 105 }
105 106
106 function AtomicsOrJS(ia, index, value) { 107 function AtomicsOrJS(ia, index, value) {
107 CheckSharedIntegerTypedArray(ia); 108 CheckSharedIntegerTypedArray(ia);
108 index = $toInteger(index); 109 index = $toInteger(index);
109 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { 110 if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
110 return UNDEFINED; 111 return UNDEFINED;
111 } 112 }
112 value = $toNumber(value); 113 value = ToNumber(value);
113 return %_AtomicsOr(ia, index, value); 114 return %_AtomicsOr(ia, index, value);
114 } 115 }
115 116
116 function AtomicsXorJS(ia, index, value) { 117 function AtomicsXorJS(ia, index, value) {
117 CheckSharedIntegerTypedArray(ia); 118 CheckSharedIntegerTypedArray(ia);
118 index = $toInteger(index); 119 index = $toInteger(index);
119 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { 120 if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
120 return UNDEFINED; 121 return UNDEFINED;
121 } 122 }
122 value = $toNumber(value); 123 value = ToNumber(value);
123 return %_AtomicsXor(ia, index, value); 124 return %_AtomicsXor(ia, index, value);
124 } 125 }
125 126
126 function AtomicsExchangeJS(ia, index, value) { 127 function AtomicsExchangeJS(ia, index, value) {
127 CheckSharedIntegerTypedArray(ia); 128 CheckSharedIntegerTypedArray(ia);
128 index = $toInteger(index); 129 index = $toInteger(index);
129 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { 130 if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
130 return UNDEFINED; 131 return UNDEFINED;
131 } 132 }
132 value = $toNumber(value); 133 value = ToNumber(value);
133 return %_AtomicsExchange(ia, index, value); 134 return %_AtomicsExchange(ia, index, value);
134 } 135 }
135 136
136 function AtomicsIsLockFreeJS(size) { 137 function AtomicsIsLockFreeJS(size) {
137 return %_AtomicsIsLockFree(size); 138 return %_AtomicsIsLockFree(size);
138 } 139 }
139 140
140 // Futexes 141 // Futexes
141 142
142 function AtomicsFutexWaitJS(ia, index, value, timeout) { 143 function AtomicsFutexWaitJS(ia, index, value, timeout) {
143 CheckSharedInteger32TypedArray(ia); 144 CheckSharedInteger32TypedArray(ia);
144 index = $toInteger(index); 145 index = $toInteger(index);
145 if (index < 0 || index >= %_TypedArrayGetLength(ia)) { 146 if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
146 return UNDEFINED; 147 return UNDEFINED;
147 } 148 }
148 if (IS_UNDEFINED(timeout)) { 149 if (IS_UNDEFINED(timeout)) {
149 timeout = INFINITY; 150 timeout = INFINITY;
150 } else { 151 } else {
151 timeout = $toNumber(timeout); 152 timeout = ToNumber(timeout);
152 if (NUMBER_IS_NAN(timeout)) { 153 if (NUMBER_IS_NAN(timeout)) {
153 timeout = INFINITY; 154 timeout = INFINITY;
154 } else { 155 } else {
155 timeout = MathMax(0, timeout); 156 timeout = MathMax(0, timeout);
156 } 157 }
157 } 158 }
158 return %AtomicsFutexWait(ia, index, value, timeout); 159 return %AtomicsFutexWait(ia, index, value, timeout);
159 } 160 }
160 161
161 function AtomicsFutexWakeJS(ia, index, count) { 162 function AtomicsFutexWakeJS(ia, index, count) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 "or", AtomicsOrJS, 211 "or", AtomicsOrJS,
211 "xor", AtomicsXorJS, 212 "xor", AtomicsXorJS,
212 "exchange", AtomicsExchangeJS, 213 "exchange", AtomicsExchangeJS,
213 "isLockFree", AtomicsIsLockFreeJS, 214 "isLockFree", AtomicsIsLockFreeJS,
214 "futexWait", AtomicsFutexWaitJS, 215 "futexWait", AtomicsFutexWaitJS,
215 "futexWake", AtomicsFutexWakeJS, 216 "futexWake", AtomicsFutexWakeJS,
216 "futexWakeOrRequeue", AtomicsFutexWakeOrRequeueJS, 217 "futexWakeOrRequeue", AtomicsFutexWakeOrRequeueJS,
217 ]); 218 ]);
218 219
219 }) 220 })
OLDNEW
« no previous file with comments | « src/harmony-array.js ('k') | src/harmony-object.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698