Commit f1e82cc1 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

The --optimize-for-size flag should imply a small semi-space

R=hpayer@chromium.org, mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/585523002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24069 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a66600f0
......@@ -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 @@ DEFINE_BOOL(optimize_for_size, false,
"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 @@ DEFINE_BOOL(enable_ool_constant_pool, V8_OOL_CONSTANT_POOL,
#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
......
......@@ -4379,7 +4379,7 @@ UNINITIALIZED_TEST(PromotionQueue) {
// 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 @@ UNINITIALIZED_TEST(PromotionQueue) {
// 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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment