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

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

Issue 2222893002: Move family of MakeError functions to C++ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix in prologue.js Created 4 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
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 MakeRangeError;
16 var MakeTypeError;
17 var MaxSimple; 15 var MaxSimple;
18 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); 16 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
19 17
20 utils.Import(function(from) { 18 utils.Import(function(from) {
21 MakeTypeError = from.MakeTypeError;
22 MakeRangeError = from.MakeRangeError;
23 MaxSimple = from.MaxSimple; 19 MaxSimple = from.MaxSimple;
24 }); 20 });
25 21
26 // ------------------------------------------------------------------- 22 // -------------------------------------------------------------------
27 23
28 24
29 function CheckSharedIntegerTypedArray(ia) { 25 function CheckSharedIntegerTypedArray(ia) {
30 if (!%IsSharedIntegerTypedArray(ia)) { 26 if (!%IsSharedIntegerTypedArray(ia)) {
31 throw MakeTypeError(kNotIntegerSharedTypedArray, ia); 27 throw %make_type_error(kNotIntegerSharedTypedArray, ia);
32 } 28 }
33 } 29 }
34 30
35 function CheckSharedInteger32TypedArray(ia) { 31 function CheckSharedInteger32TypedArray(ia) {
36 CheckSharedIntegerTypedArray(ia); 32 CheckSharedIntegerTypedArray(ia);
37 if (!%IsSharedInteger32TypedArray(ia)) { 33 if (!%IsSharedInteger32TypedArray(ia)) {
38 throw MakeTypeError(kNotInt32SharedTypedArray, ia); 34 throw %make_type_error(kNotInt32SharedTypedArray, ia);
39 } 35 }
40 } 36 }
41 37
42 // https://tc39.github.io/ecmascript_sharedmem/shmem.html#Atomics.ValidateAtomic Access 38 // https://tc39.github.io/ecmascript_sharedmem/shmem.html#Atomics.ValidateAtomic Access
43 function ValidateIndex(index, length) { 39 function ValidateIndex(index, length) {
44 var numberIndex = TO_NUMBER(index); 40 var numberIndex = TO_NUMBER(index);
45 var accessIndex = TO_INTEGER(numberIndex); 41 var accessIndex = TO_INTEGER(numberIndex);
46 if (numberIndex !== accessIndex) { 42 if (numberIndex !== accessIndex) {
47 throw MakeRangeError(kInvalidAtomicAccessIndex); 43 throw %make_range_error(kInvalidAtomicAccessIndex);
48 } 44 }
49 if (accessIndex < 0 || accessIndex >= length) { 45 if (accessIndex < 0 || accessIndex >= length) {
50 throw MakeRangeError(kInvalidAtomicAccessIndex); 46 throw %make_range_error(kInvalidAtomicAccessIndex);
51 } 47 }
52 return accessIndex; 48 return accessIndex;
53 } 49 }
54 50
55 //------------------------------------------------------------------- 51 //-------------------------------------------------------------------
56 52
57 function AtomicsCompareExchangeJS(sta, index, oldValue, newValue) { 53 function AtomicsCompareExchangeJS(sta, index, oldValue, newValue) {
58 CheckSharedIntegerTypedArray(sta); 54 CheckSharedIntegerTypedArray(sta);
59 index = ValidateIndex(index, %_TypedArrayGetLength(sta)); 55 index = ValidateIndex(index, %_TypedArrayGetLength(sta));
60 oldValue = TO_NUMBER(oldValue); 56 oldValue = TO_NUMBER(oldValue);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 "and", AtomicsAndJS, 144 "and", AtomicsAndJS,
149 "or", AtomicsOrJS, 145 "or", AtomicsOrJS,
150 "xor", AtomicsXorJS, 146 "xor", AtomicsXorJS,
151 "exchange", AtomicsExchangeJS, 147 "exchange", AtomicsExchangeJS,
152 "isLockFree", AtomicsIsLockFreeJS, 148 "isLockFree", AtomicsIsLockFreeJS,
153 "wait", AtomicsWaitJS, 149 "wait", AtomicsWaitJS,
154 "wake", AtomicsWakeJS, 150 "wake", AtomicsWakeJS,
155 ]); 151 ]);
156 152
157 }) 153 })
OLDNEW
« src/bootstrapper.cc ('K') | « src/js/collection-iterator.js ('k') | src/js/harmony-simd.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698