Commit 4b05f743 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Introduce --print-all-code flag and infrastructure for one flag to imply another flag.

Review URL: http://codereview.chromium.org/8957009

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10267 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 538fb2b8
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
extern ctype FLAG_##nam; extern ctype FLAG_##nam;
#define FLAG_READONLY(ftype, ctype, nam, def, cmt) \ #define FLAG_READONLY(ftype, ctype, nam, def, cmt) \
static ctype const FLAG_##nam = def; static ctype const FLAG_##nam = def;
#define DEFINE_implication(whenflag, thenflag)
// We want to supply the actual storage and value for the flag variable in the // We want to supply the actual storage and value for the flag variable in the
// .cc file. We only do this for writable flags. // .cc file. We only do this for writable flags.
...@@ -48,6 +49,7 @@ ...@@ -48,6 +49,7 @@
#define FLAG_FULL(ftype, ctype, nam, def, cmt) \ #define FLAG_FULL(ftype, ctype, nam, def, cmt) \
ctype FLAG_##nam = def; ctype FLAG_##nam = def;
#define FLAG_READONLY(ftype, ctype, nam, def, cmt) #define FLAG_READONLY(ftype, ctype, nam, def, cmt)
#define DEFINE_implication(whenflag, thenflag)
// We need to define all of our default values so that the Flag structure can // We need to define all of our default values so that the Flag structure can
// access them by pointer. These are just used internally inside of one .cc, // access them by pointer. These are just used internally inside of one .cc,
...@@ -56,7 +58,7 @@ ...@@ -56,7 +58,7 @@
#define FLAG_FULL(ftype, ctype, nam, def, cmt) \ #define FLAG_FULL(ftype, ctype, nam, def, cmt) \
static ctype const FLAGDEFAULT_##nam = def; static ctype const FLAGDEFAULT_##nam = def;
#define FLAG_READONLY(ftype, ctype, nam, def, cmt) #define FLAG_READONLY(ftype, ctype, nam, def, cmt)
#define DEFINE_implication(whenflag, thenflag)
// We want to write entries into our meta data table, for internal parsing and // We want to write entries into our meta data table, for internal parsing and
// printing / etc in the flag parser code. We only do this for writable flags. // printing / etc in the flag parser code. We only do this for writable flags.
...@@ -64,6 +66,14 @@ ...@@ -64,6 +66,14 @@
#define FLAG_FULL(ftype, ctype, nam, def, cmt) \ #define FLAG_FULL(ftype, ctype, nam, def, cmt) \
{ Flag::TYPE_##ftype, #nam, &FLAG_##nam, &FLAGDEFAULT_##nam, cmt, false }, { Flag::TYPE_##ftype, #nam, &FLAG_##nam, &FLAGDEFAULT_##nam, cmt, false },
#define FLAG_READONLY(ftype, ctype, nam, def, cmt) #define FLAG_READONLY(ftype, ctype, nam, def, cmt)
#define DEFINE_implication(whenflag, thenflag)
// We produce the code to set flags when it is implied by another flag.
#elif defined(FLAG_MODE_DEFINE_IMPLICATIONS)
#define FLAG_FULL(ftype, ctype, nam, def, cmt)
#define FLAG_READONLY(ftype, ctype, nam, def, cmt)
#define DEFINE_implication(whenflag, thenflag) \
if (FLAG_##whenflag) FLAG_##thenflag = true;
#else #else
#error No mode supplied when including flags.defs #error No mode supplied when including flags.defs
...@@ -103,6 +113,10 @@ DEFINE_bool(harmony_proxies, false, "enable harmony proxies") ...@@ -103,6 +113,10 @@ DEFINE_bool(harmony_proxies, false, "enable harmony proxies")
DEFINE_bool(harmony_collections, false, DEFINE_bool(harmony_collections, false,
"enable harmony collections (sets, maps, and weak maps)") "enable harmony collections (sets, maps, and weak maps)")
DEFINE_bool(harmony, false, "enable all harmony features") DEFINE_bool(harmony, false, "enable all harmony features")
DEFINE_implication(harmony, harmony_typeof)
DEFINE_implication(harmony, harmony_scoping)
DEFINE_implication(harmony, harmony_proxies)
DEFINE_implication(harmony, harmony_collections)
// Flags for experimental implementation features. // Flags for experimental implementation features.
DEFINE_bool(unbox_double_arrays, true, "automatically unbox arrays of doubles") DEFINE_bool(unbox_double_arrays, true, "automatically unbox arrays of doubles")
...@@ -542,6 +556,17 @@ DEFINE_bool(print_unopt_code, false, "print unoptimized code before " ...@@ -542,6 +556,17 @@ DEFINE_bool(print_unopt_code, false, "print unoptimized code before "
DEFINE_bool(print_code_verbose, false, "print more information for code") DEFINE_bool(print_code_verbose, false, "print more information for code")
DEFINE_bool(print_builtin_code, false, "print generated code for builtins") DEFINE_bool(print_builtin_code, false, "print generated code for builtins")
#ifdef ENABLE_DISASSEMBLER
DEFINE_bool(print_all_code, false, "enable all flags related to printing code")
DEFINE_implication(print_all_code, print_code)
DEFINE_implication(print_all_code, print_opt_code)
DEFINE_implication(print_all_code, print_unopt_code)
DEFINE_implication(print_all_code, print_code_verbose)
DEFINE_implication(print_all_code, print_builtin_code)
DEFINE_implication(print_all_code, print_code_stubs)
DEFINE_implication(print_all_code, trace_codegen)
#endif
// Cleanup... // Cleanup...
#undef FLAG_FULL #undef FLAG_FULL
#undef FLAG_READONLY #undef FLAG_READONLY
...@@ -550,8 +575,10 @@ DEFINE_bool(print_builtin_code, false, "print generated code for builtins") ...@@ -550,8 +575,10 @@ DEFINE_bool(print_builtin_code, false, "print generated code for builtins")
#undef DEFINE_bool #undef DEFINE_bool
#undef DEFINE_int #undef DEFINE_int
#undef DEFINE_string #undef DEFINE_string
#undef DEFINE_implication
#undef FLAG_MODE_DECLARE #undef FLAG_MODE_DECLARE
#undef FLAG_MODE_DEFINE #undef FLAG_MODE_DEFINE
#undef FLAG_MODE_DEFINE_DEFAULTS #undef FLAG_MODE_DEFINE_DEFAULTS
#undef FLAG_MODE_META #undef FLAG_MODE_META
#undef FLAG_MODE_DEFINE_IMPLICATIONS
...@@ -548,4 +548,9 @@ JSArguments& JSArguments::operator=(JSArguments args) { ...@@ -548,4 +548,9 @@ JSArguments& JSArguments::operator=(JSArguments args) {
} }
void FlagList::EnforceFlagImplications() {
#define FLAG_MODE_DEFINE_IMPLICATIONS
#include "flag-definitions.h"
}
} } // namespace v8::internal } } // namespace v8::internal
...@@ -72,6 +72,9 @@ class FlagList { ...@@ -72,6 +72,9 @@ class FlagList {
// Print help to stdout with flags, types, and default values. // Print help to stdout with flags, types, and default values.
static void PrintHelp(); static void PrintHelp();
// Set flags as consequence of being implied by another flag.
static void EnforceFlagImplications();
}; };
} } // namespace v8::internal } } // namespace v8::internal
......
...@@ -57,14 +57,7 @@ static EntropySource entropy_source; ...@@ -57,14 +57,7 @@ static EntropySource entropy_source;
bool V8::Initialize(Deserializer* des) { bool V8::Initialize(Deserializer* des) {
// Setting --harmony implies all other harmony flags. FlagList::EnforceFlagImplications();
// TODO(rossberg): Is there a better place to put this?
if (FLAG_harmony) {
FLAG_harmony_typeof = true;
FLAG_harmony_scoping = true;
FLAG_harmony_proxies = true;
FLAG_harmony_collections = true;
}
InitializeOncePerProcess(); InitializeOncePerProcess();
......
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