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

Unified Diff: runtime/vm/il_printer.cc

Issue 1920103004: Added flag --inline_smi_string_hashcode and --inline_smi_string_hashcode_ratio to decide when/if sh… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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: runtime/vm/il_printer.cc
diff --git a/runtime/vm/il_printer.cc b/runtime/vm/il_printer.cc
index cc621468b77e922970d005ba473712af4b0436ba..44b0490d2046ce6344c1d41705d19f0aef8ebc40 100644
--- a/runtime/vm/il_printer.cc
+++ b/runtime/vm/il_printer.cc
@@ -13,6 +13,8 @@ namespace dart {
#ifndef PRODUCT
+DEFINE_FLAG(bool, display_sorted_ic_data, false,
+ "Calls display a unary, sorted-by count form of ICData");
DEFINE_FLAG(bool, print_environments, false, "Print SSA environments.");
DEFINE_FLAG(charp, print_flow_graph_filter, NULL,
"Print only IR of functions with matching names");
@@ -191,7 +193,9 @@ const char* CompileType::ToCString() const {
}
-static void PrintICDataHelper(BufferFormatter* f, const ICData& ic_data) {
+static void PrintICDataHelper(BufferFormatter* f,
+ const ICData& ic_data,
+ intptr_t num_checks_to_print = -1) {
zra 2016/04/27 16:28:17 intptr_t num_checks_to_print = FlowGraphPrinter::k
srdjan 2016/04/27 18:10:22 Done.
f->Print(" IC[");
if (ic_data.HasRangeFeedback()) {
f->Print("{%s",
@@ -205,7 +209,11 @@ static void PrintICDataHelper(BufferFormatter* f, const ICData& ic_data) {
}
f->Print("%" Pd ": ", ic_data.NumberOfChecks());
Function& target = Function::Handle();
- for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) {
+ if ((num_checks_to_print < 0) ||
zra 2016/04/27 16:28:17 Then, this would be (num_checks_to_print == FlowGr
srdjan 2016/04/27 18:10:22 Done.
+ (num_checks_to_print > ic_data.NumberOfChecks())) {
+ num_checks_to_print = ic_data.NumberOfChecks();
+ }
+ for (intptr_t i = 0; i < num_checks_to_print; i++) {
GrowableArray<intptr_t> class_ids;
ic_data.GetCheckAt(i, &class_ids, &target);
const intptr_t count = ic_data.GetCountAt(i);
@@ -222,14 +230,35 @@ static void PrintICDataHelper(BufferFormatter* f, const ICData& ic_data) {
}
f->Print(" cnt:%" Pd " trgt:'%s'", count, target.ToQualifiedCString());
}
+ if (num_checks_to_print < ic_data.NumberOfChecks()) {
+ f->Print("...");
+ }
f->Print("]");
}
-void FlowGraphPrinter::PrintICData(const ICData& ic_data) {
+static void PrintICDataSortedHelper(BufferFormatter* f,
+ const ICData& ic_data_orig) {
+ const ICData& ic_data =
+ ICData::Handle(ic_data_orig.AsUnaryClassChecksSortedByCount());
+ f->Print(" IC[n:%" Pd"; ", ic_data.NumberOfChecks());
+ for (intptr_t i = 0; i < ic_data.NumberOfChecks(); i++) {
+ const intptr_t count = ic_data.GetCountAt(i);
+ const intptr_t cid = ic_data.GetReceiverClassIdAt(i);
+ const Class& cls =
+ Class::Handle(Isolate::Current()->class_table()->At(cid));
+ f->Print("%s : %" Pd ", ",
+ String::Handle(cls.Name()).ToCString(), count);
+ }
+ f->Print("]");
+}
+
+
+void FlowGraphPrinter::PrintICData(const ICData& ic_data,
+ intptr_t num_checks_to_print) {
char buffer[1024];
BufferFormatter f(buffer, sizeof(buffer));
- PrintICDataHelper(&f, ic_data);
+ PrintICDataHelper(&f, ic_data, num_checks_to_print);
THR_Print("%s ", buffer);
const Array& a = Array::Handle(ic_data.arguments_descriptor());
THR_Print(" arg-desc %" Pd "\n", a.Length());
@@ -435,7 +464,11 @@ void InstanceCallInstr::PrintOperandsTo(BufferFormatter* f) const {
PushArgumentAt(i)->value()->PrintTo(f);
}
if (HasICData()) {
- PrintICDataHelper(f, *ic_data());
+ if (FLAG_display_sorted_ic_data) {
+ PrintICDataSortedHelper(f, *ic_data());
+ } else {
+ PrintICDataHelper(f, *ic_data());
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698