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

Unified Diff: src/bootstrapper.cc

Issue 1284413002: Add experimental, non-snapshotted V8 extras (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@non-experimental-extras
Patch Set: Missing gn entries 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/flag-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 d18ac94612dd8f4506af645d6e642853373fbc50..dfedc7c9aaae0c562d3444d9619408f2b58d1ed4 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -51,6 +51,8 @@ Handle<String> Bootstrapper::SourceLookup(int index) {
template Handle<String> Bootstrapper::SourceLookup<Natives>(int index);
template Handle<String> Bootstrapper::SourceLookup<ExperimentalNatives>(
int index);
+template Handle<String> Bootstrapper::SourceLookup<ExperimentalExtraNatives>(
+ int index);
template Handle<String> Bootstrapper::SourceLookup<ExtraNatives>(int index);
template Handle<String> Bootstrapper::SourceLookup<CodeStubNatives>(int index);
@@ -121,7 +123,10 @@ void Bootstrapper::TearDown() {
DeleteNativeSources(Natives::GetSourceCache(isolate_->heap()));
DeleteNativeSources(ExperimentalNatives::GetSourceCache(isolate_->heap()));
DeleteNativeSources(ExtraNatives::GetSourceCache(isolate_->heap()));
+ DeleteNativeSources(
+ ExperimentalExtraNatives::GetSourceCache(isolate_->heap()));
DeleteNativeSources(CodeStubNatives::GetSourceCache(isolate_->heap()));
+
extensions_cache_.Initialize(isolate_, false); // Yes, symmetrical
}
@@ -206,6 +211,7 @@ class Genesis BASE_EMBEDDED {
Handle<JSFunction>* fun);
bool InstallExperimentalNatives();
bool InstallExtraNatives();
+ bool InstallExperimentalExtraNatives();
bool InstallDebuggerNatives();
void InstallBuiltinFunctionIds();
void InstallExperimentalBuiltinFunctionIds();
@@ -1532,6 +1538,21 @@ bool Bootstrapper::CompileExtraBuiltin(Isolate* isolate, int index) {
}
+bool Bootstrapper::CompileExperimentalExtraBuiltin(Isolate* isolate,
+ int index) {
+ HandleScope scope(isolate);
+ Vector<const char> name = ExperimentalExtraNatives::GetScriptName(index);
+ Handle<String> source_code =
+ isolate->bootstrapper()->SourceLookup<ExperimentalExtraNatives>(index);
+ Handle<Object> global = isolate->global_object();
+ Handle<Object> binding = isolate->extras_binding_object();
+ Handle<Object> args[] = {global, binding};
+ return Bootstrapper::CompileNative(
+ isolate, name, Handle<JSObject>(isolate->native_context()->builtins()),
+ source_code, arraysize(args), args);
+}
+
+
bool Bootstrapper::CompileCodeStubBuiltin(Isolate* isolate, int index) {
HandleScope scope(isolate);
Vector<const char> name = CodeStubNatives::GetScriptName(index);
@@ -2638,6 +2659,17 @@ bool Genesis::InstallExtraNatives() {
}
+bool Genesis::InstallExperimentalExtraNatives() {
+ for (int i = ExperimentalExtraNatives::GetDebuggerCount();
+ i < ExperimentalExtraNatives::GetBuiltinsCount(); i++) {
+ if (!Bootstrapper::CompileExperimentalExtraBuiltin(isolate(), i))
+ return false;
+ }
+
+ return true;
+}
+
+
bool Genesis::InstallDebuggerNatives() {
for (int i = 0; i < Natives::GetDebuggerCount(); ++i) {
if (!Bootstrapper::CompileBuiltin(isolate(), i)) return false;
@@ -3237,6 +3269,11 @@ Genesis::Genesis(Isolate* isolate,
if (!isolate->serializer_enabled()) {
InitializeExperimentalGlobal();
if (!InstallExperimentalNatives()) return;
+
+ if (FLAG_experimental_extras) {
+ if (!InstallExperimentalExtraNatives()) return;
+ }
+
// By now the utils object is useless and can be removed.
native_context()->set_natives_utils_object(
isolate->heap()->undefined_value());
« no previous file with comments | « src/bootstrapper.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698