Revision: 16736
Author: svenpa...@chromium.org
Date: Mon Sep 16 14:09:22 2013 UTC
Log: Revert "Add flags to force or prevent setting of
isolate.is_memory_constrained."
It introduces static initializers for the new "MAYBE_BOOL" kind of
flags, which is a no-no for Chrome. This has to be done differently.
TBR=da...@chromium.org
Review URL: https://codereview.chromium.org/23621044
http://code.google.com/p/v8/source/detail?r=16736
Modified:
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/flag-definitions.h
/branches/bleeding_edge/src/flags.cc
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/test/cctest/test-flags.cc
=======================================
--- /branches/bleeding_edge/src/api.cc Mon Sep 16 13:02:53 2013 UTC
+++ /branches/bleeding_edge/src/api.cc Mon Sep 16 14:09:22 2013 UTC
@@ -624,8 +624,7 @@
uintptr_t limit =
reinterpret_cast<uintptr_t>(constraints->stack_limit());
isolate->stack_guard()->SetStackLimit(limit);
}
- if (constraints->is_memory_constrained().has_value &&
- !i::FLAG_force_memory_constrained.has_value) {
+ if (constraints->is_memory_constrained().has_value) {
isolate->set_is_memory_constrained(
constraints->is_memory_constrained().value);
}
=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Mon Sep 16 13:02:53 2013
UTC
+++ /branches/bleeding_edge/src/flag-definitions.h Mon Sep 16 14:09:22 2013
UTC
@@ -148,8 +148,6 @@
#endif
#define DEFINE_bool(nam, def, cmt) FLAG(BOOL, bool, nam, def, cmt)
-#define DEFINE_maybe_bool(nam, cmt) FLAG(MAYBE_BOOL, Maybe<bool>, nam, \
- Maybe<bool>(), cmt)
#define DEFINE_int(nam, def, cmt) FLAG(INT, int, nam, def, cmt)
#define DEFINE_float(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt)
#define DEFINE_string(nam, def, cmt) FLAG(STRING, const char*, nam, def,
cmt)
@@ -602,9 +600,6 @@
0,
"Fixed seed to use to hash property keys (0 means random)"
"(with snapshots this option cannot override the baked-in
seed)")
-DEFINE_maybe_bool(force_memory_constrained,
- "force (if true) or prevent (if false) the runtime from
treating "
- "the device as being memory constrained.")
// v8.cc
DEFINE_bool(preemption, false,
@@ -615,7 +610,6 @@
// Testing flags test/cctest/test-{flags,api,serialization}.cc
DEFINE_bool(testing_bool_flag, true, "testing_bool_flag")
-DEFINE_maybe_bool(testing_maybe_bool_flag, "testing_maybe_bool_flag")
DEFINE_int(testing_int_flag, 13, "testing_int_flag")
DEFINE_float(testing_float_flag, 2.5, "float-flag")
DEFINE_string(testing_string_flag, "Hello, world!", "string-flag")
@@ -840,7 +834,6 @@
#undef FLAG_ALIAS
#undef DEFINE_bool
-#undef DEFINE_maybe_bool
#undef DEFINE_int
#undef DEFINE_string
#undef DEFINE_float
=======================================
--- /branches/bleeding_edge/src/flags.cc Mon Sep 16 13:02:53 2013 UTC
+++ /branches/bleeding_edge/src/flags.cc Mon Sep 16 14:09:22 2013 UTC
@@ -55,8 +55,7 @@
// to the actual flag, default value, comment, etc. This is designed to
be POD
// initialized as to avoid requiring static constructors.
struct Flag {
- enum FlagType { TYPE_BOOL, TYPE_MAYBE_BOOL, TYPE_INT, TYPE_FLOAT,
- TYPE_STRING, TYPE_ARGS };
+ enum FlagType { TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS
};
FlagType type_; // What type of flag, bool, int, or string.
const char* name_; // Name of the flag, ex "my_flag".
@@ -75,11 +74,6 @@
ASSERT(type_ == TYPE_BOOL);
return reinterpret_cast<bool*>(valptr_);
}
-
- Maybe<bool>* maybe_bool_variable() const {
- ASSERT(type_ == TYPE_MAYBE_BOOL);
- return reinterpret_cast<Maybe<bool>*>(valptr_);
- }
int* int_variable() const {
ASSERT(type_ == TYPE_INT);
@@ -139,8 +133,6 @@
switch (type_) {
case TYPE_BOOL:
return *bool_variable() == bool_default();
- case TYPE_MAYBE_BOOL:
- return maybe_bool_variable()->has_value == false;
case TYPE_INT:
return *int_variable() == int_default();
case TYPE_FLOAT:
@@ -165,9 +157,6 @@
case TYPE_BOOL:
*bool_variable() = bool_default();
break;
- case TYPE_MAYBE_BOOL:
- *maybe_bool_variable() = Maybe<bool>();
- break;
case TYPE_INT:
*int_variable() = int_default();
break;
@@ -197,7 +186,6 @@
static const char* Type2String(Flag::FlagType type) {
switch (type) {
case Flag::TYPE_BOOL: return "bool";
- case Flag::TYPE_MAYBE_BOOL: return "maybe_bool";
case Flag::TYPE_INT: return "int";
case Flag::TYPE_FLOAT: return "float";
case Flag::TYPE_STRING: return "string";
@@ -215,11 +203,6 @@
case Flag::TYPE_BOOL:
buffer.Add("%s", (*flag->bool_variable() ? "true" : "false"));
break;
- case Flag::TYPE_MAYBE_BOOL:
- buffer.Add("%s", flag->maybe_bool_variable()->has_value
- ?
(flag->maybe_bool_variable()->value ? "true" : "false")
- : "unset");
- break;
case Flag::TYPE_INT:
buffer.Add("%d", *flag->int_variable());
break;
@@ -397,7 +380,6 @@
// if we still need a flag value, use the next argument if available
if (flag->type() != Flag::TYPE_BOOL &&
- flag->type() != Flag::TYPE_MAYBE_BOOL &&
flag->type() != Flag::TYPE_ARGS &&
value == NULL) {
if (i < *argc) {
@@ -417,9 +399,6 @@
case Flag::TYPE_BOOL:
*flag->bool_variable() = !is_bool;
break;
- case Flag::TYPE_MAYBE_BOOL:
- *flag->maybe_bool_variable() = Maybe<bool>(!is_bool);
- break;
case Flag::TYPE_INT:
*flag->int_variable() = strtol(value, &endp, 10); // NOLINT
break;
@@ -446,9 +425,8 @@
}
// handle errors
- bool is_bool_type = flag->type() == Flag::TYPE_BOOL ||
- flag->type() == Flag::TYPE_MAYBE_BOOL;
- if ((is_bool_type && value != NULL) || (!is_bool_type && is_bool) ||
+ if ((flag->type() == Flag::TYPE_BOOL && value != NULL) ||
+ (flag->type() != Flag::TYPE_BOOL && is_bool) ||
*endp != '\0') {
PrintF(stderr, "Error: illegal value for flag %s of type %s\n"
"Try --help for options\n",
@@ -571,7 +549,6 @@
}
-// static
void FlagList::EnforceFlagImplications() {
#define FLAG_MODE_DEFINE_IMPLICATIONS
#include "flag-definitions.h"
=======================================
--- /branches/bleeding_edge/src/isolate.cc Mon Sep 16 13:02:53 2013 UTC
+++ /branches/bleeding_edge/src/isolate.cc Mon Sep 16 14:09:22 2013 UTC
@@ -1776,9 +1776,6 @@
// TODO(bmeurer) Initialized lazily because it depends on flags; can
// be fixed once the default isolate cleanup is done.
random_number_generator_(NULL),
- // TODO(rmcilroy) Currently setting this based on
- // FLAG_force_memory_constrained in Isolate::Init; move to here when
- // isolate cleanup is done
is_memory_constrained_(false),
has_fatal_error_(false),
use_crankshaft_(true),
@@ -2138,8 +2135,6 @@
TRACE_ISOLATE(init);
stress_deopt_count_ = FLAG_deopt_every_n_times;
- if (FLAG_force_memory_constrained.has_value)
- is_memory_constrained_ = FLAG_force_memory_constrained.value;
has_fatal_error_ = false;
=======================================
--- /branches/bleeding_edge/test/cctest/test-flags.cc Mon Sep 16 13:02:53
2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-flags.cc Mon Sep 16 14:09:22
2013 UTC
@@ -54,18 +54,15 @@
TEST(Flags2) {
SetFlagsToDefault();
- int argc = 8;
- const char* argv[] = { "Test2", "-notesting-bool-flag",
- "--notesting-maybe-bool-flag", "notaflag",
+ int argc = 7;
+ const char* argv[] = { "Test2", "-notesting-bool-flag", "notaflag",
"--testing_int_flag=77", "-testing_float_flag=.25",
"--testing_string_flag", "no way!" };
CHECK_EQ(0, FlagList::SetFlagsFromCommandLine(&argc,
const_cast<char **>(argv),
false));
- CHECK_EQ(8, argc);
+ CHECK_EQ(7, argc);
CHECK(!FLAG_testing_bool_flag);
- CHECK(FLAG_testing_maybe_bool_flag.has_value);
- CHECK(!FLAG_testing_maybe_bool_flag.value);
CHECK_EQ(77, FLAG_testing_int_flag);
CHECK_EQ(.25, FLAG_testing_float_flag);
CHECK_EQ(0, strcmp(FLAG_testing_string_flag, "no way!"));
@@ -76,13 +73,10 @@
SetFlagsToDefault();
const char* str =
" -notesting-bool-flag notaflag --testing_int_flag=77 "
- "-notesting-maybe-bool-flag "
"-testing_float_flag=.25 "
"--testing_string_flag no_way! ";
CHECK_EQ(0, FlagList::SetFlagsFromString(str, StrLength(str)));
CHECK(!FLAG_testing_bool_flag);
- CHECK(FLAG_testing_maybe_bool_flag.has_value);
- CHECK(!FLAG_testing_maybe_bool_flag.value);
CHECK_EQ(77, FLAG_testing_int_flag);
CHECK_EQ(.25, FLAG_testing_float_flag);
CHECK_EQ(0, strcmp(FLAG_testing_string_flag, "no_way!"));
@@ -91,9 +85,9 @@
TEST(Flags3) {
SetFlagsToDefault();
- int argc = 9;
+ int argc = 8;
const char* argv[] =
-
{ "Test3", "--testing_bool_flag", "--testing-maybe-bool-flag", "notaflag",
+ { "Test3", "--testing_bool_flag", "notaflag",
"--testing_int_flag", "-666",
"--testing_float_flag", "-12E10", "-testing-string-flag=foo-bar" };
CHECK_EQ(0, FlagList::SetFlagsFromCommandLine(&argc,
@@ -101,8 +95,6 @@
true));
CHECK_EQ(2, argc);
CHECK(FLAG_testing_bool_flag);
- CHECK(FLAG_testing_maybe_bool_flag.has_value);
- CHECK(FLAG_testing_maybe_bool_flag.value);
CHECK_EQ(-666, FLAG_testing_int_flag);
CHECK_EQ(-12E10, FLAG_testing_float_flag);
CHECK_EQ(0, strcmp(FLAG_testing_string_flag, "foo-bar"));
@@ -112,14 +104,11 @@
TEST(Flags3b) {
SetFlagsToDefault();
const char* str =
- "--testing_bool_flag --testing-maybe-bool-flag notaflag "
- "--testing_int_flag -666 "
+ "--testing_bool_flag notaflag --testing_int_flag -666 "
"--testing_float_flag -12E10 "
"-testing-string-flag=foo-bar";
CHECK_EQ(0, FlagList::SetFlagsFromString(str, StrLength(str)));
CHECK(FLAG_testing_bool_flag);
- CHECK(FLAG_testing_maybe_bool_flag.has_value);
- CHECK(FLAG_testing_maybe_bool_flag.value);
CHECK_EQ(-666, FLAG_testing_int_flag);
CHECK_EQ(-12E10, FLAG_testing_float_flag);
CHECK_EQ(0, strcmp(FLAG_testing_string_flag, "foo-bar"));
@@ -134,7 +123,6 @@
const_cast<char **>(argv),
true));
CHECK_EQ(2, argc);
- CHECK(!FLAG_testing_maybe_bool_flag.has_value);
}
@@ -142,7 +130,6 @@
SetFlagsToDefault();
const char* str = "--testing_bool_flag --foo";
CHECK_EQ(2, FlagList::SetFlagsFromString(str, StrLength(str)));
- CHECK(!FLAG_testing_maybe_bool_flag.has_value);
}
--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.