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

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

Issue 1477073005: Use new.target in favor of %_IsConstructCall intrinsic (1). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/js/collection.js ('k') | src/js/harmony-simd.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 var GlobalSharedArrayBuffer = global.SharedArrayBuffer; 11 var GlobalSharedArrayBuffer = global.SharedArrayBuffer;
12 var GlobalObject = global.Object; 12 var GlobalObject = global.Object;
13 var MakeTypeError; 13 var MakeTypeError;
14 var ToPositiveInteger; 14 var ToPositiveInteger;
15 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); 15 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
16 16
17 utils.Import(function(from) { 17 utils.Import(function(from) {
18 MakeTypeError = from.MakeTypeError; 18 MakeTypeError = from.MakeTypeError;
19 ToPositiveInteger = from.ToPositiveInteger; 19 ToPositiveInteger = from.ToPositiveInteger;
20 }) 20 })
21 21
22 // ------------------------------------------------------------------- 22 // -------------------------------------------------------------------
23 23
24 function SharedArrayBufferConstructor(length) { // length = 1 24 function SharedArrayBufferConstructor(length) { // length = 1
25 if (%_IsConstructCall()) { 25 if (!IS_UNDEFINED(new.target)) {
26 var byteLength = ToPositiveInteger(length, kInvalidArrayBufferLength); 26 var byteLength = ToPositiveInteger(length, kInvalidArrayBufferLength);
27 %ArrayBufferInitialize(this, byteLength, kShared); 27 %ArrayBufferInitialize(this, byteLength, kShared);
28 } else { 28 } else {
29 throw MakeTypeError(kConstructorNotFunction, "SharedArrayBuffer"); 29 throw MakeTypeError(kConstructorNotFunction, "SharedArrayBuffer");
30 } 30 }
31 } 31 }
32 32
33 function SharedArrayBufferGetByteLen() { 33 function SharedArrayBufferGetByteLen() {
34 if (!IS_SHAREDARRAYBUFFER(this)) { 34 if (!IS_SHAREDARRAYBUFFER(this)) {
35 throw MakeTypeError(kIncompatibleMethodReceiver, 35 throw MakeTypeError(kIncompatibleMethodReceiver,
(...skipping 19 matching lines...) Expand all
55 toStringTagSymbol, "SharedArrayBuffer", DONT_ENUM | READ_ONLY); 55 toStringTagSymbol, "SharedArrayBuffer", DONT_ENUM | READ_ONLY);
56 56
57 utils.InstallGetter(GlobalSharedArrayBuffer.prototype, "byteLength", 57 utils.InstallGetter(GlobalSharedArrayBuffer.prototype, "byteLength",
58 SharedArrayBufferGetByteLen); 58 SharedArrayBufferGetByteLen);
59 59
60 utils.InstallFunctions(GlobalSharedArrayBuffer, DONT_ENUM, [ 60 utils.InstallFunctions(GlobalSharedArrayBuffer, DONT_ENUM, [
61 "isView", SharedArrayBufferIsViewJS 61 "isView", SharedArrayBufferIsViewJS
62 ]); 62 ]);
63 63
64 }) 64 })
OLDNEW
« no previous file with comments | « src/js/collection.js ('k') | src/js/harmony-simd.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698