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

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

Issue 2659083004: [SAB] Fix crash in Atomics.wake w/ infinite count. (Closed)
Patch Set: fix Created 3 years, 10 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/futex-emulation.cc ('k') | src/runtime/runtime-futex.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 MaxSimple; 15 var MaxSimple;
16 var MinSimple;
16 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); 17 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
17 18
18 utils.Import(function(from) { 19 utils.Import(function(from) {
19 MaxSimple = from.MaxSimple; 20 MaxSimple = from.MaxSimple;
21 MinSimple = from.MinSimple;
20 }); 22 });
21 23
22 // ------------------------------------------------------------------- 24 // -------------------------------------------------------------------
23 25
24 26
25 function CheckSharedIntegerTypedArray(ia) { 27 function CheckSharedIntegerTypedArray(ia) {
26 if (!%IsSharedIntegerTypedArray(ia)) { 28 if (!%IsSharedIntegerTypedArray(ia)) {
27 throw %make_type_error(kNotIntegerSharedTypedArray, ia); 29 throw %make_type_error(kNotIntegerSharedTypedArray, ia);
28 } 30 }
29 } 31 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } else { 118 } else {
117 timeout = MaxSimple(0, timeout); 119 timeout = MaxSimple(0, timeout);
118 } 120 }
119 } 121 }
120 return %AtomicsWait(ia, index, value, timeout); 122 return %AtomicsWait(ia, index, value, timeout);
121 } 123 }
122 124
123 function AtomicsWakeJS(ia, index, count) { 125 function AtomicsWakeJS(ia, index, count) {
124 CheckSharedInteger32TypedArray(ia); 126 CheckSharedInteger32TypedArray(ia);
125 index = ValidateIndex(index, %_TypedArrayGetLength(ia)); 127 index = ValidateIndex(index, %_TypedArrayGetLength(ia));
126 count = MaxSimple(0, TO_INTEGER(count)); 128 if (IS_UNDEFINED(count)) {
129 count = kMaxUint32;
130 } else {
131 // Clamp to [0, kMaxUint32].
132 count = MinSimple(MaxSimple(0, TO_INTEGER(count)), kMaxUint32);
133 }
127 return %AtomicsWake(ia, index, count); 134 return %AtomicsWake(ia, index, count);
128 } 135 }
129 136
130 // ------------------------------------------------------------------- 137 // -------------------------------------------------------------------
131 138
132 var Atomics = global.Atomics; 139 var Atomics = global.Atomics;
133 140
134 // The Atomics global is defined by the bootstrapper. 141 // The Atomics global is defined by the bootstrapper.
135 142
136 %AddNamedProperty(Atomics, toStringTagSymbol, "Atomics", READ_ONLY | DONT_ENUM); 143 %AddNamedProperty(Atomics, toStringTagSymbol, "Atomics", READ_ONLY | DONT_ENUM);
137 144
138 utils.InstallFunctions(Atomics, DONT_ENUM, [ 145 utils.InstallFunctions(Atomics, DONT_ENUM, [
139 // TODO(binji): remove the rest of the (non futex) Atomics functions as they 146 // TODO(binji): remove the rest of the (non futex) Atomics functions as they
140 // become builtins. 147 // become builtins.
141 "compareExchange", AtomicsCompareExchangeJS, 148 "compareExchange", AtomicsCompareExchangeJS,
142 "add", AtomicsAddJS, 149 "add", AtomicsAddJS,
143 "sub", AtomicsSubJS, 150 "sub", AtomicsSubJS,
144 "and", AtomicsAndJS, 151 "and", AtomicsAndJS,
145 "or", AtomicsOrJS, 152 "or", AtomicsOrJS,
146 "xor", AtomicsXorJS, 153 "xor", AtomicsXorJS,
147 "exchange", AtomicsExchangeJS, 154 "exchange", AtomicsExchangeJS,
148 "isLockFree", AtomicsIsLockFreeJS, 155 "isLockFree", AtomicsIsLockFreeJS,
149 "wait", AtomicsWaitJS, 156 "wait", AtomicsWaitJS,
150 "wake", AtomicsWakeJS, 157 "wake", AtomicsWakeJS,
151 ]); 158 ]);
152 159
153 }) 160 })
OLDNEW
« no previous file with comments | « src/futex-emulation.cc ('k') | src/runtime/runtime-futex.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698