| OLD | NEW | 
|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/bootstrapper.h" | 5 #include "src/bootstrapper.h" | 
| 6 | 6 | 
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" | 
| 8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" | 
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" | 
| 10 #include "src/extensions/externalize-string-extension.h" | 10 #include "src/extensions/externalize-string-extension.h" | 
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 151   void CreateRoots(); | 151   void CreateRoots(); | 
| 152   // Creates the empty function.  Used for creating a context from scratch. | 152   // Creates the empty function.  Used for creating a context from scratch. | 
| 153   Handle<JSFunction> CreateEmptyFunction(Isolate* isolate); | 153   Handle<JSFunction> CreateEmptyFunction(Isolate* isolate); | 
| 154   // Creates the ThrowTypeError function. ECMA 5th Ed. 13.2.3 | 154   // Creates the ThrowTypeError function. ECMA 5th Ed. 13.2.3 | 
| 155   Handle<JSFunction> GetRestrictedFunctionPropertiesThrower(); | 155   Handle<JSFunction> GetRestrictedFunctionPropertiesThrower(); | 
| 156   Handle<JSFunction> GetStrictArgumentsPoisonFunction(); | 156   Handle<JSFunction> GetStrictArgumentsPoisonFunction(); | 
| 157   Handle<JSFunction> GetThrowTypeErrorIntrinsic(Builtins::Name builtin_name); | 157   Handle<JSFunction> GetThrowTypeErrorIntrinsic(Builtins::Name builtin_name); | 
| 158 | 158 | 
| 159   void CreateStrictModeFunctionMaps(Handle<JSFunction> empty); | 159   void CreateStrictModeFunctionMaps(Handle<JSFunction> empty); | 
| 160   void CreateIteratorMaps(); | 160   void CreateIteratorMaps(); | 
|  | 161   void CreateJSProxyMaps(); | 
| 161 | 162 | 
| 162   // Make the "arguments" and "caller" properties throw a TypeError on access. | 163   // Make the "arguments" and "caller" properties throw a TypeError on access. | 
| 163   void AddRestrictedFunctionProperties(Handle<Map> map); | 164   void AddRestrictedFunctionProperties(Handle<Map> map); | 
| 164 | 165 | 
| 165   // Creates the global objects using the global proxy and the template passed | 166   // Creates the global objects using the global proxy and the template passed | 
| 166   // in through the API.  We call this regardless of whether we are building a | 167   // in through the API.  We call this regardless of whether we are building a | 
| 167   // context from scratch or using a deserialized one from the partial snapshot | 168   // context from scratch or using a deserialized one from the partial snapshot | 
| 168   // but in the latter case we don't use the objects it produces directly, as | 169   // but in the latter case we don't use the objects it produces directly, as | 
| 169   // we have to used the deserialized ones that are linked together with the | 170   // we have to used the deserialized ones that are linked together with the | 
| 170   // rest of the context snapshot. | 171   // rest of the context snapshot. | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 210 | 211 | 
| 211   void InstallTypedArray(const char* name, ElementsKind elements_kind, | 212   void InstallTypedArray(const char* name, ElementsKind elements_kind, | 
| 212                          Handle<JSFunction>* fun); | 213                          Handle<JSFunction>* fun); | 
| 213   bool InstallExperimentalNatives(); | 214   bool InstallExperimentalNatives(); | 
| 214   bool InstallExtraNatives(); | 215   bool InstallExtraNatives(); | 
| 215   bool InstallExperimentalExtraNatives(); | 216   bool InstallExperimentalExtraNatives(); | 
| 216   bool InstallDebuggerNatives(); | 217   bool InstallDebuggerNatives(); | 
| 217   void InstallBuiltinFunctionIds(); | 218   void InstallBuiltinFunctionIds(); | 
| 218   void InstallExperimentalBuiltinFunctionIds(); | 219   void InstallExperimentalBuiltinFunctionIds(); | 
| 219   void InitializeNormalizedMapCaches(); | 220   void InitializeNormalizedMapCaches(); | 
| 220   void InstallJSProxyMaps(); |  | 
| 221 | 221 | 
| 222   enum ExtensionTraversalState { | 222   enum ExtensionTraversalState { | 
| 223     UNVISITED, VISITED, INSTALLED | 223     UNVISITED, VISITED, INSTALLED | 
| 224   }; | 224   }; | 
| 225 | 225 | 
| 226   class ExtensionStates { | 226   class ExtensionStates { | 
| 227    public: | 227    public: | 
| 228     ExtensionStates(); | 228     ExtensionStates(); | 
| 229     ExtensionTraversalState get_state(RegisteredExtension* extension); | 229     ExtensionTraversalState get_state(RegisteredExtension* extension); | 
| 230     void set_state(RegisteredExtension* extension, | 230     void set_state(RegisteredExtension* extension, | 
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 747   native_context()->set_strict_generator_function_map( | 747   native_context()->set_strict_generator_function_map( | 
| 748       *strict_generator_function_map); | 748       *strict_generator_function_map); | 
| 749 | 749 | 
| 750   Handle<JSFunction> object_function(native_context()->object_function()); | 750   Handle<JSFunction> object_function(native_context()->object_function()); | 
| 751   Handle<Map> generator_object_prototype_map = Map::Create(isolate(), 0); | 751   Handle<Map> generator_object_prototype_map = Map::Create(isolate(), 0); | 
| 752   Map::SetPrototype(generator_object_prototype_map, generator_object_prototype); | 752   Map::SetPrototype(generator_object_prototype_map, generator_object_prototype); | 
| 753   native_context()->set_generator_object_prototype_map( | 753   native_context()->set_generator_object_prototype_map( | 
| 754       *generator_object_prototype_map); | 754       *generator_object_prototype_map); | 
| 755 } | 755 } | 
| 756 | 756 | 
|  | 757 void Genesis::CreateJSProxyMaps() { | 
|  | 758   // Allocate the different maps for all Proxy types. | 
|  | 759   // Next to the default proxy, we need maps indicating callable and | 
|  | 760   // constructable proxies. | 
|  | 761   Handle<Map> proxy_function_map = | 
|  | 762       Map::Copy(isolate()->sloppy_function_without_prototype_map(), "Proxy"); | 
|  | 763   proxy_function_map->set_is_constructor(true); | 
|  | 764   native_context()->set_proxy_function_map(*proxy_function_map); | 
|  | 765 | 
|  | 766   Handle<Map> proxy_map = | 
|  | 767       factory()->NewMap(JS_PROXY_TYPE, JSProxy::kSize, FAST_ELEMENTS); | 
|  | 768   proxy_map->set_dictionary_map(true); | 
|  | 769   native_context()->set_proxy_map(*proxy_map); | 
|  | 770 | 
|  | 771   Handle<Map> proxy_callable_map = Map::Copy(proxy_map, "callable Proxy"); | 
|  | 772   proxy_callable_map->set_is_callable(); | 
|  | 773   native_context()->set_proxy_callable_map(*proxy_callable_map); | 
|  | 774   proxy_callable_map->SetConstructor(native_context()->function_function()); | 
|  | 775 | 
|  | 776   Handle<Map> proxy_constructor_map = | 
|  | 777       Map::Copy(proxy_callable_map, "constructor Proxy"); | 
|  | 778   proxy_constructor_map->set_is_constructor(true); | 
|  | 779   native_context()->set_proxy_constructor_map(*proxy_constructor_map); | 
|  | 780 } | 
| 757 | 781 | 
| 758 static void ReplaceAccessors(Handle<Map> map, | 782 static void ReplaceAccessors(Handle<Map> map, | 
| 759                              Handle<String> name, | 783                              Handle<String> name, | 
| 760                              PropertyAttributes attributes, | 784                              PropertyAttributes attributes, | 
| 761                              Handle<AccessorPair> accessor_pair) { | 785                              Handle<AccessorPair> accessor_pair) { | 
| 762   DescriptorArray* descriptors = map->instance_descriptors(); | 786   DescriptorArray* descriptors = map->instance_descriptors(); | 
| 763   int idx = descriptors->SearchWithCache(map->GetIsolate(), *name, *map); | 787   int idx = descriptors->SearchWithCache(map->GetIsolate(), *name, *map); | 
| 764   AccessorConstantDescriptor descriptor(name, accessor_pair, attributes); | 788   AccessorConstantDescriptor descriptor(name, accessor_pair, attributes); | 
| 765   descriptors->Replace(idx, &descriptor); | 789   descriptors->Replace(idx, &descriptor); | 
| 766 } | 790 } | 
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1579   } | 1603   } | 
| 1580 | 1604 | 
| 1581   {  // -- W e a k S e t | 1605   {  // -- W e a k S e t | 
| 1582     Handle<JSFunction> js_weak_set_fun = InstallFunction( | 1606     Handle<JSFunction> js_weak_set_fun = InstallFunction( | 
| 1583         global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize, | 1607         global, "WeakSet", JS_WEAK_SET_TYPE, JSWeakSet::kSize, | 
| 1584         isolate->initial_object_prototype(), Builtins::kIllegal); | 1608         isolate->initial_object_prototype(), Builtins::kIllegal); | 
| 1585     InstallWithIntrinsicDefaultProto(isolate, js_weak_set_fun, | 1609     InstallWithIntrinsicDefaultProto(isolate, js_weak_set_fun, | 
| 1586                                      Context::JS_WEAK_SET_FUN_INDEX); | 1610                                      Context::JS_WEAK_SET_FUN_INDEX); | 
| 1587   } | 1611   } | 
| 1588 | 1612 | 
|  | 1613   {  // -- P r o x y | 
|  | 1614     CreateJSProxyMaps(); | 
|  | 1615 | 
|  | 1616     Handle<String> name = factory->Proxy_string(); | 
|  | 1617     Handle<Code> code(isolate->builtins()->ProxyConstructor()); | 
|  | 1618 | 
|  | 1619     Handle<JSFunction> proxy_function = | 
|  | 1620         factory->NewFunction(isolate->proxy_function_map(), | 
|  | 1621                              factory->Proxy_string(), MaybeHandle<Code>(code)); | 
|  | 1622 | 
|  | 1623     JSFunction::SetInitialMap( | 
|  | 1624         proxy_function, Handle<Map>(native_context()->proxy_map(), isolate), | 
|  | 1625         factory->null_value()); | 
|  | 1626 | 
|  | 1627     proxy_function->shared()->set_construct_stub( | 
|  | 1628         *isolate->builtins()->ProxyConstructor_ConstructStub()); | 
|  | 1629     proxy_function->shared()->set_internal_formal_parameter_count(2); | 
|  | 1630     proxy_function->shared()->set_length(2); | 
|  | 1631 | 
|  | 1632     native_context()->set_proxy_function(*proxy_function); | 
|  | 1633     InstallFunction(global, name, proxy_function, factory->Object_string()); | 
|  | 1634   } | 
|  | 1635 | 
|  | 1636   {  // -- R e f l e c t | 
|  | 1637     Handle<String> reflect_string = factory->InternalizeUtf8String("Reflect"); | 
|  | 1638     Handle<JSObject> reflect = | 
|  | 1639         factory->NewJSObject(isolate->object_function(), TENURED); | 
|  | 1640     JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); | 
|  | 1641 | 
|  | 1642     Handle<JSFunction> define_property = | 
|  | 1643         SimpleInstallFunction(reflect, factory->defineProperty_string(), | 
|  | 1644                               Builtins::kReflectDefineProperty, 3, true); | 
|  | 1645     native_context()->set_reflect_define_property(*define_property); | 
|  | 1646 | 
|  | 1647     Handle<JSFunction> delete_property = | 
|  | 1648         SimpleInstallFunction(reflect, factory->deleteProperty_string(), | 
|  | 1649                               Builtins::kReflectDeleteProperty, 2, true); | 
|  | 1650     native_context()->set_reflect_delete_property(*delete_property); | 
|  | 1651 | 
|  | 1652     Handle<JSFunction> apply = SimpleInstallFunction( | 
|  | 1653         reflect, factory->apply_string(), Builtins::kReflectApply, 3, false); | 
|  | 1654     native_context()->set_reflect_apply(*apply); | 
|  | 1655 | 
|  | 1656     Handle<JSFunction> construct = | 
|  | 1657         SimpleInstallFunction(reflect, factory->construct_string(), | 
|  | 1658                               Builtins::kReflectConstruct, 2, false); | 
|  | 1659     native_context()->set_reflect_construct(*construct); | 
|  | 1660 | 
|  | 1661     SimpleInstallFunction(reflect, factory->get_string(), Builtins::kReflectGet, | 
|  | 1662                           2, false); | 
|  | 1663     SimpleInstallFunction(reflect, factory->getOwnPropertyDescriptor_string(), | 
|  | 1664                           Builtins::kReflectGetOwnPropertyDescriptor, 2, true); | 
|  | 1665     SimpleInstallFunction(reflect, factory->getPrototypeOf_string(), | 
|  | 1666                           Builtins::kReflectGetPrototypeOf, 1, true); | 
|  | 1667     SimpleInstallFunction(reflect, factory->has_string(), Builtins::kReflectHas, | 
|  | 1668                           2, true); | 
|  | 1669     SimpleInstallFunction(reflect, factory->isExtensible_string(), | 
|  | 1670                           Builtins::kReflectIsExtensible, 1, true); | 
|  | 1671     SimpleInstallFunction(reflect, factory->ownKeys_string(), | 
|  | 1672                           Builtins::kReflectOwnKeys, 1, true); | 
|  | 1673     SimpleInstallFunction(reflect, factory->preventExtensions_string(), | 
|  | 1674                           Builtins::kReflectPreventExtensions, 1, true); | 
|  | 1675     SimpleInstallFunction(reflect, factory->set_string(), Builtins::kReflectSet, | 
|  | 1676                           3, false); | 
|  | 1677     SimpleInstallFunction(reflect, factory->setPrototypeOf_string(), | 
|  | 1678                           Builtins::kReflectSetPrototypeOf, 2, true); | 
|  | 1679   } | 
|  | 1680 | 
| 1589   {  // --- B o u n d F u n c t i o n | 1681   {  // --- B o u n d F u n c t i o n | 
| 1590     Handle<Map> map = | 1682     Handle<Map> map = | 
| 1591         factory->NewMap(JS_BOUND_FUNCTION_TYPE, JSBoundFunction::kSize); | 1683         factory->NewMap(JS_BOUND_FUNCTION_TYPE, JSBoundFunction::kSize); | 
| 1592     map->set_is_callable(); | 1684     map->set_is_callable(); | 
| 1593     Map::SetPrototype(map, empty_function); | 1685     Map::SetPrototype(map, empty_function); | 
| 1594 | 1686 | 
| 1595     PropertyAttributes roc_attribs = | 1687     PropertyAttributes roc_attribs = | 
| 1596         static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); | 1688         static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY); | 
| 1597     Map::EnsureDescriptorSlack(map, 2); | 1689     Map::EnsureDescriptorSlack(map, 2); | 
| 1598 | 1690 | 
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2298                       factory()->match_symbol()); | 2390                       factory()->match_symbol()); | 
| 2299   InstallPublicSymbol(factory(), native_context(), "replace", | 2391   InstallPublicSymbol(factory(), native_context(), "replace", | 
| 2300                       factory()->replace_symbol()); | 2392                       factory()->replace_symbol()); | 
| 2301   InstallPublicSymbol(factory(), native_context(), "search", | 2393   InstallPublicSymbol(factory(), native_context(), "search", | 
| 2302                       factory()->search_symbol()); | 2394                       factory()->search_symbol()); | 
| 2303   InstallPublicSymbol(factory(), native_context(), "split", | 2395   InstallPublicSymbol(factory(), native_context(), "split", | 
| 2304                       factory()->split_symbol()); | 2396                       factory()->split_symbol()); | 
| 2305 } | 2397 } | 
| 2306 | 2398 | 
| 2307 | 2399 | 
| 2308 void Genesis::InitializeGlobal_harmony_reflect() { |  | 
| 2309   Factory* factory = isolate()->factory(); |  | 
| 2310 |  | 
| 2311   // We currently use some of the Reflect functions internally, even when |  | 
| 2312   // the --harmony-reflect flag is not given. |  | 
| 2313 |  | 
| 2314   Handle<JSFunction> define_property = |  | 
| 2315       SimpleCreateFunction(isolate(), factory->defineProperty_string(), |  | 
| 2316                            Builtins::kReflectDefineProperty, 3, true); |  | 
| 2317   native_context()->set_reflect_define_property(*define_property); |  | 
| 2318 |  | 
| 2319   Handle<JSFunction> delete_property = |  | 
| 2320       SimpleCreateFunction(isolate(), factory->deleteProperty_string(), |  | 
| 2321                            Builtins::kReflectDeleteProperty, 2, true); |  | 
| 2322   native_context()->set_reflect_delete_property(*delete_property); |  | 
| 2323 |  | 
| 2324   Handle<JSFunction> apply = SimpleCreateFunction( |  | 
| 2325       isolate(), factory->apply_string(), Builtins::kReflectApply, 3, false); |  | 
| 2326   native_context()->set_reflect_apply(*apply); |  | 
| 2327 |  | 
| 2328   Handle<JSFunction> construct = |  | 
| 2329       SimpleCreateFunction(isolate(), factory->construct_string(), |  | 
| 2330                            Builtins::kReflectConstruct, 2, false); |  | 
| 2331   native_context()->set_reflect_construct(*construct); |  | 
| 2332 |  | 
| 2333   if (!FLAG_harmony_reflect) return; |  | 
| 2334 |  | 
| 2335   Handle<JSGlobalObject> global(JSGlobalObject::cast( |  | 
| 2336       native_context()->global_object())); |  | 
| 2337   Handle<String> reflect_string = factory->NewStringFromStaticChars("Reflect"); |  | 
| 2338   Handle<JSObject> reflect = |  | 
| 2339       factory->NewJSObject(isolate()->object_function(), TENURED); |  | 
| 2340   JSObject::AddProperty(global, reflect_string, reflect, DONT_ENUM); |  | 
| 2341 |  | 
| 2342   InstallFunction(reflect, define_property, factory->defineProperty_string()); |  | 
| 2343   InstallFunction(reflect, delete_property, factory->deleteProperty_string()); |  | 
| 2344   InstallFunction(reflect, apply, factory->apply_string()); |  | 
| 2345   InstallFunction(reflect, construct, factory->construct_string()); |  | 
| 2346 |  | 
| 2347   SimpleInstallFunction(reflect, factory->get_string(), |  | 
| 2348                         Builtins::kReflectGet, 2, false); |  | 
| 2349   SimpleInstallFunction(reflect, factory->getOwnPropertyDescriptor_string(), |  | 
| 2350                         Builtins::kReflectGetOwnPropertyDescriptor, 2, true); |  | 
| 2351   SimpleInstallFunction(reflect, factory->getPrototypeOf_string(), |  | 
| 2352                         Builtins::kReflectGetPrototypeOf, 1, true); |  | 
| 2353   SimpleInstallFunction(reflect, factory->has_string(), |  | 
| 2354                         Builtins::kReflectHas, 2, true); |  | 
| 2355   SimpleInstallFunction(reflect, factory->isExtensible_string(), |  | 
| 2356                         Builtins::kReflectIsExtensible, 1, true); |  | 
| 2357   SimpleInstallFunction(reflect, factory->ownKeys_string(), |  | 
| 2358                         Builtins::kReflectOwnKeys, 1, true); |  | 
| 2359   SimpleInstallFunction(reflect, factory->preventExtensions_string(), |  | 
| 2360                         Builtins::kReflectPreventExtensions, 1, true); |  | 
| 2361   SimpleInstallFunction(reflect, factory->set_string(), |  | 
| 2362                         Builtins::kReflectSet, 3, false); |  | 
| 2363   SimpleInstallFunction(reflect, factory->setPrototypeOf_string(), |  | 
| 2364                         Builtins::kReflectSetPrototypeOf, 2, true); |  | 
| 2365 } |  | 
| 2366 |  | 
| 2367 |  | 
| 2368 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { | 2400 void Genesis::InitializeGlobal_harmony_sharedarraybuffer() { | 
| 2369   if (!FLAG_harmony_sharedarraybuffer) return; | 2401   if (!FLAG_harmony_sharedarraybuffer) return; | 
| 2370 | 2402 | 
| 2371   Handle<JSGlobalObject> global(native_context()->global_object()); | 2403   Handle<JSGlobalObject> global(native_context()->global_object()); | 
| 2372   Handle<JSFunction> shared_array_buffer_fun = | 2404   Handle<JSFunction> shared_array_buffer_fun = | 
| 2373       InstallArrayBuffer(global, "SharedArrayBuffer"); | 2405       InstallArrayBuffer(global, "SharedArrayBuffer"); | 
| 2374   native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); | 2406   native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun); | 
| 2375 } | 2407 } | 
| 2376 | 2408 | 
| 2377 | 2409 | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2428       JSGlobalObject::cast(native_context()->global_object())); | 2460       JSGlobalObject::cast(native_context()->global_object())); | 
| 2429   Isolate* isolate = global->GetIsolate(); | 2461   Isolate* isolate = global->GetIsolate(); | 
| 2430   Factory* factory = isolate->factory(); | 2462   Factory* factory = isolate->factory(); | 
| 2431 | 2463 | 
| 2432   Handle<JSFunction> object_function = isolate->object_function(); | 2464   Handle<JSFunction> object_function = isolate->object_function(); | 
| 2433   SimpleInstallFunction(object_function, | 2465   SimpleInstallFunction(object_function, | 
| 2434                         factory->getOwnPropertyDescriptors_string(), | 2466                         factory->getOwnPropertyDescriptors_string(), | 
| 2435                         Builtins::kObjectGetOwnPropertyDescriptors, 1, false); | 2467                         Builtins::kObjectGetOwnPropertyDescriptors, 1, false); | 
| 2436 } | 2468 } | 
| 2437 | 2469 | 
| 2438 void Genesis::InstallJSProxyMaps() { |  | 
| 2439   // Allocate the different maps for all Proxy types. |  | 
| 2440   // Next to the default proxy, we need maps indicating callable and |  | 
| 2441   // constructable proxies. |  | 
| 2442 |  | 
| 2443   Handle<Map> proxy_function_map = |  | 
| 2444       Map::Copy(isolate()->sloppy_function_without_prototype_map(), "Proxy"); |  | 
| 2445   proxy_function_map->set_is_constructor(true); |  | 
| 2446   native_context()->set_proxy_function_map(*proxy_function_map); |  | 
| 2447 |  | 
| 2448   Handle<Map> proxy_map = |  | 
| 2449       factory()->NewMap(JS_PROXY_TYPE, JSProxy::kSize, FAST_ELEMENTS); |  | 
| 2450   proxy_map->set_dictionary_map(true); |  | 
| 2451   native_context()->set_proxy_map(*proxy_map); |  | 
| 2452 |  | 
| 2453   Handle<Map> proxy_callable_map = Map::Copy(proxy_map, "callable Proxy"); |  | 
| 2454   proxy_callable_map->set_is_callable(); |  | 
| 2455   native_context()->set_proxy_callable_map(*proxy_callable_map); |  | 
| 2456   proxy_callable_map->SetConstructor(native_context()->function_function()); |  | 
| 2457 |  | 
| 2458   Handle<Map> proxy_constructor_map = |  | 
| 2459       Map::Copy(proxy_callable_map, "constructor Proxy"); |  | 
| 2460   proxy_constructor_map->set_is_constructor(true); |  | 
| 2461   native_context()->set_proxy_constructor_map(*proxy_constructor_map); |  | 
| 2462 } |  | 
| 2463 |  | 
| 2464 |  | 
| 2465 void Genesis::InitializeGlobal_harmony_proxies() { |  | 
| 2466   if (!FLAG_harmony_proxies) return; |  | 
| 2467   Handle<JSGlobalObject> global( |  | 
| 2468       JSGlobalObject::cast(native_context()->global_object())); |  | 
| 2469   Isolate* isolate = global->GetIsolate(); |  | 
| 2470   Factory* factory = isolate->factory(); |  | 
| 2471 |  | 
| 2472   InstallJSProxyMaps(); |  | 
| 2473 |  | 
| 2474   // Create the Proxy object. |  | 
| 2475   Handle<String> name = factory->Proxy_string(); |  | 
| 2476   Handle<Code> code(isolate->builtins()->ProxyConstructor()); |  | 
| 2477 |  | 
| 2478   Handle<JSFunction> proxy_function = |  | 
| 2479       factory->NewFunction(isolate->proxy_function_map(), |  | 
| 2480                            factory->Proxy_string(), MaybeHandle<Code>(code)); |  | 
| 2481 |  | 
| 2482   JSFunction::SetInitialMap(proxy_function, |  | 
| 2483                             Handle<Map>(native_context()->proxy_map(), isolate), |  | 
| 2484                             factory->null_value()); |  | 
| 2485 |  | 
| 2486   proxy_function->shared()->set_construct_stub( |  | 
| 2487       *isolate->builtins()->ProxyConstructor_ConstructStub()); |  | 
| 2488   proxy_function->shared()->set_internal_formal_parameter_count(2); |  | 
| 2489   proxy_function->shared()->set_length(2); |  | 
| 2490 |  | 
| 2491   native_context()->set_proxy_function(*proxy_function); |  | 
| 2492   InstallFunction(global, name, proxy_function, factory->Object_string()); |  | 
| 2493 } |  | 
| 2494 |  | 
| 2495 void Genesis::InitializeGlobal_harmony_array_prototype_values() { | 2470 void Genesis::InitializeGlobal_harmony_array_prototype_values() { | 
| 2496   if (!FLAG_harmony_array_prototype_values) return; | 2471   if (!FLAG_harmony_array_prototype_values) return; | 
| 2497   Handle<JSFunction> array_constructor(native_context()->array_function()); | 2472   Handle<JSFunction> array_constructor(native_context()->array_function()); | 
| 2498   Handle<JSObject> array_prototype( | 2473   Handle<JSObject> array_prototype( | 
| 2499       JSObject::cast(array_constructor->instance_prototype())); | 2474       JSObject::cast(array_constructor->instance_prototype())); | 
| 2500   Handle<Object> values_iterator = | 2475   Handle<Object> values_iterator = | 
| 2501       JSObject::GetProperty(array_prototype, factory()->iterator_symbol()) | 2476       JSObject::GetProperty(array_prototype, factory()->iterator_symbol()) | 
| 2502           .ToHandleChecked(); | 2477           .ToHandleChecked(); | 
| 2503   DCHECK(values_iterator->IsJSFunction()); | 2478   DCHECK(values_iterator->IsJSFunction()); | 
| 2504   JSObject::AddProperty(array_prototype, factory()->values_string(), | 2479   JSObject::AddProperty(array_prototype, factory()->values_string(), | 
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2938       Map::EnsureDescriptorSlack(map, 1); | 2913       Map::EnsureDescriptorSlack(map, 1); | 
| 2939       map->AppendDescriptor(&d); | 2914       map->AppendDescriptor(&d); | 
| 2940     } | 2915     } | 
| 2941   } | 2916   } | 
| 2942 | 2917 | 
| 2943   return true; | 2918   return true; | 
| 2944 } | 2919 } | 
| 2945 | 2920 | 
| 2946 | 2921 | 
| 2947 bool Genesis::InstallExperimentalNatives() { | 2922 bool Genesis::InstallExperimentalNatives() { | 
| 2948   static const char* harmony_proxies_natives[] = {"native proxy.js", nullptr}; |  | 
| 2949   static const char* harmony_regexps_natives[] = {"native harmony-regexp.js", | 2923   static const char* harmony_regexps_natives[] = {"native harmony-regexp.js", | 
| 2950                                                   nullptr}; | 2924                                                   nullptr}; | 
| 2951   static const char* harmony_iterator_close_natives[] = {nullptr}; | 2925   static const char* harmony_iterator_close_natives[] = {nullptr}; | 
| 2952   static const char* harmony_sloppy_natives[] = {nullptr}; | 2926   static const char* harmony_sloppy_natives[] = {nullptr}; | 
| 2953   static const char* harmony_sloppy_function_natives[] = {nullptr}; | 2927   static const char* harmony_sloppy_function_natives[] = {nullptr}; | 
| 2954   static const char* harmony_sloppy_let_natives[] = {nullptr}; | 2928   static const char* harmony_sloppy_let_natives[] = {nullptr}; | 
| 2955   static const char* harmony_species_natives[] = {"native harmony-species.js", | 2929   static const char* harmony_species_natives[] = {"native harmony-species.js", | 
| 2956                                                   nullptr}; | 2930                                                   nullptr}; | 
| 2957   static const char* harmony_tailcalls_natives[] = {nullptr}; | 2931   static const char* harmony_tailcalls_natives[] = {nullptr}; | 
| 2958   static const char* harmony_unicode_regexps_natives[] = { | 2932   static const char* harmony_unicode_regexps_natives[] = { | 
| 2959       "native harmony-unicode-regexps.js", nullptr}; | 2933       "native harmony-unicode-regexps.js", nullptr}; | 
| 2960   static const char* harmony_reflect_natives[] = {"native harmony-reflect.js", |  | 
| 2961                                                   nullptr}; |  | 
| 2962   static const char* harmony_object_observe_natives[] = { | 2934   static const char* harmony_object_observe_natives[] = { | 
| 2963       "native harmony-object-observe.js", nullptr}; | 2935       "native harmony-object-observe.js", nullptr}; | 
| 2964   static const char* harmony_sharedarraybuffer_natives[] = { | 2936   static const char* harmony_sharedarraybuffer_natives[] = { | 
| 2965       "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL}; | 2937       "native harmony-sharedarraybuffer.js", "native harmony-atomics.js", NULL}; | 
| 2966   static const char* harmony_simd_natives[] = {"native harmony-simd.js", | 2938   static const char* harmony_simd_natives[] = {"native harmony-simd.js", | 
| 2967                                                nullptr}; | 2939                                                nullptr}; | 
| 2968   static const char* harmony_do_expressions_natives[] = {nullptr}; | 2940   static const char* harmony_do_expressions_natives[] = {nullptr}; | 
| 2969   static const char* harmony_regexp_subclass_natives[] = {nullptr}; | 2941   static const char* harmony_regexp_subclass_natives[] = {nullptr}; | 
| 2970   static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; | 2942   static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; | 
| 2971   static const char* harmony_instanceof_natives[] = {nullptr}; | 2943   static const char* harmony_instanceof_natives[] = {nullptr}; | 
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3646 } | 3618 } | 
| 3647 | 3619 | 
| 3648 | 3620 | 
| 3649 // Called when the top-level V8 mutex is destroyed. | 3621 // Called when the top-level V8 mutex is destroyed. | 
| 3650 void Bootstrapper::FreeThreadResources() { | 3622 void Bootstrapper::FreeThreadResources() { | 
| 3651   DCHECK(!IsActive()); | 3623   DCHECK(!IsActive()); | 
| 3652 } | 3624 } | 
| 3653 | 3625 | 
| 3654 }  // namespace internal | 3626 }  // namespace internal | 
| 3655 }  // namespace v8 | 3627 }  // namespace v8 | 
| OLD | NEW | 
|---|