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

Unified Diff: src/bootstrapper.cc

Issue 2770753003: Migrate Object constructor to C++
Patch Set: Ack comments Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/builtins/builtins-definitions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index be025b40870f9ff4b64d0d37e4012e9acafa47ac..f9b02353e4f0d13aa38127cc3c5d486e89851838 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1278,11 +1278,20 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
native_context()->set_script_context_table(*script_context_table);
InstallGlobalThisBinding();
+ Handle<JSObject> global(native_context()->global_object());
+
{ // --- O b j e c t ---
- Handle<String> object_name = factory->Object_string();
- Handle<JSFunction> object_function = isolate->object_function();
- JSObject::AddProperty(global_object, object_name, object_function,
- DONT_ENUM);
+ Handle<JSFunction> object_function =
+ InstallFunction(global, factory->Object_string(), JS_OBJECT_TYPE,
+ JSObject::kHeaderSize,
+ isolate->initial_object_prototype(),
+ Builtins::kObjectConstructor, DONT_ENUM);
+ object_function->shared()->DontAdaptArguments();
+ object_function->shared()->SetConstructStub(
+ *isolate->builtins()->ObjectConstructor_ConstructStub());
+ object_function->shared()->set_length(1);
+ InstallWithIntrinsicDefaultProto(isolate, object_function,
+ Context::OBJECT_FUNCTION_INDEX);
SimpleInstallFunction(object_function, factory->assign_string(),
Builtins::kObjectAssign, 2, false);
@@ -1363,6 +1372,9 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
SimpleInstallFunction(isolate->initial_object_prototype(),
"__lookupSetter__", Builtins::kObjectLookupSetter, 1,
true);
+ JSObject::AddProperty(isolate->initial_object_prototype(),
+ factory->constructor_string(), object_function,
+ DONT_ENUM);
SimpleInstallFunction(
isolate->initial_object_prototype(), "propertyIsEnumerable",
Builtins::kObjectPrototypePropertyIsEnumerable, 1, false);
@@ -1377,8 +1389,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Builtins::kObjectPrototypeSetProto, DONT_ENUM);
}
- Handle<JSObject> global(native_context()->global_object());
-
{ // --- F u n c t i o n ---
Handle<JSFunction> prototype = empty_function;
Handle<JSFunction> function_fun =
« no previous file with comments | « no previous file | src/builtins/builtins-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698