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

Unified Diff: src/bootstrapper.cc

Issue 1343113003: Implement V8 extras utils object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove call/apply helpers Created 5 years, 3 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/contexts.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 7ee75b2cab0d01cc731308ae8f002333d35d7050..d9e5e3bbb3dd3de9fc2696d7ac16131c0da39f42 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1521,9 +1521,13 @@ bool Bootstrapper::CompileBuiltin(Isolate* isolate, int index) {
Vector<const char> name = Natives::GetScriptName(index);
Handle<String> source_code =
isolate->bootstrapper()->SourceLookup<Natives>(index);
+
+ // We pass in extras_utils so that builtin code can set it up for later use
+ // by actual extras code, compiled with CompileExtraBuiltin.
Handle<Object> global = isolate->global_object();
Handle<Object> utils = isolate->natives_utils_object();
- Handle<Object> args[] = {global, utils};
+ Handle<Object> extras_utils = isolate->extras_utils_object();
+ Handle<Object> args[] = {global, utils, extras_utils};
return Bootstrapper::CompileNative(
isolate, name, Handle<JSObject>(isolate->native_context()->builtins()),
@@ -1552,7 +1556,8 @@ bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) {
isolate->bootstrapper()->SourceLookup<ExtraNatives>(index);
Handle<Object> global = isolate->global_object();
Handle<Object> binding = isolate->extras_binding_object();
- Handle<Object> args[] = {global, binding};
+ Handle<Object> extras_utils = isolate->extras_utils_object();
+ Handle<Object> args[] = {global, binding, extras_utils};
return Bootstrapper::CompileNative(
isolate, name, Handle<JSObject>(isolate->native_context()->builtins()),
source_code, arraysize(args), args);
@@ -1567,7 +1572,8 @@ bool Bootstrapper::CompileExperimentalExtraBuiltin(Isolate* isolate,
isolate->bootstrapper()->SourceLookup<ExperimentalExtraNatives>(index);
Handle<Object> global = isolate->global_object();
Handle<Object> binding = isolate->extras_binding_object();
- Handle<Object> args[] = {global, binding};
+ Handle<Object> extras_utils = isolate->extras_utils_object();
+ Handle<Object> args[] = {global, binding, extras_utils};
return Bootstrapper::CompileNative(
isolate, name, Handle<JSObject>(isolate->native_context()->builtins()),
source_code, arraysize(args), args);
@@ -2007,6 +2013,14 @@ bool Genesis::InstallNatives(ContextType context_type) {
"utils container for native scripts");
native_context()->set_natives_utils_object(*utils);
+ // Set up the extras utils object as a shared container between native
+ // scripts and extras. (Extras consume things added there by native scripts.)
+ Handle<JSObject> extras_utils =
+ factory()->NewJSObject(isolate()->object_function());
+ native_context()->set_extras_utils_object(*extras_utils);
+
+ InstallInternalArray(extras_utils, "InternalPackedArray", FAST_ELEMENTS);
+
int builtin_index = Natives::GetDebuggerCount();
// Only run prologue.js and runtime.js at this point.
DCHECK_EQ(builtin_index, Natives::GetIndex("prologue"));
@@ -2564,8 +2578,6 @@ bool Genesis::InstallExtraNatives() {
Handle<JSObject> extras_binding =
factory()->NewJSObject(isolate()->object_function());
- JSObject::NormalizeProperties(extras_binding, CLEAR_INOBJECT_PROPERTIES, 2,
- "container for binding to/from extra natives");
native_context()->set_extras_binding_object(*extras_binding);
for (int i = ExtraNatives::GetDebuggerCount();
« no previous file with comments | « no previous file | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698