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

Unified Diff: src/bootstrapper.cc

Issue 1294803004: Native context: run prologue.js before runtime.js (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: also change BUILD.gn 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 | « BUILD.gn ('k') | src/prologue.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 5f4e0995f843a69dc8915b9be04cabdddc415d5e..a5b4b1b8380788c06ae70e4f74ffcc9f199b5416 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -2086,20 +2086,23 @@ bool Genesis::InstallNatives(ContextType context_type) {
native_context()->set_runtime_context(*context);
- if (context_type == THIN_CONTEXT) {
- int js_builtins_script_index = Natives::GetDebuggerCount();
- if (!Bootstrapper::CompileBuiltin(isolate(), js_builtins_script_index))
- return false;
- if (!InstallJSBuiltins(builtins)) return false;
- return true;
- }
-
// Set up the utils object as shared container between native scripts.
Handle<JSObject> utils = factory()->NewJSObject(isolate()->object_function());
JSObject::NormalizeProperties(utils, CLEAR_INOBJECT_PROPERTIES, 16,
"utils container for native scripts");
native_context()->set_natives_utils_object(*utils);
+ int builtin_index = Natives::GetDebuggerCount();
+ // Only run prologue.js and runtime.js at this point.
+ DCHECK_EQ(builtin_index, Natives::GetIndex("prologue"));
+ 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;
+
if (FLAG_expose_natives_as != NULL) {
Handle<String> utils_key = factory()->NewStringFromAsciiChecked("utils");
JSObject::AddProperty(builtins, utils_key, utils, NONE);
@@ -2385,13 +2388,9 @@ bool Genesis::InstallNatives(ContextType context_type) {
#undef INSTALL_PUBLIC_SYMBOL
}
- int i = Natives::GetDebuggerCount();
- if (!Bootstrapper::CompileBuiltin(isolate(), i)) return false;
-
- if (!InstallJSBuiltins(builtins)) return false;
-
- for (++i; i < Natives::GetBuiltinsCount(); ++i) {
- if (!Bootstrapper::CompileBuiltin(isolate(), i)) return false;
+ // Run the rest of the native scripts.
+ while (builtin_index < Natives::GetBuiltinsCount()) {
+ if (!Bootstrapper::CompileBuiltin(isolate(), builtin_index++)) return false;
}
if (!CallUtilsFunction(isolate(), "PostNatives")) return false;
« no previous file with comments | « BUILD.gn ('k') | src/prologue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698