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/base/ieee754.h" | 9 #include "src/base/ieee754.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 js_global_object_function->initial_map()->set_is_prototype_map(true); | 953 js_global_object_function->initial_map()->set_is_prototype_map(true); |
954 js_global_object_function->initial_map()->set_dictionary_map(true); | 954 js_global_object_function->initial_map()->set_dictionary_map(true); |
955 Handle<JSGlobalObject> global_object = | 955 Handle<JSGlobalObject> global_object = |
956 factory()->NewJSGlobalObject(js_global_object_function); | 956 factory()->NewJSGlobalObject(js_global_object_function); |
957 | 957 |
958 // Step 2: (re)initialize the global proxy object. | 958 // Step 2: (re)initialize the global proxy object. |
959 Handle<JSFunction> global_proxy_function; | 959 Handle<JSFunction> global_proxy_function; |
960 if (global_proxy_template.IsEmpty()) { | 960 if (global_proxy_template.IsEmpty()) { |
961 Handle<String> name = Handle<String>(heap()->empty_string()); | 961 Handle<String> name = Handle<String>(heap()->empty_string()); |
962 Handle<Code> code = isolate()->builtins()->Illegal(); | 962 Handle<Code> code = isolate()->builtins()->Illegal(); |
963 global_proxy_function = | 963 global_proxy_function = factory()->NewFunction( |
964 factory()->NewFunction(name, code, JS_GLOBAL_PROXY_TYPE, | 964 name, code, JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSize); |
965 JSGlobalProxy::kSizeWithInternalFields); | |
966 } else { | 965 } else { |
967 Handle<ObjectTemplateInfo> data = | 966 Handle<ObjectTemplateInfo> data = |
968 v8::Utils::OpenHandle(*global_proxy_template); | 967 v8::Utils::OpenHandle(*global_proxy_template); |
969 Handle<FunctionTemplateInfo> global_constructor( | 968 Handle<FunctionTemplateInfo> global_constructor( |
970 FunctionTemplateInfo::cast(data->constructor())); | 969 FunctionTemplateInfo::cast(data->constructor())); |
971 global_proxy_function = ApiNatives::CreateApiFunction( | 970 global_proxy_function = ApiNatives::CreateApiFunction( |
972 isolate(), global_constructor, factory()->the_hole_value(), | 971 isolate(), global_constructor, factory()->the_hole_value(), |
973 ApiNatives::GlobalProxyType); | 972 ApiNatives::GlobalProxyType); |
974 } | 973 } |
975 Handle<String> global_name = factory()->global_string(); | 974 Handle<String> global_name = factory()->global_string(); |
(...skipping 3512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4488 Handle<FunctionTemplateInfo> global_constructor( | 4487 Handle<FunctionTemplateInfo> global_constructor( |
4489 FunctionTemplateInfo::cast(global_proxy_data->constructor())); | 4488 FunctionTemplateInfo::cast(global_proxy_data->constructor())); |
4490 Handle<SharedFunctionInfo> shared = | 4489 Handle<SharedFunctionInfo> shared = |
4491 FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, | 4490 FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, |
4492 global_constructor); | 4491 global_constructor); |
4493 Handle<Map> initial_map = | 4492 Handle<Map> initial_map = |
4494 factory()->CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); | 4493 factory()->CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); |
4495 Handle<JSFunction> global_proxy_function = | 4494 Handle<JSFunction> global_proxy_function = |
4496 isolate->factory()->NewFunctionFromSharedFunctionInfo( | 4495 isolate->factory()->NewFunctionFromSharedFunctionInfo( |
4497 initial_map, shared, factory()->undefined_value()); | 4496 initial_map, shared, factory()->undefined_value()); |
4498 DCHECK_EQ(global_proxy_data->internal_field_count(), | 4497 DCHECK_EQ(global_proxy_data->internal_field_count(), 0); |
4499 v8::Context::kProxyInternalFieldCount); | |
4500 Handle<Map> global_proxy_map = isolate->factory()->NewMap( | 4498 Handle<Map> global_proxy_map = isolate->factory()->NewMap( |
4501 JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSizeWithInternalFields, | 4499 JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSize, FAST_HOLEY_SMI_ELEMENTS); |
4502 FAST_HOLEY_SMI_ELEMENTS); | |
4503 JSFunction::SetInitialMap(global_proxy_function, global_proxy_map, | 4500 JSFunction::SetInitialMap(global_proxy_function, global_proxy_map, |
4504 factory()->null_value()); | 4501 factory()->null_value()); |
4505 global_proxy_map->set_is_access_check_needed(true); | 4502 global_proxy_map->set_is_access_check_needed(true); |
4506 global_proxy_map->set_is_callable(); | 4503 global_proxy_map->set_is_callable(); |
4507 global_proxy_map->set_is_constructor(true); | 4504 global_proxy_map->set_is_constructor(true); |
4508 global_proxy_map->set_has_hidden_prototype(true); | 4505 global_proxy_map->set_has_hidden_prototype(true); |
4509 | 4506 |
4510 Handle<String> global_name = factory()->global_string(); | 4507 Handle<String> global_name = factory()->global_string(); |
4511 global_proxy_function->shared()->set_instance_class_name(*global_name); | 4508 global_proxy_function->shared()->set_instance_class_name(*global_name); |
4512 factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function); | 4509 factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function); |
(...skipping 30 matching lines...) Expand all Loading... |
4543 } | 4540 } |
4544 | 4541 |
4545 | 4542 |
4546 // Called when the top-level V8 mutex is destroyed. | 4543 // Called when the top-level V8 mutex is destroyed. |
4547 void Bootstrapper::FreeThreadResources() { | 4544 void Bootstrapper::FreeThreadResources() { |
4548 DCHECK(!IsActive()); | 4545 DCHECK(!IsActive()); |
4549 } | 4546 } |
4550 | 4547 |
4551 } // namespace internal | 4548 } // namespace internal |
4552 } // namespace v8 | 4549 } // namespace v8 |
OLD | NEW |