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

Unified Diff: src/d8.cc

Issue 1828633003: [Interpreter] Enable tracing of bytecode handler dispatches. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@count-bc
Patch Set: Remove cumulative counters. 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
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index c23c1a4a9c722f0839fd4ca4976c41e90b10cda0..14c75f1ac12bf157b20ca9b407f961c011b404a6 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -12,6 +12,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#include <fstream>
#ifdef V8_SHARED
#include <assert.h>
@@ -41,6 +42,7 @@
#include "src/base/platform/platform.h"
#include "src/base/sys-info.h"
#include "src/basic-block-profiler.h"
+#include "src/interpreter/interpreter.h"
#include "src/snapshot/natives.h"
#include "src/utils.h"
#include "src/v8.h"
@@ -1275,6 +1277,40 @@ struct CounterAndKey {
inline bool operator<(const CounterAndKey& lhs, const CounterAndKey& rhs) {
return strcmp(lhs.key, rhs.key) < 0;
}
+
+void Shell::WriteInterpreterDispatchCounters(Isolate* isolate) {
+ std::ofstream stream(i::FLAG_trace_ignition_dispatches_output_file);
+
+ uintptr_t* handler_to_handler_dispatch_counters =
+ reinterpret_cast<i::Isolate*>(isolate)
+ ->interpreter()
+ ->handler_to_handler_dispatch_counters();
+
+ int kCountersTableRowSize =
rmcilroy 2016/04/08 11:24:43 static const
Stefano Sanfilippo 2016/04/08 14:42:44 Done.
+ static_cast<int>(i::interpreter::Bytecode::kLast) + 1;
+
+ stream << '[';
+
+ for (int from_index = 0; from_index < kCountersTableRowSize; ++from_index) {
+ if (from_index > 0) stream << ",\n ";
+
+ // Do not use an object, we need the order of entries to be preserved
rmcilroy 2016/04/08 11:24:43 Not sure what this comment means? Also, could we h
Stefano Sanfilippo 2016/04/08 14:42:44 Replaced with dictionary of dictionaries.
+ i::interpreter::Bytecode from_bytecode =
+ i::interpreter::Bytecodes::FromByte(from_index);
+ stream << "[\"" << i::interpreter::Bytecodes::ToString(from_bytecode)
+ << "\", [";
+
+ for (int to_index = 0; to_index < kCountersTableRowSize; ++to_index) {
+ if (to_index > 0) stream << ", ";
+ stream << handler_to_handler_dispatch_counters[from_index *
+ kCountersTableRowSize +
+ to_index];
+ }
+ stream << "]]";
+ }
+ stream << ']';
+}
+
#endif // !V8_SHARED
@@ -1312,6 +1348,11 @@ void Shell::OnExit(v8::Isolate* isolate) {
"-------------+\n");
delete [] counters;
}
+
+ if (i::FLAG_trace_ignition_dispatches) {
+ WriteInterpreterDispatchCounters(isolate);
+ }
+
delete counters_file_;
delete counter_map_;
#endif // !V8_SHARED

Powered by Google App Engine
This is Rietveld 408576698