OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 utils.Import(function(from) { | 22 utils.Import(function(from) { |
23 MakeTypeError = from.MakeTypeError; | 23 MakeTypeError = from.MakeTypeError; |
24 MaxSimple = from.MaxSimple; | 24 MaxSimple = from.MaxSimple; |
25 MinSimple = from.MinSimple; | 25 MinSimple = from.MinSimple; |
26 ToPositiveInteger = from.ToPositiveInteger; | 26 ToPositiveInteger = from.ToPositiveInteger; |
27 }); | 27 }); |
28 | 28 |
29 // ------------------------------------------------------------------- | 29 // ------------------------------------------------------------------- |
30 | 30 |
31 function ArrayBufferConstructor(length) { // length = 1 | 31 function ArrayBufferConstructor(length) { // length = 1 |
32 if (%_IsConstructCall()) { | 32 if (!IS_UNDEFINED(new.target)) { |
33 var byteLength = ToPositiveInteger(length, kInvalidArrayBufferLength); | 33 var byteLength = ToPositiveInteger(length, kInvalidArrayBufferLength); |
34 %ArrayBufferInitialize(this, byteLength, kNotShared); | 34 %ArrayBufferInitialize(this, byteLength, kNotShared); |
35 } else { | 35 } else { |
36 throw MakeTypeError(kConstructorNotFunction, "ArrayBuffer"); | 36 throw MakeTypeError(kConstructorNotFunction, "ArrayBuffer"); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 function ArrayBufferGetByteLen() { | 40 function ArrayBufferGetByteLen() { |
41 if (!IS_ARRAYBUFFER(this)) { | 41 if (!IS_ARRAYBUFFER(this)) { |
42 throw MakeTypeError(kIncompatibleMethodReceiver, | 42 throw MakeTypeError(kIncompatibleMethodReceiver, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 utils.InstallFunctions(GlobalArrayBuffer, DONT_ENUM, [ | 104 utils.InstallFunctions(GlobalArrayBuffer, DONT_ENUM, [ |
105 "isView", ArrayBufferIsViewJS | 105 "isView", ArrayBufferIsViewJS |
106 ]); | 106 ]); |
107 | 107 |
108 utils.InstallFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [ | 108 utils.InstallFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [ |
109 "slice", ArrayBufferSlice | 109 "slice", ArrayBufferSlice |
110 ]); | 110 ]); |
111 | 111 |
112 }) | 112 }) |
OLD | NEW |