| 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 MakeTypeError; | 15 var MakeTypeError; |
| 16 var MaxSimple; | 16 var MaxSimple; |
| 17 var MinSimple; | 17 var MinSimple; |
| 18 var SpeciesConstructor; | 18 var SpeciesConstructor; |
| 19 var speciesSymbol = utils.ImportNow("species_symbol"); |
| 19 | 20 |
| 20 utils.Import(function(from) { | 21 utils.Import(function(from) { |
| 21 MakeTypeError = from.MakeTypeError; | 22 MakeTypeError = from.MakeTypeError; |
| 22 MaxSimple = from.MaxSimple; | 23 MaxSimple = from.MaxSimple; |
| 23 MinSimple = from.MinSimple; | 24 MinSimple = from.MinSimple; |
| 24 SpeciesConstructor = from.SpeciesConstructor; | 25 SpeciesConstructor = from.SpeciesConstructor; |
| 25 }); | 26 }); |
| 26 | 27 |
| 27 // ------------------------------------------------------------------- | 28 // ------------------------------------------------------------------- |
| 28 | 29 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 throw MakeTypeError(kArrayBufferSpeciesThis); | 78 throw MakeTypeError(kArrayBufferSpeciesThis); |
| 78 } | 79 } |
| 79 if (%_ArrayBufferGetByteLength(result) < newLen) { | 80 if (%_ArrayBufferGetByteLength(result) < newLen) { |
| 80 throw MakeTypeError(kArrayBufferTooShort); | 81 throw MakeTypeError(kArrayBufferTooShort); |
| 81 } | 82 } |
| 82 | 83 |
| 83 %ArrayBufferSliceImpl(this, result, first, newLen); | 84 %ArrayBufferSliceImpl(this, result, first, newLen); |
| 84 return result; | 85 return result; |
| 85 } | 86 } |
| 86 | 87 |
| 88 |
| 89 function ArrayBufferSpecies() { |
| 90 return this; |
| 91 } |
| 92 |
| 93 utils.InstallGetter(GlobalArrayBuffer, speciesSymbol, ArrayBufferSpecies); |
| 94 |
| 87 utils.InstallGetter(GlobalArrayBuffer.prototype, "byteLength", | 95 utils.InstallGetter(GlobalArrayBuffer.prototype, "byteLength", |
| 88 ArrayBufferGetByteLen); | 96 ArrayBufferGetByteLen); |
| 89 | 97 |
| 90 utils.InstallFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [ | 98 utils.InstallFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [ |
| 91 "slice", ArrayBufferSlice | 99 "slice", ArrayBufferSlice |
| 92 ]); | 100 ]); |
| 93 | 101 |
| 94 }) | 102 }) |
| OLD | NEW |