Chromium Code Reviews| Index: src/d8.cc |
| diff --git a/src/d8.cc b/src/d8.cc |
| index d7e1b6ab06e6fa67638dd74f89434b5c78f6b404..a107afa3216d8a384ee3d7229cc86a2b17f87c13 100644 |
| --- a/src/d8.cc |
| +++ b/src/d8.cc |
| @@ -9,6 +9,7 @@ |
| #endif |
| #include <errno.h> |
| +#include <inttypes.h> |
| #include <stdlib.h> |
| #include <string.h> |
| #include <sys/stat.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" |
| @@ -1304,6 +1306,21 @@ inline bool operator<(const CounterAndKey& lhs, const CounterAndKey& rhs) { |
| } |
| #endif // !V8_SHARED |
| +void Shell::DumpHandlersDispatchCounters(FILE* stream, Isolate* isolate) { |
|
rmcilroy
2016/04/05 10:00:45
WriteInterpreterDispatchCounters
Stefano Sanfilippo
2016/04/05 14:01:45
Done.
|
| + uint32_t* handler_dispatch_counters = reinterpret_cast<i::Isolate*>(isolate) |
| + ->interpreter() |
| + ->handlers_dispatch_counters(); |
| + |
| + fputc('{', stream); |
|
rmcilroy
2016/04/05 10:00:45
Can we just use an ostream instead of the c file o
Stefano Sanfilippo
2016/04/05 14:01:45
Done.
|
| + for (int i = 0; i < i::interpreter::Interpreter::kCountersTableRowSize; ++i) { |
| + if (i > 0) fputs(", ", stream); |
| + i::interpreter::Bytecode bytecode = i::interpreter::Bytecodes::FromByte(i); |
| + fprintf(stream, "\"%s\": %" PRIu32, |
| + i::interpreter::Bytecodes::ToString(bytecode), |
| + handler_dispatch_counters[i]); |
| + } |
| + fputc('}', stream); |
| +} |
| void Shell::OnExit(v8::Isolate* isolate) { |
| #ifndef V8_SHARED |
| @@ -1339,6 +1356,15 @@ void Shell::OnExit(v8::Isolate* isolate) { |
| "-------------+\n"); |
| delete [] counters; |
| } |
| + |
| + if (i::FLAG_ignition_count_handler_dispatches) { |
| + FILE* ignition_counters_stream = |
| + fopen(i::FLAG_ignition_handler_to_handler_output_file, "w"); |
|
rmcilroy
2016/04/05 10:00:45
nit - just do the open / close in WriteInterpreter
Stefano Sanfilippo
2016/04/05 14:01:45
I'd rather open the stream externally and pass it
|
| + CHECK_NOT_NULL(ignition_counters_stream); |
| + DumpHandlersDispatchCounters(ignition_counters_stream, isolate); |
| + fclose(ignition_counters_stream); |
| + } |
| + |
| delete counters_file_; |
| delete counter_map_; |
| #endif // !V8_SHARED |