| Index: src/d8.cc
|
| diff --git a/src/d8.cc b/src/d8.cc
|
| index c23c1a4a9c722f0839fd4ca4976c41e90b10cda0..d9c9a5d0ae54fe2ea3cbff11b45accfd0d894688 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,25 @@ 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_dispatch_counters = reinterpret_cast<i::Isolate*>(isolate)
|
| + ->interpreter()
|
| + ->dispatch_counters();
|
| + stream << '{';
|
| + for (int counter_index = 0;
|
| + counter_index <= static_cast<int>(i::interpreter::Bytecode::kLast);
|
| + ++counter_index) {
|
| + if (counter_index > 0) stream << ", ";
|
| + i::interpreter::Bytecode bytecode =
|
| + i::interpreter::Bytecodes::FromByte(counter_index);
|
| + stream << '\"' << i::interpreter::Bytecodes::ToString(bytecode)
|
| + << "\": " << handler_dispatch_counters[counter_index];
|
| + }
|
| + stream << '}';
|
| +}
|
| #endif // !V8_SHARED
|
|
|
|
|
| @@ -1312,6 +1333,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
|
|
|