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

Side by Side Diff: src/d8.cc

Issue 753483002: dump compiler stats from d8 on direct exit from js (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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/isolate.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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 true)) { 610 true)) {
611 Throw(args.GetIsolate(), "Error executing file"); 611 Throw(args.GetIsolate(), "Error executing file");
612 return; 612 return;
613 } 613 }
614 } 614 }
615 } 615 }
616 616
617 617
618 void Shell::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) { 618 void Shell::Quit(const v8::FunctionCallbackInfo<v8::Value>& args) {
619 int exit_code = args[0]->Int32Value(); 619 int exit_code = args[0]->Int32Value();
620 OnExit(); 620 OnExit(args.GetIsolate());
621 exit(exit_code); 621 exit(exit_code);
622 } 622 }
623 623
624 624
625 void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) { 625 void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) {
626 args.GetReturnValue().Set( 626 args.GetReturnValue().Set(
627 String::NewFromUtf8(args.GetIsolate(), V8::GetVersion())); 627 String::NewFromUtf8(args.GetIsolate(), V8::GetVersion()));
628 } 628 }
629 629
630 630
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 const char* key; 1047 const char* key;
1048 }; 1048 };
1049 1049
1050 1050
1051 inline bool operator<(const CounterAndKey& lhs, const CounterAndKey& rhs) { 1051 inline bool operator<(const CounterAndKey& lhs, const CounterAndKey& rhs) {
1052 return strcmp(lhs.key, rhs.key) < 0; 1052 return strcmp(lhs.key, rhs.key) < 0;
1053 } 1053 }
1054 #endif // !V8_SHARED 1054 #endif // !V8_SHARED
1055 1055
1056 1056
1057 void Shell::OnExit() { 1057 void Shell::OnExit(v8::Isolate* isolate) {
1058 LineEditor* line_editor = LineEditor::Get(); 1058 LineEditor* line_editor = LineEditor::Get();
1059 if (line_editor) line_editor->Close(); 1059 if (line_editor) line_editor->Close();
1060 #ifndef V8_SHARED 1060 #ifndef V8_SHARED
1061 reinterpret_cast<i::Isolate*>(isolate)->DumpAndResetCompilationStats();
1061 if (i::FLAG_dump_counters) { 1062 if (i::FLAG_dump_counters) {
1062 int number_of_counters = 0; 1063 int number_of_counters = 0;
1063 for (CounterMap::Iterator i(counter_map_); i.More(); i.Next()) { 1064 for (CounterMap::Iterator i(counter_map_); i.More(); i.Next()) {
1064 number_of_counters++; 1065 number_of_counters++;
1065 } 1066 }
1066 CounterAndKey* counters = new CounterAndKey[number_of_counters]; 1067 CounterAndKey* counters = new CounterAndKey[number_of_counters];
1067 int j = 0; 1068 int j = 0;
1068 for (CounterMap::Iterator i(counter_map_); i.More(); i.Next(), j++) { 1069 for (CounterMap::Iterator i(counter_map_); i.More(); i.Next(), j++) {
1069 counters[j].counter = i.CurrentValue(); 1070 counters[j].counter = i.CurrentValue();
1070 counters[j].key = i.CurrentKey(); 1071 counters[j].key = i.CurrentKey();
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 // executed, but never on --test 1740 // executed, but never on --test
1740 if (options.use_interactive_shell()) { 1741 if (options.use_interactive_shell()) {
1741 #ifndef V8_SHARED 1742 #ifndef V8_SHARED
1742 if (!i::FLAG_debugger) { 1743 if (!i::FLAG_debugger) {
1743 InstallUtilityScript(isolate); 1744 InstallUtilityScript(isolate);
1744 } 1745 }
1745 #endif // !V8_SHARED 1746 #endif // !V8_SHARED
1746 RunShell(isolate); 1747 RunShell(isolate);
1747 } 1748 }
1748 } 1749 }
1749 OnExit(); 1750 OnExit(isolate);
1750 #ifndef V8_SHARED 1751 #ifndef V8_SHARED
1751 // Dump basic block profiling data. 1752 // Dump basic block profiling data.
1752 if (i::BasicBlockProfiler* profiler = 1753 if (i::BasicBlockProfiler* profiler =
1753 reinterpret_cast<i::Isolate*>(isolate)->basic_block_profiler()) { 1754 reinterpret_cast<i::Isolate*>(isolate)->basic_block_profiler()) {
1754 i::OFStream os(stdout); 1755 i::OFStream os(stdout);
1755 os << *profiler; 1756 os << *profiler;
1756 } 1757 }
1757 #endif // !V8_SHARED 1758 #endif // !V8_SHARED
1758 isolate->Dispose(); 1759 isolate->Dispose();
1759 V8::Dispose(); 1760 V8::Dispose();
1760 V8::ShutdownPlatform(); 1761 V8::ShutdownPlatform();
1761 delete platform; 1762 delete platform;
1762 1763
1763 return result; 1764 return result;
1764 } 1765 }
1765 1766
1766 } // namespace v8 1767 } // namespace v8
1767 1768
1768 1769
1769 #ifndef GOOGLE3 1770 #ifndef GOOGLE3
1770 int main(int argc, char* argv[]) { 1771 int main(int argc, char* argv[]) {
1771 return v8::Shell::Main(argc, argv); 1772 return v8::Shell::Main(argc, argv);
1772 } 1773 }
1773 #endif 1774 #endif
OLDNEW
« no previous file with comments | « src/d8.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698