| 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 MaxSimple; | 15 var MaxSimple; |
| 16 var MinSimple; | 16 var MinSimple; |
| 17 var SpeciesConstructor; | 17 var SpeciesConstructor; |
| 18 var speciesSymbol = utils.ImportNow("species_symbol"); | |
| 19 | 18 |
| 20 utils.Import(function(from) { | 19 utils.Import(function(from) { |
| 21 MaxSimple = from.MaxSimple; | 20 MaxSimple = from.MaxSimple; |
| 22 MinSimple = from.MinSimple; | 21 MinSimple = from.MinSimple; |
| 23 SpeciesConstructor = from.SpeciesConstructor; | 22 SpeciesConstructor = from.SpeciesConstructor; |
| 24 }); | 23 }); |
| 25 | 24 |
| 26 // ------------------------------------------------------------------- | 25 // ------------------------------------------------------------------- |
| 27 | 26 |
| 28 // ES6 Draft 15.13.5.5.3 | 27 // ES6 Draft 15.13.5.5.3 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 throw %make_type_error(kArrayBufferSpeciesThis); | 67 throw %make_type_error(kArrayBufferSpeciesThis); |
| 69 } | 68 } |
| 70 if (%_ArrayBufferGetByteLength(result) < newLen) { | 69 if (%_ArrayBufferGetByteLength(result) < newLen) { |
| 71 throw %make_type_error(kArrayBufferTooShort); | 70 throw %make_type_error(kArrayBufferTooShort); |
| 72 } | 71 } |
| 73 | 72 |
| 74 %ArrayBufferSliceImpl(this, result, first, newLen); | 73 %ArrayBufferSliceImpl(this, result, first, newLen); |
| 75 return result; | 74 return result; |
| 76 } | 75 } |
| 77 | 76 |
| 78 | |
| 79 function ArrayBufferSpecies() { | |
| 80 return this; | |
| 81 } | |
| 82 | |
| 83 utils.InstallGetter(GlobalArrayBuffer, speciesSymbol, ArrayBufferSpecies); | |
| 84 | |
| 85 utils.InstallFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [ | 77 utils.InstallFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [ |
| 86 "slice", ArrayBufferSlice | 78 "slice", ArrayBufferSlice |
| 87 ]); | 79 ]); |
| 88 | 80 |
| 89 }) | 81 }) |
| OLD | NEW |