| 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 var speciesSymbol = utils.ImportNow("species_symbol"); |
| 20 | 20 |
| 21 utils.Import(function(from) { | 21 utils.Import(function(from) { |
| 22 MakeTypeError = from.MakeTypeError; | 22 MakeTypeError = from.MakeTypeError; |
| 23 MaxSimple = from.MaxSimple; | 23 MaxSimple = from.MaxSimple; |
| 24 MinSimple = from.MinSimple; | 24 MinSimple = from.MinSimple; |
| 25 SpeciesConstructor = from.SpeciesConstructor; | 25 SpeciesConstructor = from.SpeciesConstructor; |
| 26 }); | 26 }); |
| 27 | 27 |
| 28 // ------------------------------------------------------------------- | 28 // ------------------------------------------------------------------- |
| 29 | 29 |
| 30 function ArrayBufferGetByteLen() { | |
| 31 if (!IS_ARRAYBUFFER(this)) { | |
| 32 throw MakeTypeError(kIncompatibleMethodReceiver, | |
| 33 'ArrayBuffer.prototype.byteLength', this); | |
| 34 } | |
| 35 return %_ArrayBufferGetByteLength(this); | |
| 36 } | |
| 37 | |
| 38 // ES6 Draft 15.13.5.5.3 | 30 // ES6 Draft 15.13.5.5.3 |
| 39 function ArrayBufferSlice(start, end) { | 31 function ArrayBufferSlice(start, end) { |
| 40 if (!IS_ARRAYBUFFER(this)) { | 32 if (!IS_ARRAYBUFFER(this)) { |
| 41 throw MakeTypeError(kIncompatibleMethodReceiver, | 33 throw MakeTypeError(kIncompatibleMethodReceiver, |
| 42 'ArrayBuffer.prototype.slice', this); | 34 'ArrayBuffer.prototype.slice', this); |
| 43 } | 35 } |
| 44 | 36 |
| 45 var relativeStart = TO_INTEGER(start); | 37 var relativeStart = TO_INTEGER(start); |
| 46 if (!IS_UNDEFINED(end)) { | 38 if (!IS_UNDEFINED(end)) { |
| 47 end = TO_INTEGER(end); | 39 end = TO_INTEGER(end); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return result; | 77 return result; |
| 86 } | 78 } |
| 87 | 79 |
| 88 | 80 |
| 89 function ArrayBufferSpecies() { | 81 function ArrayBufferSpecies() { |
| 90 return this; | 82 return this; |
| 91 } | 83 } |
| 92 | 84 |
| 93 utils.InstallGetter(GlobalArrayBuffer, speciesSymbol, ArrayBufferSpecies); | 85 utils.InstallGetter(GlobalArrayBuffer, speciesSymbol, ArrayBufferSpecies); |
| 94 | 86 |
| 95 utils.InstallGetter(GlobalArrayBuffer.prototype, "byteLength", | |
| 96 ArrayBufferGetByteLen); | |
| 97 | |
| 98 utils.InstallFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [ | 87 utils.InstallFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [ |
| 99 "slice", ArrayBufferSlice | 88 "slice", ArrayBufferSlice |
| 100 ]); | 89 ]); |
| 101 | 90 |
| 102 }) | 91 }) |
| OLD | NEW |