Ben Murdoch | 4a90d5f | 2016-03-22 12:00:34 +0000 | [diff] [blame] | 1 | // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | (function(global, utils, extrasUtils) { |
| 6 | |
| 7 | "use strict"; |
| 8 | |
| 9 | %CheckIsBootstrapping(); |
| 10 | |
| 11 | var GlobalArray = global.Array; |
| 12 | // It is important that this file is run after src/js/typedarray.js, |
| 13 | // otherwise GlobalTypedArray would be Object, and we would break |
| 14 | // old versions of Zepto. |
| 15 | var GlobalTypedArray = global.Uint8Array.__proto__; |
| 16 | var GlobalMap = global.Map; |
| 17 | var GlobalSet = global.Set; |
| 18 | var GlobalArrayBuffer = global.ArrayBuffer; |
| 19 | var GlobalPromise = global.Promise; |
| 20 | var GlobalRegExp = global.RegExp; |
| 21 | var speciesSymbol = utils.ImportNow("species_symbol"); |
| 22 | |
| 23 | function ArraySpecies() { |
| 24 | return this; |
| 25 | } |
| 26 | |
| 27 | function TypedArraySpecies() { |
| 28 | return this; |
| 29 | } |
| 30 | |
| 31 | function MapSpecies() { |
| 32 | return this; |
| 33 | } |
| 34 | |
| 35 | function SetSpecies() { |
| 36 | return this; |
| 37 | } |
| 38 | |
| 39 | function ArrayBufferSpecies() { |
| 40 | return this; |
| 41 | } |
| 42 | |
| 43 | function PromiseSpecies() { |
| 44 | return this; |
| 45 | } |
| 46 | |
| 47 | function RegExpSpecies() { |
| 48 | return this; |
| 49 | } |
| 50 | |
| 51 | utils.InstallGetter(GlobalArray, speciesSymbol, ArraySpecies, DONT_ENUM); |
| 52 | utils.InstallGetter(GlobalTypedArray, speciesSymbol, TypedArraySpecies, DONT_ENUM); |
| 53 | utils.InstallGetter(GlobalMap, speciesSymbol, MapSpecies, DONT_ENUM); |
| 54 | utils.InstallGetter(GlobalSet, speciesSymbol, SetSpecies, DONT_ENUM); |
| 55 | utils.InstallGetter(GlobalArrayBuffer, speciesSymbol, ArrayBufferSpecies, |
| 56 | DONT_ENUM); |
| 57 | utils.InstallGetter(GlobalPromise, speciesSymbol, PromiseSpecies, DONT_ENUM); |
| 58 | utils.InstallGetter(GlobalRegExp, speciesSymbol, RegExpSpecies, DONT_ENUM); |
| 59 | |
| 60 | }); |