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 |
11 // ------------------------------------------------------------------- | 11 // ------------------------------------------------------------------- |
12 // Imports | 12 // Imports |
13 | 13 |
14 var GlobalArrayBuffer = global.ArrayBuffer; | 14 var GlobalArrayBuffer = global.ArrayBuffer; |
15 var GlobalObject = global.Object; | 15 var GlobalObject = global.Object; |
16 var MathMax; | 16 var MathMax; |
17 var MathMin; | 17 var MathMin; |
18 var ToNumber; | |
19 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); | 18 var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol"); |
20 | 19 |
21 utils.Import(function(from) { | 20 utils.Import(function(from) { |
22 MathMax = from.MathMax; | 21 MathMax = from.MathMax; |
23 MathMin = from.MathMin; | 22 MathMin = from.MathMin; |
24 ToNumber = from.ToNumber; | |
25 }); | 23 }); |
26 | 24 |
27 // ------------------------------------------------------------------- | 25 // ------------------------------------------------------------------- |
28 | 26 |
29 function ArrayBufferConstructor(length) { // length = 1 | 27 function ArrayBufferConstructor(length) { // length = 1 |
30 if (%_IsConstructCall()) { | 28 if (%_IsConstructCall()) { |
31 var byteLength = $toPositiveInteger(length, kInvalidArrayBufferLength); | 29 var byteLength = $toPositiveInteger(length, kInvalidArrayBufferLength); |
32 %ArrayBufferInitialize(this, byteLength, kNotShared); | 30 %ArrayBufferInitialize(this, byteLength, kNotShared); |
33 } else { | 31 } else { |
34 throw MakeTypeError(kConstructorNotFunction, "ArrayBuffer"); | 32 throw MakeTypeError(kConstructorNotFunction, "ArrayBuffer"); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 99 |
102 utils.InstallFunctions(GlobalArrayBuffer, DONT_ENUM, [ | 100 utils.InstallFunctions(GlobalArrayBuffer, DONT_ENUM, [ |
103 "isView", ArrayBufferIsViewJS | 101 "isView", ArrayBufferIsViewJS |
104 ]); | 102 ]); |
105 | 103 |
106 utils.InstallFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [ | 104 utils.InstallFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [ |
107 "slice", ArrayBufferSlice | 105 "slice", ArrayBufferSlice |
108 ]); | 106 ]); |
109 | 107 |
110 }) | 108 }) |
OLD | NEW |