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

Side by Side Diff: src/d8.cc

Issue 1708573003: [WIP]Create a V8 sampler library and tracing controller. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | « include/v8-tracing-controller.h ('k') | src/isolate.cc » ('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 19 matching lines...) Expand all
30 #include "src/gdb-jit.h" 30 #include "src/gdb-jit.h"
31 #endif 31 #endif
32 32
33 #ifdef ENABLE_VTUNE_JIT_INTERFACE 33 #ifdef ENABLE_VTUNE_JIT_INTERFACE
34 #include "src/third_party/vtune/v8-vtune.h" 34 #include "src/third_party/vtune/v8-vtune.h"
35 #endif 35 #endif
36 36
37 #include "src/d8.h" 37 #include "src/d8.h"
38 #include "src/ostreams.h" 38 #include "src/ostreams.h"
39 39
40 #include "include/v8-sampler.h"
41 #include "include/v8-tracing-controller.h"
40 #include "include/libplatform/libplatform.h" 42 #include "include/libplatform/libplatform.h"
41 #ifndef V8_SHARED 43 #ifndef V8_SHARED
42 #include "src/api.h" 44 #include "src/api.h"
43 #include "src/base/cpu.h" 45 #include "src/base/cpu.h"
44 #include "src/base/logging.h" 46 #include "src/base/logging.h"
45 #include "src/base/platform/platform.h" 47 #include "src/base/platform/platform.h"
46 #include "src/base/sys-info.h" 48 #include "src/base/sys-info.h"
47 #include "src/basic-block-profiler.h" 49 #include "src/basic-block-profiler.h"
48 #include "src/snapshot/natives.h" 50 #include "src/snapshot/natives.h"
49 #include "src/utils.h" 51 #include "src/utils.h"
(...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 #ifndef V8_SHARED 2443 #ifndef V8_SHARED
2442 g_platform = i::FLAG_verify_predictable 2444 g_platform = i::FLAG_verify_predictable
2443 ? new PredictablePlatform() 2445 ? new PredictablePlatform()
2444 : v8::platform::CreateDefaultPlatform(); 2446 : v8::platform::CreateDefaultPlatform();
2445 #else 2447 #else
2446 g_platform = v8::platform::CreateDefaultPlatform(); 2448 g_platform = v8::platform::CreateDefaultPlatform();
2447 #endif // !V8_SHARED 2449 #endif // !V8_SHARED
2448 2450
2449 v8::V8::InitializePlatform(g_platform); 2451 v8::V8::InitializePlatform(g_platform);
2450 v8::V8::Initialize(); 2452 v8::V8::Initialize();
2453 // Initialize tracing controller support
2454 TracingController::SetUp();
2451 if (options.natives_blob || options.snapshot_blob) { 2455 if (options.natives_blob || options.snapshot_blob) {
2452 v8::V8::InitializeExternalStartupData(options.natives_blob, 2456 v8::V8::InitializeExternalStartupData(options.natives_blob,
2453 options.snapshot_blob); 2457 options.snapshot_blob);
2454 } else { 2458 } else {
2455 v8::V8::InitializeExternalStartupData(argv[0]); 2459 v8::V8::InitializeExternalStartupData(argv[0]);
2456 } 2460 }
2457 SetFlagsFromString("--trace-hydrogen-file=hydrogen.cfg"); 2461 SetFlagsFromString("--trace-hydrogen-file=hydrogen.cfg");
2458 SetFlagsFromString("--trace-turbo-cfg-file=turbo.cfg"); 2462 SetFlagsFromString("--trace-turbo-cfg-file=turbo.cfg");
2459 SetFlagsFromString("--redirect-code-traces-to=code.asm"); 2463 SetFlagsFromString("--redirect-code-traces-to=code.asm");
2460 int result = 0; 2464 int result = 0;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 Isolate::Scope scope(isolate); 2496 Isolate::Scope scope(isolate);
2493 Initialize(isolate); 2497 Initialize(isolate);
2494 PerIsolateData data(isolate); 2498 PerIsolateData data(isolate);
2495 2499
2496 #ifndef V8_SHARED 2500 #ifndef V8_SHARED
2497 if (options.dump_heap_constants) { 2501 if (options.dump_heap_constants) {
2498 DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate)); 2502 DumpHeapConstants(reinterpret_cast<i::Isolate*>(isolate));
2499 return 0; 2503 return 0;
2500 } 2504 }
2501 #endif 2505 #endif
2506 TracingController::StartTracing(isolate);
2502 2507
2503 if (options.stress_opt || options.stress_deopt) { 2508 if (options.stress_opt || options.stress_deopt) {
2504 Testing::SetStressRunType(options.stress_opt 2509 Testing::SetStressRunType(options.stress_opt
2505 ? Testing::kStressTypeOpt 2510 ? Testing::kStressTypeOpt
2506 : Testing::kStressTypeDeopt); 2511 : Testing::kStressTypeDeopt);
2507 options.stress_runs = Testing::GetStressRuns(); 2512 options.stress_runs = Testing::GetStressRuns();
2508 for (int i = 0; i < options.stress_runs && result == 0; i++) { 2513 for (int i = 0; i < options.stress_runs && result == 0; i++) {
2509 printf("============ Stress %d/%d ============\n", i + 1, 2514 printf("============ Stress %d/%d ============\n", i + 1,
2510 options.stress_runs); 2515 options.stress_runs);
2511 Testing::PrepareStressRun(i); 2516 Testing::PrepareStressRun(i);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 } 2552 }
2548 OnExit(isolate); 2553 OnExit(isolate);
2549 #ifndef V8_SHARED 2554 #ifndef V8_SHARED
2550 // Dump basic block profiling data. 2555 // Dump basic block profiling data.
2551 if (i::BasicBlockProfiler* profiler = 2556 if (i::BasicBlockProfiler* profiler =
2552 reinterpret_cast<i::Isolate*>(isolate)->basic_block_profiler()) { 2557 reinterpret_cast<i::Isolate*>(isolate)->basic_block_profiler()) {
2553 i::OFStream os(stdout); 2558 i::OFStream os(stdout);
2554 os << *profiler; 2559 os << *profiler;
2555 } 2560 }
2556 #endif // !V8_SHARED 2561 #endif // !V8_SHARED
2562 TracingController::StopTracing();
2557 isolate->Dispose(); 2563 isolate->Dispose();
2564 TracingController::TearDown();
2558 V8::Dispose(); 2565 V8::Dispose();
2559 V8::ShutdownPlatform(); 2566 V8::ShutdownPlatform();
2560 delete g_platform; 2567 delete g_platform;
2561 2568
2562 return result; 2569 return result;
2563 } 2570 }
2564 2571
2565 } // namespace v8 2572 } // namespace v8
2566 2573
2567 2574
2568 #ifndef GOOGLE3 2575 #ifndef GOOGLE3
2569 int main(int argc, char* argv[]) { 2576 int main(int argc, char* argv[]) {
2570 return v8::Shell::Main(argc, argv); 2577 return v8::Shell::Main(argc, argv);
2571 } 2578 }
2572 #endif 2579 #endif
OLDNEW
« no previous file with comments | « include/v8-tracing-controller.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698