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

Unified Diff: src/bootstrapper.cc

Issue 6865013: Introduce experimental natives that are enabled by a runtime flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 9 years, 8 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/SConscript ('k') | src/d8.gyp » ('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 24108c9d64a1588ec8055d0e927eebe9c45f3d40..08007146baf549fc8ca0a4d3520614c3bd2b039d 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -200,6 +200,7 @@ class Genesis BASE_EMBEDDED {
// Used for creating a context from scratch.
void InstallNativeFunctions();
bool InstallNatives();
+ bool InstallExperimentalNatives();
void InstallBuiltinFunctionIds();
void InstallJSFunctionResultCaches();
void InitializeNormalizedMapCaches();
@@ -246,6 +247,7 @@ class Genesis BASE_EMBEDDED {
Handle<FixedArray> caller);
static bool CompileBuiltin(Isolate* isolate, int index);
+ static bool CompileExperimentalBuiltin(Isolate* isolate, int index);
static bool CompileNative(Vector<const char> name, Handle<String> source);
static bool CompileScriptCached(Vector<const char> name,
Handle<String> source,
@@ -1175,6 +1177,15 @@ bool Genesis::CompileBuiltin(Isolate* isolate, int index) {
}
+bool Genesis::CompileExperimentalBuiltin(Isolate* isolate, int index) {
+ Vector<const char> name = ExperimentalNatives::GetScriptName(index);
+ Factory* factory = isolate->factory();
+ Handle<String> source_code =
+ factory->NewStringFromAscii(ExperimentalNatives::GetScriptSource(index));
+ return CompileNative(name, source_code);
+}
+
+
bool Genesis::CompileNative(Vector<const char> name, Handle<String> source) {
HandleScope scope;
Isolate* isolate = source->GetIsolate();
@@ -1510,7 +1521,6 @@ bool Genesis::InstallNatives() {
for (int i = Natives::GetDebuggerCount();
i < Natives::GetBuiltinsCount();
i++) {
- Vector<const char> name = Natives::GetScriptName(i);
if (!CompileBuiltin(isolate(), i)) return false;
// TODO(ager): We really only need to install the JS builtin
// functions on the builtins object after compiling and running
@@ -1628,6 +1638,18 @@ bool Genesis::InstallNatives() {
}
+bool Genesis::InstallExperimentalNatives() {
+ if (FLAG_harmony_proxies) {
+ for (int i = ExperimentalNatives::GetDebuggerCount();
+ i < ExperimentalNatives::GetBuiltinsCount();
+ i++) {
+ if (!CompileExperimentalBuiltin(isolate(), i)) return false;
+ }
+ }
+ return true;
+}
+
+
static Handle<JSObject> ResolveBuiltinIdHolder(
Handle<Context> global_context,
const char* holder_expr) {
@@ -2108,6 +2130,9 @@ Genesis::Genesis(Isolate* isolate,
isolate->counters()->contexts_created_from_scratch()->Increment();
}
+ // Install experimental natives.
+ if (!InstallExperimentalNatives()) return;
+
result_ = global_context_;
}
« no previous file with comments | « src/SConscript ('k') | src/d8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698