Revision: 24069
Author:   [email protected]
Date:     Fri Sep 19 09:15:47 2014 UTC
Log:      The --optimize-for-size flag should imply a small semi-space

[email protected], [email protected]
BUG=

Review URL: https://codereview.chromium.org/585523002
https://code.google.com/p/v8/source/detail?r=24069

Modified:
 /branches/bleeding_edge/src/flag-definitions.h
 /branches/bleeding_edge/test/cctest/test-heap.cc

=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Fri Sep 19 07:36:05 2014 UTC +++ /branches/bleeding_edge/src/flag-definitions.h Fri Sep 19 09:15:47 2014 UTC
@@ -10,6 +10,12 @@
// which can be included multiple times in different modes. It expects to have
 // a mode defined before it's included.  The modes are FLAG_MODE_... below:

+#define DEFINE_IMPLICATION(whenflag, thenflag)              \
+  DEFINE_VALUE_IMPLICATION(whenflag, thenflag, true)
+
+#define DEFINE_NEG_IMPLICATION(whenflag, thenflag)          \
+  DEFINE_VALUE_IMPLICATION(whenflag, thenflag, false)
+
// We want to declare the names of the variables for the header file. Normally // this will just be an extern declaration, but for a readonly flag we let the
 // compiler make better optimizations by giving it the value.
@@ -45,11 +51,8 @@

 // We produce the code to set flags when it is implied by another flag.
 #elif defined(FLAG_MODE_DEFINE_IMPLICATIONS)
-#define DEFINE_IMPLICATION(whenflag, thenflag) \
-  if (FLAG_##whenflag) FLAG_##thenflag = true;
-
-#define DEFINE_NEG_IMPLICATION(whenflag, thenflag) \
-  if (FLAG_##whenflag) FLAG_##thenflag = false;
+#define DEFINE_VALUE_IMPLICATION(whenflag, thenflag, value) \
+  if (FLAG_##whenflag) FLAG_##thenflag = value;

 #else
 #error No mode supplied when including flags.defs
@@ -68,12 +71,8 @@
 #define FLAG_ALIAS(ftype, ctype, alias, nam)
 #endif

-#ifndef DEFINE_IMPLICATION
-#define DEFINE_IMPLICATION(whenflag, thenflag)
-#endif
-
-#ifndef DEFINE_NEG_IMPLICATION
-#define DEFINE_NEG_IMPLICATION(whenflag, thenflag)
+#ifndef DEFINE_VALUE_IMPLICATION
+#define DEFINE_VALUE_IMPLICATION(whenflag, thenflag, value)
 #endif

 #define COMMA ,
@@ -214,6 +213,8 @@
             "Enables optimizations which favor memory size over execution "
             "speed.")

+DEFINE_VALUE_IMPLICATION(optimize_for_size, max_semi_space_size, 1)
+
 // Flags for data representation optimizations
DEFINE_BOOL(unbox_double_arrays, true, "automatically unbox arrays of doubles")
 DEFINE_BOOL(string_slices, true, "use string slices")
@@ -929,6 +930,7 @@
 #undef DEFINE_ARGS
 #undef DEFINE_IMPLICATION
 #undef DEFINE_NEG_IMPLICATION
+#undef DEFINE_VALUE_IMPLICATION
 #undef DEFINE_ALIAS_BOOL
 #undef DEFINE_ALIAS_INT
 #undef DEFINE_ALIAS_STRING
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Fri Sep 19 08:25:56 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-heap.cc Fri Sep 19 09:15:47 2014 UTC
@@ -4379,7 +4379,7 @@

// In this test we will try to overwrite the promotion queue which is at the // end of to-space. To actually make that possible, we need at least two
-    // semi-space pages and take advantage of fragementation.
+    // semi-space pages and take advantage of fragmentation.
     // (1) Grow semi-space to two pages.
     // (2) Create a few small long living objects and call the scavenger to
     // move them to the other semi-space.
@@ -4399,6 +4399,12 @@
// Grow the semi-space to two pages to make semi-space copy overwrite the
     // promotion queue, which will be at the end of the second page.
     intptr_t old_capacity = new_space->TotalCapacity();
+
+ // If we are in a low memory config, we can't grow to two pages and we can't + // run this test. This also means the issue we are testing cannot arise, as
+    // there is no fragmentation.
+    if (new_space->IsAtMaximumCapacity()) return;
+
     new_space->Grow();
     CHECK(new_space->IsAtMaximumCapacity());
     CHECK(2 * old_capacity == new_space->TotalCapacity());

--
--
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