Chromium Code Reviews| Index: src/bootstrapper.cc |
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
| index 2aa4e384a8fe96152a241cd05c3ba6559ea22ad2..8b3345afa955390bc2ce77cc85d3e28ebee9e2c9 100644 |
| --- a/src/bootstrapper.cc |
| +++ b/src/bootstrapper.cc |
| @@ -513,6 +513,13 @@ void InstallConstant(Isolate* isolate, Handle<JSObject> holder, |
| static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY)); |
| } |
| +void InstallSpeciesGetter(Handle<JSFunction> constructor) { |
| + Factory* factory = constructor->GetIsolate()->factory(); |
|
gsathya
2017/01/04 22:11:30
Why not just pass the isolate to this function? Th
adamk
2017/01/04 22:14:28
SimpleInstallGetter doesn't take an Isolate, so we
|
| + SimpleInstallGetter(constructor, factory->symbol_species_string(), |
|
adamk
2017/01/04 22:14:28
But speaking of micro-opts, it seems like I could
|
| + factory->species_symbol(), Builtins::kReturnReceiver, |
| + true); |
| +} |
| + |
| } // namespace |
| Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) { |
| @@ -1310,6 +1317,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
| InstallWithIntrinsicDefaultProto(isolate, array_function, |
| Context::ARRAY_FUNCTION_INDEX); |
| + InstallSpeciesGetter(array_function); |
| // Cache the array maps, needed by ArrayConstructorStub |
| CacheInitialJSArrayMaps(native_context(), initial_map); |
| @@ -1884,9 +1892,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
| InstallWithIntrinsicDefaultProto(isolate, promise_catch, |
| Context::PROMISE_CATCH_INDEX); |
| - SimpleInstallGetter(promise_fun, factory->symbol_species_string(), |
| - factory->species_symbol(), Builtins::kReturnReceiver, |
| - true); |
| + InstallSpeciesGetter(promise_fun); |
| Handle<Map> prototype_map(prototype->map()); |
| Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); |
| @@ -2069,9 +2075,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
| { |
| // RegExp getters and setters. |
| - SimpleInstallGetter(regexp_fun, factory->symbol_species_string(), |
| - factory->species_symbol(), Builtins::kReturnReceiver, |
| - true); |
| + InstallSpeciesGetter(regexp_fun); |
| // Static properties set by a successful match. |
| @@ -2396,6 +2400,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
| BuiltinFunctionId::kArrayBufferByteLength); |
| InstallWithIntrinsicDefaultProto(isolate, array_buffer_fun, |
| Context::ARRAY_BUFFER_FUN_INDEX); |
| + InstallSpeciesGetter(array_buffer_fun); |
| } |
| { // -- T y p e d A r r a y |
| @@ -2407,6 +2412,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
| CreateFunction(isolate, factory->InternalizeUtf8String("TypedArray"), |
| JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize, prototype, |
| Builtins::kIllegal); |
| + InstallSpeciesGetter(typed_array_fun); |
| // Install the "constructor" property on the {prototype}. |
| JSObject::AddProperty(prototype, factory->constructor_string(), |
| @@ -2534,6 +2540,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
| isolate->initial_object_prototype(), Builtins::kIllegal); |
| InstallWithIntrinsicDefaultProto(isolate, js_map_fun, |
| Context::JS_MAP_FUN_INDEX); |
| + InstallSpeciesGetter(js_map_fun); |
| } |
| { // -- S e t |
| @@ -2542,6 +2549,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
| isolate->initial_object_prototype(), Builtins::kIllegal); |
| InstallWithIntrinsicDefaultProto(isolate, js_set_fun, |
| Context::JS_SET_FUN_INDEX); |
| + InstallSpeciesGetter(js_set_fun); |
| } |
| { // -- J S M o d u l e N a m e s p a c e |