OLD | NEW |
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 #include <errno.h> | 5 #include <errno.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 2793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2804 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); | 2804 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); |
2805 _set_error_mode(_OUT_TO_STDERR); | 2805 _set_error_mode(_OUT_TO_STDERR); |
2806 #endif // defined(_MSC_VER) | 2806 #endif // defined(_MSC_VER) |
2807 #endif // defined(_WIN32) || defined(_WIN64) | 2807 #endif // defined(_WIN32) || defined(_WIN64) |
2808 if (!SetOptions(argc, argv)) return 1; | 2808 if (!SetOptions(argc, argv)) return 1; |
2809 v8::V8::InitializeICUDefaultLocation(argv[0], options.icu_data_file); | 2809 v8::V8::InitializeICUDefaultLocation(argv[0], options.icu_data_file); |
2810 g_platform = i::FLAG_verify_predictable | 2810 g_platform = i::FLAG_verify_predictable |
2811 ? new PredictablePlatform() | 2811 ? new PredictablePlatform() |
2812 : v8::platform::CreateDefaultPlatform(); | 2812 : v8::platform::CreateDefaultPlatform(); |
2813 | 2813 |
2814 std::unique_ptr<platform::tracing::TracingController> tracing_controller; | 2814 platform::tracing::TracingController* tracing_controller; |
2815 if (options.trace_enabled) { | 2815 if (options.trace_enabled) { |
2816 trace_file.open("v8_trace.json"); | 2816 trace_file.open("v8_trace.json"); |
2817 tracing_controller.reset(new platform::tracing::TracingController()); | 2817 tracing_controller = new platform::tracing::TracingController(); |
2818 platform::tracing::TraceBuffer* trace_buffer = | 2818 platform::tracing::TraceBuffer* trace_buffer = |
2819 platform::tracing::TraceBuffer::CreateTraceBufferRingBuffer( | 2819 platform::tracing::TraceBuffer::CreateTraceBufferRingBuffer( |
2820 platform::tracing::TraceBuffer::kRingBufferChunks, | 2820 platform::tracing::TraceBuffer::kRingBufferChunks, |
2821 platform::tracing::TraceWriter::CreateJSONTraceWriter(trace_file)); | 2821 platform::tracing::TraceWriter::CreateJSONTraceWriter(trace_file)); |
2822 tracing_controller->Initialize(trace_buffer); | 2822 tracing_controller->Initialize(trace_buffer); |
2823 if (!i::FLAG_verify_predictable) { | 2823 if (!i::FLAG_verify_predictable) { |
2824 platform::SetTracingController(g_platform, tracing_controller.release()); | 2824 platform::SetTracingController(g_platform, tracing_controller); |
2825 } | 2825 } |
2826 } | 2826 } |
2827 | 2827 |
2828 v8::V8::InitializePlatform(g_platform); | 2828 v8::V8::InitializePlatform(g_platform); |
2829 v8::V8::Initialize(); | 2829 v8::V8::Initialize(); |
2830 if (options.natives_blob || options.snapshot_blob) { | 2830 if (options.natives_blob || options.snapshot_blob) { |
2831 v8::V8::InitializeExternalStartupData(options.natives_blob, | 2831 v8::V8::InitializeExternalStartupData(options.natives_blob, |
2832 options.snapshot_blob); | 2832 options.snapshot_blob); |
2833 } else { | 2833 } else { |
2834 v8::V8::InitializeExternalStartupData(argv[0]); | 2834 v8::V8::InitializeExternalStartupData(argv[0]); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2934 // Dump basic block profiling data. | 2934 // Dump basic block profiling data. |
2935 if (i::BasicBlockProfiler* profiler = | 2935 if (i::BasicBlockProfiler* profiler = |
2936 reinterpret_cast<i::Isolate*>(isolate)->basic_block_profiler()) { | 2936 reinterpret_cast<i::Isolate*>(isolate)->basic_block_profiler()) { |
2937 i::OFStream os(stdout); | 2937 i::OFStream os(stdout); |
2938 os << *profiler; | 2938 os << *profiler; |
2939 } | 2939 } |
2940 isolate->Dispose(); | 2940 isolate->Dispose(); |
2941 V8::Dispose(); | 2941 V8::Dispose(); |
2942 V8::ShutdownPlatform(); | 2942 V8::ShutdownPlatform(); |
2943 delete g_platform; | 2943 delete g_platform; |
| 2944 if (i::FLAG_verify_predictable) { |
| 2945 delete tracing_controller; |
| 2946 } |
2944 | 2947 |
2945 return result; | 2948 return result; |
2946 } | 2949 } |
2947 | 2950 |
2948 } // namespace v8 | 2951 } // namespace v8 |
2949 | 2952 |
2950 | 2953 |
2951 #ifndef GOOGLE3 | 2954 #ifndef GOOGLE3 |
2952 int main(int argc, char* argv[]) { | 2955 int main(int argc, char* argv[]) { |
2953 return v8::Shell::Main(argc, argv); | 2956 return v8::Shell::Main(argc, argv); |
2954 } | 2957 } |
2955 #endif | 2958 #endif |
OLD | NEW |