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

Unified Diff: src/frames.cc

Issue 2503183002: [Tracing] Implement IC statistics in tracing. (Closed)
Patch Set: Remove unnecessary cast Created 4 years 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/frames.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index 5ecffaf7b10f1b8e6dcba021a98c901e3460c6d4..a99b1ae9b4fac433972e16cffe0f587c68349d50 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -11,6 +11,7 @@
#include "src/deoptimizer.h"
#include "src/frames-inl.h"
#include "src/full-codegen/full-codegen.h"
+#include "src/ic/ic-stats.h"
#include "src/register-configuration.h"
#include "src/safepoint-table.h"
#include "src/string-stream.h"
@@ -1017,7 +1018,6 @@ void JavaScriptFrame::PrintFunctionAndOffset(JSFunction* function,
}
}
-
void JavaScriptFrame::PrintTop(Isolate* isolate, FILE* file, bool print_args,
bool print_line_number) {
// constructor calls
@@ -1057,6 +1057,51 @@ void JavaScriptFrame::PrintTop(Isolate* isolate, FILE* file, bool print_args,
}
}
+void JavaScriptFrame::CollectFunctionAndOffsetForICStats(JSFunction* function,
+ AbstractCode* code,
+ int code_offset) {
+ auto ic_stats = ICStats::instance();
+ ICInfo& ic_info = ic_stats->Current();
+ SharedFunctionInfo* shared = function->shared();
+
+ ic_info.function_name = ic_stats->GetOrCacheFunctionName(function);
+ ic_info.script_offset = code_offset;
+
+ int source_pos = code->SourcePosition(code_offset);
+ Object* maybe_script = shared->script();
+ if (maybe_script->IsScript()) {
+ Script* script = Script::cast(maybe_script);
+ ic_info.line_num = script->GetLineNumber(source_pos) + 1;
+ ic_info.script_name = ic_stats->GetOrCacheScriptName(script);
+ }
+}
+
+void JavaScriptFrame::CollectTopFrameForICStats(Isolate* isolate) {
+ // constructor calls
+ DisallowHeapAllocation no_allocation;
+ JavaScriptFrameIterator it(isolate);
+ ICInfo& ic_info = ICStats::instance()->Current();
+ while (!it.done()) {
+ if (it.frame()->is_java_script()) {
+ JavaScriptFrame* frame = it.frame();
+ if (frame->IsConstructor()) ic_info.is_constructor = true;
+ JSFunction* function = frame->function();
+ int code_offset = 0;
+ if (frame->is_interpreted()) {
+ InterpretedFrame* iframe = reinterpret_cast<InterpretedFrame*>(frame);
+ code_offset = iframe->GetBytecodeOffset();
+ } else {
+ Code* code = frame->unchecked_code();
+ code_offset = static_cast<int>(frame->pc() - code->instruction_start());
+ }
+ CollectFunctionAndOffsetForICStats(function, function->abstract_code(),
+ code_offset);
+ return;
+ }
+ it.Advance();
+ }
+}
+
Object* JavaScriptFrame::GetParameter(int index) const {
return Memory::Object_at(GetParameterSlot(index));
}
« no previous file with comments | « src/frames.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698