Reviewers: jochen (slow), rmcilroy,

Message:
Jochen, Ross - FYI.


Description:
Quick-and-dirty fixes for on-demand snapshot.

Under V8_ON_DEMAND_SNAPSHOT, include shipping features in the snap shot.
This will probably break under --noharmony-<xxx> flags but the on-demand
snapshot will be broken anyway.

The correct fix is to treat all natives equally under
V8_ON_DEMAND_SNAPSHOT - they will all get into the snapshot and if the
flags change the snapshot will be regenerated.

COMMIT=false

Please review this at https://codereview.chromium.org/811333002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+35, -4 lines):
  M src/bootstrapper.cc


Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 60118487bc14ef07bf2d1a3fcd23b65cf998913e..8048bcd26d0dce939e1ec177c9da333c2adc874a 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -230,7 +230,7 @@ class Genesis BASE_EMBEDDED {
       ElementsKind elements_kind,
       Handle<JSFunction>* fun,
       Handle<Map>* external_map);
-  bool InstallExperimentalNatives();
+  bool InstallExperimentalNatives(bool include_shipping);
   void InstallBuiltinFunctionIds();
   void InstallJSFunctionResultCaches();
   void InitializeNormalizedMapCaches();
@@ -1345,6 +1345,13 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
     delegate->shared()->DontAdaptArguments();
   }

+#ifdef V8_ON_DEMAND_SNAPSHOT
+#define FEATURE_INITIALIZE_GLOBAL(id, descr) InitializeGlobal_##id();  
+  HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL)  
+#undef FEATURE_INITIALIZE_GLOBAL       
+#endif
+
+
   // Initialize the embedder data slot.
   Handle<FixedArray> embedder_data = factory->NewFixedArray(3);
   native_context()->set_embedder_data(*embedder_data);
@@ -1379,13 +1386,16 @@ void Genesis::InitializeExperimentalGlobal() {

   HARMONY_INPROGRESS(FEATURE_INITIALIZE_GLOBAL)
   HARMONY_STAGED(FEATURE_INITIALIZE_GLOBAL)
+#ifndef V8_ON_DEMAND_SNAPSHOT
   HARMONY_SHIPPING(FEATURE_INITIALIZE_GLOBAL)
+#endif
 #undef FEATURE_INITIALIZE_GLOBAL
 }


 bool Genesis::CompileBuiltin(Isolate* isolate, int index) {
   Vector<const char> name = Natives::GetScriptName(index);
+  printf("CompileBuiltin:%*s\n", name.length(), name.start());
   Handle<String> source_code =
       isolate->bootstrapper()->NativesSourceLookup(index);
   return CompileNative(isolate, name, source_code);
@@ -1394,6 +1404,7 @@ bool Genesis::CompileBuiltin(Isolate* isolate, int index) {

 bool Genesis::CompileExperimentalBuiltin(Isolate* isolate, int index) {
   Vector<const char> name = ExperimentalNatives::GetScriptName(index);
+  printf("CompileExperimentalBuiltin:%*s\n", name.length(), name.start());
   Factory* factory = isolate->factory();
   Handle<String> source_code;
   ASSIGN_RETURN_ON_EXCEPTION_VALUE(
@@ -1560,6 +1571,13 @@ void Genesis::InstallNativeFunctions() {
   INSTALL_NATIVE(JSFunction, "NativeObjectNotifierPerformChange",
                  native_object_notifier_perform_change);
   INSTALL_NATIVE(JSFunction, "ArrayValues", array_values_iterator);
+
+       
+#ifdef V8_ON_DEMAND_SNAPSHOT
+#define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id();
+  HARMONY_SHIPPING(INSTALL_NATIVE_FUNCTIONS_FOR)       
+#undef INSTALL_NATIVE_FUNCTIONS_FOR
+#endif // V8_ON_DEMAND_SNAPSHOT
 }


@@ -1574,7 +1592,9 @@ void Genesis::InstallExperimentalNativeFunctions() {
#define INSTALL_NATIVE_FUNCTIONS_FOR(id, descr) InstallNativeFunctions_##id();
   HARMONY_INPROGRESS(INSTALL_NATIVE_FUNCTIONS_FOR)
   HARMONY_STAGED(INSTALL_NATIVE_FUNCTIONS_FOR)
+#ifndef V8_ON_DEMAND_SNAPSHOT
   HARMONY_SHIPPING(INSTALL_NATIVE_FUNCTIONS_FOR)
+#endif
 #undef INSTALL_NATIVE_FUNCTIONS_FOR
 }

@@ -2009,7 +2029,10 @@ bool Genesis::InstallNatives() {
     // runtime.js.
     if (!InstallJSBuiltins(builtins)) return false;
   }
-
+#if V8_ON_DEMAND_SNAPSHOT
+  InstallExperimentalNatives(true);
+#endif // V8_ON_DEMAND_SNAPSHOT
+
   InstallNativeFunctions();

// Store the map for the string prototype after the natives has been compiled
@@ -2157,7 +2180,7 @@ bool Genesis::InstallNatives() {
 }


-bool Genesis::InstallExperimentalNatives() {
+bool Genesis::InstallExperimentalNatives(bool include_shipping) {
   static const char* harmony_arrays_natives[] = {
       "native harmony-array.js", "native harmony-typedarray.js", NULL};
   static const char* harmony_array_includes_natives[] = {
@@ -2195,7 +2218,15 @@ bool Genesis::InstallExperimentalNatives() {
   }
     HARMONY_INPROGRESS(INSTALL_EXPERIMENTAL_NATIVES);
     HARMONY_STAGED(INSTALL_EXPERIMENTAL_NATIVES);
+#ifdef V8_ON_DEMAND_SNAPSHOT
+    if (include_shipping) {
+#endif
     HARMONY_SHIPPING(INSTALL_EXPERIMENTAL_NATIVES);
+
+#ifdef V8_ON_DEMAND_SNAPSHOT
+    }
+#endif
+
 #undef INSTALL_EXPERIMENTAL_NATIVES
   }

@@ -2760,7 +2791,7 @@ Genesis::Genesis(Isolate* isolate,
   }

   // Install experimental natives.
-  if (!InstallExperimentalNatives()) return;
+  if (!InstallExperimentalNatives(false)) return;
   InitializeExperimentalGlobal();

// We can't (de-)serialize typed arrays currently, but we are lucky: The state


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to