From: mstarzinger@chromium.org Date: Thu, 25 Jul 2013 14:11:53 +0000 (+0000) Subject: Make standalone D8 trace to single hydrogen.cfg file. X-Git-Tag: upstream/4.7.83~13203 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f06f57f7fb72985652a76c4bb66d5a28a5bf1c11;p=platform%2Fupstream%2Fv8.git Make standalone D8 trace to single hydrogen.cfg file. R=titzer@chromium.org Review URL: https://codereview.chromium.org/20204005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15882 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/d8.cc b/src/d8.cc index 5343174..1efe2ae 100644 --- a/src/d8.cc +++ b/src/d8.cc @@ -1547,11 +1547,12 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) { #ifdef V8_SHARED -static void EnableHarmonyTypedArraysViaCommandLine() { - int fake_argc = 2; - char **fake_argv = new char*[2]; +static void SetStandaloneFlagsViaCommandLine() { + int fake_argc = 3; + char **fake_argv = new char*[3]; fake_argv[0] = NULL; fake_argv[1] = strdup("--harmony-typed-arrays"); + fake_argv[2] = strdup("--trace-hydrogen-file=hydrogen.cfg"); v8::V8::SetFlagsFromCommandLine(&fake_argc, fake_argv, false); free(fake_argv[1]); delete[] fake_argv; @@ -1572,8 +1573,9 @@ int Shell::Main(int argc, char* argv[]) { #ifndef V8_SHARED i::FLAG_harmony_array_buffer = true; i::FLAG_harmony_typed_arrays = true; + i::FLAG_trace_hydrogen_file = "hydrogen.cfg"; #else - EnableHarmonyTypedArraysViaCommandLine(); + SetStandaloneFlagsViaCommandLine(); #endif ShellArrayBufferAllocator array_buffer_allocator; v8::V8::SetArrayBufferAllocator(&array_buffer_allocator); diff --git a/src/flag-definitions.h b/src/flag-definitions.h index 72159c0..8888aed 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -238,6 +238,7 @@ DEFINE_bool(collect_megamorphic_maps_from_stub_cache, DEFINE_bool(hydrogen_stats, false, "print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false, "trace generated hydrogen to file") DEFINE_bool(trace_hydrogen_stubs, false, "trace generated hydrogen for stubs") +DEFINE_string(trace_hydrogen_file, NULL, "trace hydrogen to given file name") DEFINE_string(trace_phase, "HLZ", "trace generated IR for specified phases") DEFINE_bool(trace_inlining, false, "trace inlining decisions") DEFINE_bool(trace_alloc, false, "trace register allocator") diff --git a/src/hydrogen.h b/src/hydrogen.h index 46d23da..895b984 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -2085,10 +2085,14 @@ class HTracer: public Malloced { public: explicit HTracer(int isolate_id) : trace_(&string_allocator_), indent_(0) { - OS::SNPrintF(filename_, - "hydrogen-%d-%d.cfg", - OS::GetCurrentProcessId(), - isolate_id); + if (FLAG_trace_hydrogen_file == NULL) { + OS::SNPrintF(filename_, + "hydrogen-%d-%d.cfg", + OS::GetCurrentProcessId(), + isolate_id); + } else { + OS::StrNCpy(filename_, FLAG_trace_hydrogen_file, filename_.length()); + } WriteChars(filename_.start(), "", 0, false); }