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

Unified Diff: src/bootstrapper.cc

Issue 1296163003: Native context: install JS builtins via container object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@prologuefirst
Patch Set: rebase Created 5 years, 4 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 | « src/bootstrapper.h ('k') | src/runtime.js » ('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 a5b4b1b8380788c06ae70e4f74ffcc9f199b5416..d18ac94612dd8f4506af645d6e642853373fbc50 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -242,7 +242,6 @@ class Genesis BASE_EMBEDDED {
v8::RegisteredExtension* current,
ExtensionStates* extension_states);
static bool InstallSpecialObjects(Handle<Context> native_context);
- bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins);
bool ConfigureApiObject(Handle<JSObject> object,
Handle<ObjectTemplateInfo> object_template);
bool ConfigureGlobalObjects(
@@ -1869,6 +1868,24 @@ void Bootstrapper::ImportExperimentalNatives(Isolate* isolate,
#undef INSTALL_NATIVE
+
+bool Bootstrapper::InstallJSBuiltins(Isolate* isolate,
+ Handle<JSObject> container) {
+ HandleScope scope(isolate);
+ Handle<JSBuiltinsObject> builtins = isolate->js_builtins_object();
+ for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
+ Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
+ Handle<Object> function_object =
+ Object::GetProperty(isolate, container, Builtins::GetName(id))
+ .ToHandleChecked();
+ DCHECK(function_object->IsJSFunction());
+ Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
+ builtins->set_javascript_builtin(id, *function);
+ }
+ return true;
+}
+
+
#define EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(id) \
void Genesis::InitializeGlobal_##id() {}
@@ -2098,7 +2115,6 @@ bool Genesis::InstallNatives(ContextType context_type) {
if (!Bootstrapper::CompileBuiltin(isolate(), builtin_index++)) return false;
DCHECK_EQ(builtin_index, Natives::GetIndex("runtime"));
if (!Bootstrapper::CompileBuiltin(isolate(), builtin_index++)) return false;
- if (!InstallJSBuiltins(builtins)) return false;
// A thin context is ready at this point.
if (context_type == THIN_CONTEXT) return true;
@@ -2908,19 +2924,6 @@ bool Genesis::InstallExtension(Isolate* isolate,
}
-bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
- HandleScope scope(isolate());
- for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
- Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
- Handle<Object> function_object = Object::GetProperty(
- isolate(), builtins, Builtins::GetName(id)).ToHandleChecked();
- Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
- builtins->set_javascript_builtin(id, *function);
- }
- return true;
-}
-
-
bool Genesis::ConfigureGlobalObjects(
v8::Local<v8::ObjectTemplate> global_proxy_template) {
Handle<JSObject> global_proxy(
« no previous file with comments | « src/bootstrapper.h ('k') | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698