Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(776)

Side by Side Diff: src/d8.cc

Issue 2183923004: Reland [Tracing] V8 Tracing Controller (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix CHECK_EQ undefined behavior in test-tracing to be determinstic Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/d8.h ('k') | src/libplatform/default-platform.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 // Defined when linking against shared lib on Windows. 6 // Defined when linking against shared lib on Windows.
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED)
8 #define V8_SHARED 8 #define V8_SHARED
9 #endif 9 #endif
10 10
(...skipping 17 matching lines...) Expand all
28 #endif // V8_SHARED 28 #endif // V8_SHARED
29 29
30 #ifdef ENABLE_VTUNE_JIT_INTERFACE 30 #ifdef ENABLE_VTUNE_JIT_INTERFACE
31 #include "src/third_party/vtune/v8-vtune.h" 31 #include "src/third_party/vtune/v8-vtune.h"
32 #endif 32 #endif
33 33
34 #include "src/d8.h" 34 #include "src/d8.h"
35 #include "src/ostreams.h" 35 #include "src/ostreams.h"
36 36
37 #include "include/libplatform/libplatform.h" 37 #include "include/libplatform/libplatform.h"
38 #include "include/libplatform/v8-tracing.h"
38 #ifndef V8_SHARED 39 #ifndef V8_SHARED
39 #include "src/api.h" 40 #include "src/api.h"
40 #include "src/base/cpu.h" 41 #include "src/base/cpu.h"
41 #include "src/base/logging.h" 42 #include "src/base/logging.h"
42 #include "src/base/platform/platform.h" 43 #include "src/base/platform/platform.h"
43 #include "src/base/sys-info.h" 44 #include "src/base/sys-info.h"
44 #include "src/basic-block-profiler.h" 45 #include "src/basic-block-profiler.h"
45 #include "src/interpreter/interpreter.h" 46 #include "src/interpreter/interpreter.h"
46 #include "src/snapshot/natives.h" 47 #include "src/snapshot/natives.h"
47 #include "src/utils.h" 48 #include "src/utils.h"
(...skipping 1936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 options.compile_options = v8::ScriptCompiler::kProduceCodeCache; 1985 options.compile_options = v8::ScriptCompiler::kProduceCodeCache;
1985 } else if (strncmp(value, "=parse", 7) == 0) { 1986 } else if (strncmp(value, "=parse", 7) == 0) {
1986 options.compile_options = v8::ScriptCompiler::kProduceParserCache; 1987 options.compile_options = v8::ScriptCompiler::kProduceParserCache;
1987 } else if (strncmp(value, "=none", 6) == 0) { 1988 } else if (strncmp(value, "=none", 6) == 0) {
1988 options.compile_options = v8::ScriptCompiler::kNoCompileOptions; 1989 options.compile_options = v8::ScriptCompiler::kNoCompileOptions;
1989 } else { 1990 } else {
1990 printf("Unknown option to --cache.\n"); 1991 printf("Unknown option to --cache.\n");
1991 return false; 1992 return false;
1992 } 1993 }
1993 argv[i] = NULL; 1994 argv[i] = NULL;
1995 } else if (strcmp(argv[i], "--enable-tracing") == 0) {
1996 options.trace_enabled = true;
1997 argv[i] = NULL;
1994 } 1998 }
1995 } 1999 }
1996 2000
1997 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); 2001 v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
1998 2002
1999 // Set up isolated source groups. 2003 // Set up isolated source groups.
2000 options.isolate_sources = new SourceGroup[options.num_isolates]; 2004 options.isolate_sources = new SourceGroup[options.num_isolates];
2001 SourceGroup* current = options.isolate_sources; 2005 SourceGroup* current = options.isolate_sources;
2002 current->Begin(argv, 1); 2006 current->Begin(argv, 1);
2003 for (int i = 1; i < argc; i++) { 2007 for (int i = 1; i < argc; i++) {
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2400 printf(" (\"%s\", 0x%05" V8PRIxPTR "): \"%s\",\n", sname, p, n); 2404 printf(" (\"%s\", 0x%05" V8PRIxPTR "): \"%s\",\n", sname, p, n);
2401 } 2405 }
2402 } 2406 }
2403 printf("}\n"); 2407 printf("}\n");
2404 #undef ROOT_LIST_CASE 2408 #undef ROOT_LIST_CASE
2405 } 2409 }
2406 #endif // !V8_SHARED 2410 #endif // !V8_SHARED
2407 2411
2408 2412
2409 int Shell::Main(int argc, char* argv[]) { 2413 int Shell::Main(int argc, char* argv[]) {
2414 std::ofstream trace_file;
2410 #if (defined(_WIN32) || defined(_WIN64)) 2415 #if (defined(_WIN32) || defined(_WIN64))
2411 UINT new_flags = 2416 UINT new_flags =
2412 SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX; 2417 SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
2413 UINT existing_flags = SetErrorMode(new_flags); 2418 UINT existing_flags = SetErrorMode(new_flags);
2414 SetErrorMode(existing_flags | new_flags); 2419 SetErrorMode(existing_flags | new_flags);
2415 #if defined(_MSC_VER) 2420 #if defined(_MSC_VER)
2416 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); 2421 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
2417 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); 2422 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
2418 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE); 2423 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG | _CRTDBG_MODE_FILE);
2419 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); 2424 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 create_params.create_histogram_callback = CreateHistogram; 2472 create_params.create_histogram_callback = CreateHistogram;
2468 create_params.add_histogram_sample_callback = AddHistogramSample; 2473 create_params.add_histogram_sample_callback = AddHistogramSample;
2469 } 2474 }
2470 #endif 2475 #endif
2471 Isolate* isolate = Isolate::New(create_params); 2476 Isolate* isolate = Isolate::New(create_params);
2472 { 2477 {
2473 Isolate::Scope scope(isolate); 2478 Isolate::Scope scope(isolate);
2474 Initialize(isolate); 2479 Initialize(isolate);
2475 PerIsolateData data(isolate); 2480 PerIsolateData data(isolate);
2476 2481
2482 if (options.trace_enabled) {
2483 trace_file.open("v8_trace.json");
2484 platform::tracing::TracingController* tracing_controller =
2485 new platform::tracing::TracingController();
2486 platform::tracing::TraceBuffer* trace_buffer =
2487 platform::tracing::TraceBuffer::CreateTraceBufferRingBuffer(
2488 platform::tracing::TraceBuffer::kRingBufferChunks,
2489 platform::tracing::TraceWriter::CreateJSONTraceWriter(
2490 trace_file));
2491 platform::tracing::TraceConfig* trace_config;
2492 trace_config = new platform::tracing::TraceConfig();
2493 trace_config->AddIncludedCategory("v8");
2494 tracing_controller->Initialize(trace_buffer);
2495 tracing_controller->StartTracing(trace_config);
2496 #ifndef V8_SHARED
2497 if (!i::FLAG_verify_predictable) {
2498 platform::SetTracingController(g_platform, tracing_controller);
2499 }
2500 #else
2501 platform::SetTracingController(g_platform, tracing_controller);
2502 #endif
2503 }
2504
2477 #ifndef V8_SHARED 2505 #ifndef V8_SHARED
2478 if (options.dump_heap_constants) { 2506 if (options.dump_heap_constants) {
2479 DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate)); 2507 DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate));
2480 return 0; 2508 return 0;
2481 } 2509 }
2482 #endif 2510 #endif
2483 2511
2484 if (options.stress_opt || options.stress_deopt) { 2512 if (options.stress_opt || options.stress_deopt) {
2485 Testing::SetStressRunType(options.stress_opt 2513 Testing::SetStressRunType(options.stress_opt
2486 ? Testing::kStressTypeOpt 2514 ? Testing::kStressTypeOpt
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2548 } 2576 }
2549 2577
2550 } // namespace v8 2578 } // namespace v8
2551 2579
2552 2580
2553 #ifndef GOOGLE3 2581 #ifndef GOOGLE3
2554 int main(int argc, char* argv[]) { 2582 int main(int argc, char* argv[]) {
2555 return v8::Shell::Main(argc, argv); 2583 return v8::Shell::Main(argc, argv);
2556 } 2584 }
2557 #endif 2585 #endif
OLDNEW
« no previous file with comments | « src/d8.h ('k') | src/libplatform/default-platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698