#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)
DEFINE_BOOL(hard_abort, true, "abort by crashing")
// execution.cc
-DEFINE_INT(stack_size, V8_DEFAULT_STACK_SIZE_KB,
- "default size of stack region v8 is allowed to use (in kBytes)")
+DEFINE_INTPTR(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,
"always inline smi code in non-opt code")
// heap.cc
-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_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(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_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_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_BOOL(gc_global, false, "always perform global GCs")
DEFINE_INT(gc_interval, -1, "garbage collect after <n> allocations")
DEFINE_BOOL(trace_gc, false,
// 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_MAYBE_BOOL, TYPE_INT, TYPE_INTPTR,
+ 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".
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_);
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_);
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: {
case TYPE_INT:
*int_variable() = int_default();
break;
+ case TYPE_INTPTR:
+ *intptr_variable() = intptr_default();
+ break;
case TYPE_FLOAT:
*float_variable() = float_default();
break;
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";
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;
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;