Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(810)

Side by Side Diff: src/bootstrapper.cc

Issue 2472573004: Reland "Create internal fields on global proxy objects" (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api-natives.cc ('k') | src/factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 = factory()->NewFunction( 963 global_proxy_function =
964 name, code, JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSize); 964 factory()->NewFunction(name, code, JS_GLOBAL_PROXY_TYPE,
965 JSGlobalProxy::kSizeWithInternalFields);
965 } else { 966 } else {
966 Handle<ObjectTemplateInfo> data = 967 Handle<ObjectTemplateInfo> data =
967 v8::Utils::OpenHandle(*global_proxy_template); 968 v8::Utils::OpenHandle(*global_proxy_template);
968 Handle<FunctionTemplateInfo> global_constructor( 969 Handle<FunctionTemplateInfo> global_constructor(
969 FunctionTemplateInfo::cast(data->constructor())); 970 FunctionTemplateInfo::cast(data->constructor()));
970 global_proxy_function = ApiNatives::CreateApiFunction( 971 global_proxy_function = ApiNatives::CreateApiFunction(
971 isolate(), global_constructor, factory()->the_hole_value(), 972 isolate(), global_constructor, factory()->the_hole_value(),
972 ApiNatives::GlobalProxyType); 973 ApiNatives::GlobalProxyType);
973 } 974 }
974 Handle<String> global_name = factory()->global_string(); 975 Handle<String> global_name = factory()->global_string();
(...skipping 3512 matching lines...) Expand 10 before | Expand all | Expand 10 after
4487 Handle<FunctionTemplateInfo> global_constructor( 4488 Handle<FunctionTemplateInfo> global_constructor(
4488 FunctionTemplateInfo::cast(global_proxy_data->constructor())); 4489 FunctionTemplateInfo::cast(global_proxy_data->constructor()));
4489 Handle<SharedFunctionInfo> shared = 4490 Handle<SharedFunctionInfo> shared =
4490 FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate, 4491 FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(isolate,
4491 global_constructor); 4492 global_constructor);
4492 Handle<Map> initial_map = 4493 Handle<Map> initial_map =
4493 factory()->CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE); 4494 factory()->CreateSloppyFunctionMap(FUNCTION_WITH_WRITEABLE_PROTOTYPE);
4494 Handle<JSFunction> global_proxy_function = 4495 Handle<JSFunction> global_proxy_function =
4495 isolate->factory()->NewFunctionFromSharedFunctionInfo( 4496 isolate->factory()->NewFunctionFromSharedFunctionInfo(
4496 initial_map, shared, factory()->undefined_value()); 4497 initial_map, shared, factory()->undefined_value());
4497 DCHECK_EQ(global_proxy_data->internal_field_count(), 0); 4498 DCHECK_EQ(global_proxy_data->internal_field_count(),
4499 v8::Context::kProxyInternalFieldCount);
4498 Handle<Map> global_proxy_map = isolate->factory()->NewMap( 4500 Handle<Map> global_proxy_map = isolate->factory()->NewMap(
4499 JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSize, FAST_HOLEY_SMI_ELEMENTS); 4501 JS_GLOBAL_PROXY_TYPE, JSGlobalProxy::kSizeWithInternalFields,
4502 FAST_HOLEY_SMI_ELEMENTS);
4500 JSFunction::SetInitialMap(global_proxy_function, global_proxy_map, 4503 JSFunction::SetInitialMap(global_proxy_function, global_proxy_map,
4501 factory()->null_value()); 4504 factory()->null_value());
4502 global_proxy_map->set_is_access_check_needed(true); 4505 global_proxy_map->set_is_access_check_needed(true);
4503 global_proxy_map->set_is_callable(); 4506 global_proxy_map->set_is_callable();
4504 global_proxy_map->set_is_constructor(true); 4507 global_proxy_map->set_is_constructor(true);
4505 global_proxy_map->set_has_hidden_prototype(true); 4508 global_proxy_map->set_has_hidden_prototype(true);
4506 4509
4507 Handle<String> global_name = factory()->global_string(); 4510 Handle<String> global_name = factory()->global_string();
4508 global_proxy_function->shared()->set_instance_class_name(*global_name); 4511 global_proxy_function->shared()->set_instance_class_name(*global_name);
4509 factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function); 4512 factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function);
(...skipping 30 matching lines...) Expand all
4540 } 4543 }
4541 4544
4542 4545
4543 // Called when the top-level V8 mutex is destroyed. 4546 // Called when the top-level V8 mutex is destroyed.
4544 void Bootstrapper::FreeThreadResources() { 4547 void Bootstrapper::FreeThreadResources() {
4545 DCHECK(!IsActive()); 4548 DCHECK(!IsActive());
4546 } 4549 }
4547 4550
4548 } // namespace internal 4551 } // namespace internal
4549 } // namespace v8 4552 } // namespace v8
OLDNEW
« no previous file with comments | « src/api-natives.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698