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

Unified Diff: src/d8.cc

Issue 1899133004: [Interpreter] Add Ignition statistics JavaScript extension. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/d8.h ('k') | src/extensions/ignition-statistics-extension.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 169bc263934a8f1344419ac53ee0d88b8431d50f..287c6a0f7a00f98c3c63f7942a9013ad30ea2626 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -19,6 +19,7 @@
#ifndef V8_SHARED
#include <algorithm>
+#include <fstream>
#include <vector>
#endif // !V8_SHARED
@@ -1276,6 +1277,21 @@ struct CounterAndKey {
inline bool operator<(const CounterAndKey& lhs, const CounterAndKey& rhs) {
return strcmp(lhs.key, rhs.key) < 0;
}
+
+void Shell::WriteIgnitionDispatchCountersFile(v8::Isolate* isolate) {
+ HandleScope handle_scope(isolate);
+ Local<Context> context = Context::New(isolate);
+ Context::Scope context_scope(context);
+
+ Local<Object> dispatch_counters = reinterpret_cast<i::Isolate*>(isolate)
+ ->interpreter()
+ ->GetDispatchCountersObject();
+ std::ofstream dispatch_counters_stream(
+ i::FLAG_trace_ignition_dispatches_output_file);
+ dispatch_counters_stream << *String::Utf8Value(
+ JSON::Stringify(context, dispatch_counters).ToLocalChecked());
+}
+
#endif // !V8_SHARED
@@ -1314,12 +1330,6 @@ void Shell::OnExit(v8::Isolate* isolate) {
delete [] counters;
}
- if (i::FLAG_trace_ignition_dispatches) {
- reinterpret_cast<i::Isolate*>(isolate)
- ->interpreter()
- ->WriteDispatchCounters();
- }
-
delete counters_file_;
delete counter_map_;
#endif // !V8_SHARED
@@ -2484,6 +2494,12 @@ int Shell::Main(int argc, char* argv[]) {
RunShell(isolate);
}
+#ifndef V8_SHARED
+ if (i::FLAG_ignition && i::FLAG_trace_ignition_dispatches) {
+ WriteIgnitionDispatchCountersFile(isolate);
+ }
+#endif
+
// Shut down contexts and collect garbage.
evaluation_context_.Reset();
#ifndef V8_SHARED
« no previous file with comments | « src/d8.h ('k') | src/extensions/ignition-statistics-extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698