Index: runtime/vm/flags.cc |
=================================================================== |
--- runtime/vm/flags.cc (revision 43658) |
+++ runtime/vm/flags.cc (working copy) |
@@ -26,6 +26,7 @@ |
enum FlagType { |
kBoolean, |
kInteger, |
+ kUint64, |
kString, |
kFunc, |
kNumFlagTypes |
@@ -53,6 +54,10 @@ |
OS::Print("%s: %d (%s)\n", name_, *this->int_ptr_, comment_); |
break; |
} |
+ case kUint64: { |
+ OS::Print("%s: %"Pu64" (%s)\n", name_, *this->uint64_ptr_, comment_); |
+ break; |
+ } |
case kString: { |
if (*this->charp_ptr_ != NULL) { |
OS::Print("%s: '%s' (%s)\n", name_, *this->charp_ptr_, comment_); |
@@ -81,6 +86,7 @@ |
void* addr_; |
bool* bool_ptr_; |
int* int_ptr_; |
+ uint64_t* uint64_ptr_; |
charp* charp_ptr_; |
FlagHandler handler_; |
}; |
@@ -158,6 +164,19 @@ |
} |
+uint64_t Flags::Register_uint64_t(uint64_t* addr, |
+ const char* name, |
+ uint64_t default_value, |
+ const char* comment) { |
+ ASSERT(Lookup(name) == NULL); |
+ |
+ Flag* flag = new Flag(name, comment, addr, Flag::kUint64); |
+ AddFlag(flag); |
+ |
+ return default_value; |
+} |
+ |
+ |
const char* Flags::Register_charp(charp* addr, |
const char* name, |
const char* default_value, |
@@ -221,6 +240,21 @@ |
} |
break; |
} |
+ case Flag::kUint64: { |
+ char* endptr = NULL; |
+ const intptr_t len = strlen(argument); |
+ int base = 10; |
+ if ((len > 2) && (argument[0] == '0') && (argument[1] == 'x')) { |
+ base = 16; |
+ } |
+ int64_t val = strtoll(argument, &endptr, base); |
+ if (endptr == argument + len) { |
+ *flag->uint64_ptr_ = static_cast<uint64_t>(val); |
+ } else { |
+ return false; |
+ } |
+ break; |
+ } |
case Flag::kFunc: { |
if (strcmp(argument, "true") == 0) { |
(flag->handler_)(true); |
@@ -405,6 +439,11 @@ |
jsflag.AddPropertyF("valueAsString", "%d", *flag->int_ptr_); |
break; |
} |
+ case Flag::kUint64: { |
+ jsflag.AddProperty("flagType", "uint64_t"); |
+ jsflag.AddPropertyF("valueAsString", "%"Pu64, *flag->uint64_ptr_); |
+ break; |
+ } |
case Flag::kString: { |
jsflag.AddProperty("flagType", "string"); |
if (flag->charp_ptr_ != NULL) { |