Commit b856e878 authored by Yang Guo's avatar Yang Guo

Revert of Fix --max_old_space_size=4096 integer overflow. (patchset #1 id:1 of...

Revert of Fix --max_old_space_size=4096 integer overflow. (patchset #1 id:1 of https://codereview.chromium.org/890563003/)

Reason for revert:
Win64 compile failure.

Original issue's description:
> Fix --max_old_space_size=4096 integer overflow.
>
> R=yangguo@chromium.org
>
> Committed: https://crrev.com/6253aa8908c55535473ddbe1db8e5a6f5e559b73
> Cr-Commit-Position: refs/heads/master@{#26371}

TBR=svenpanne@chromium.org,ben@strongloop.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#26372}
parent 6253aa89
......@@ -151,7 +151,6 @@ struct MaybeBoolFlag {
#define DEFINE_MAYBE_BOOL(nam, cmt) \
FLAG(MAYBE_BOOL, MaybeBoolFlag, nam, {false COMMA false}, cmt)
#define DEFINE_INT(nam, def, cmt) FLAG(INT, int, nam, def, cmt)
#define DEFINE_INTPTR(nam, def, cmt) FLAG(INTPTR, intptr_t, 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)
#define DEFINE_ARGS(nam, cmt) FLAG(ARGS, JSArguments, nam, {0 COMMA NULL}, cmt)
......@@ -543,8 +542,8 @@ DEFINE_BOOL(enable_liveedit, true, "enable liveedit experimental feature")
DEFINE_BOOL(hard_abort, true, "abort by crashing")
// execution.cc
DEFINE_INTPTR(stack_size, V8_DEFAULT_STACK_SIZE_KB,
"default size of stack region v8 is allowed to use (in kBytes)")
DEFINE_INT(stack_size, V8_DEFAULT_STACK_SIZE_KB,
"default size of stack region v8 is allowed to use (in kBytes)")
// frames.cc
DEFINE_INT(max_stack_trace_source_length, 300,
......@@ -555,22 +554,21 @@ DEFINE_BOOL(always_inline_smi_code, false,
"always inline smi code in non-opt code")
// heap.cc
DEFINE_INTPTR(min_semi_space_size, 0,
"min size of a semi-space (in MBytes), the new space consists "
"of two semi-spaces")
DEFINE_INTPTR(target_semi_space_size, 0,
"target size of a semi-space (in MBytes) before triggering a GC")
DEFINE_INTPTR(max_semi_space_size, 0,
"max size of a semi-space (in MBytes), the new space consists "
"of two semi-spaces")
DEFINE_INT(min_semi_space_size, 0,
"min size of a semi-space (in MBytes), the new space consists of two"
"semi-spaces")
DEFINE_INT(target_semi_space_size, 0,
"target size of a semi-space (in MBytes) before triggering a GC")
DEFINE_INT(max_semi_space_size, 0,
"max size of a semi-space (in MBytes), the new space consists of two"
"semi-spaces")
DEFINE_INT(semi_space_growth_factor, 2, "factor by which to grow the new space")
DEFINE_BOOL(experimental_new_space_growth_heuristic, false,
"Grow the new space based on the percentage of survivors instead "
"of their absolute value.")
DEFINE_INTPTR(max_old_space_size, 0, "max size of the old space (in Mbytes)")
DEFINE_INTPTR(initial_old_space_size, 0, "initial old space size (in Mbytes)")
DEFINE_INTPTR(max_executable_size, 0,
"max size of executable memory (in Mbytes)")
DEFINE_INT(max_old_space_size, 0, "max size of the old space (in Mbytes)")
DEFINE_INT(initial_old_space_size, 0, "initial old space size (in Mbytes)")
DEFINE_INT(max_executable_size, 0, "max size of executable memory (in Mbytes)")
DEFINE_BOOL(gc_global, false, "always perform global GCs")
DEFINE_INT(gc_interval, -1, "garbage collect after <n> allocations")
DEFINE_BOOL(trace_gc, false,
......
......@@ -30,8 +30,8 @@ namespace {
// 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_INTPTR,
TYPE_FLOAT, TYPE_STRING, TYPE_ARGS };
enum FlagType { TYPE_BOOL, TYPE_MAYBE_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".
......@@ -61,11 +61,6 @@ struct Flag {
return reinterpret_cast<int*>(valptr_);
}
intptr_t* intptr_variable() const {
DCHECK(type_ == TYPE_INTPTR);
return reinterpret_cast<intptr_t*>(valptr_);
}
double* float_variable() const {
DCHECK(type_ == TYPE_FLOAT);
return reinterpret_cast<double*>(valptr_);
......@@ -99,11 +94,6 @@ struct Flag {
return *reinterpret_cast<const int*>(defptr_);
}
int intptr_default() const {
DCHECK(type_ == TYPE_INTPTR);
return *reinterpret_cast<const intptr_t*>(defptr_);
}
double float_default() const {
DCHECK(type_ == TYPE_FLOAT);
return *reinterpret_cast<const double*>(defptr_);
......@@ -128,8 +118,6 @@ struct Flag {
return maybe_bool_variable()->has_value == false;
case TYPE_INT:
return *int_variable() == int_default();
case TYPE_INTPTR:
return *intptr_variable() == intptr_default();
case TYPE_FLOAT:
return *float_variable() == float_default();
case TYPE_STRING: {
......@@ -158,9 +146,6 @@ struct Flag {
case TYPE_INT:
*int_variable() = int_default();
break;
case TYPE_INTPTR:
*intptr_variable() = intptr_default();
break;
case TYPE_FLOAT:
*float_variable() = float_default();
break;
......@@ -189,7 +174,6 @@ static const char* Type2String(Flag::FlagType type) {
case Flag::TYPE_BOOL: return "bool";
case Flag::TYPE_MAYBE_BOOL: return "maybe_bool";
case Flag::TYPE_INT: return "int";
case Flag::TYPE_INTPTR: return "intptr_t";
case Flag::TYPE_FLOAT: return "float";
case Flag::TYPE_STRING: return "string";
case Flag::TYPE_ARGS: return "arguments";
......@@ -212,9 +196,6 @@ std::ostream& operator<<(std::ostream& os, const Flag& flag) { // NOLINT
case Flag::TYPE_INT:
os << *flag.int_variable();
break;
case Flag::TYPE_INTPTR:
os << *flag.intptr_variable();
break;
case Flag::TYPE_FLOAT:
os << *flag.float_variable();
break;
......@@ -415,11 +396,6 @@ int FlagList::SetFlagsFromCommandLine(int* argc,
case Flag::TYPE_INT:
*flag->int_variable() = strtol(value, &endp, 10); // NOLINT
break;
case Flag::TYPE_INTPTR:
// TODO(bnoordhuis) Use strtoll()? C++11 library feature
// that may not be available everywhere yet.
*flag->intptr_variable() = strtol(value, &endp, 10); // NOLINT
break;
case Flag::TYPE_FLOAT:
*flag->float_variable() = strtod(value, &endp);
break;
......
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