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

Unified Diff: runtime/vm/stub_code.cc

Issue 2584613002: PATCH (not to be comitted): Support for printing instruction statistics
Patch Set: Fixed polymorphic call inside try, added more tags for remaining unknown code 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 | « runtime/vm/snapshot.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code.cc
diff --git a/runtime/vm/stub_code.cc b/runtime/vm/stub_code.cc
index 5b6a5f54c07d90549c4b2165980cbaa2f45aba6e..f98b4a2e4b6b490748a43f4e61fcc9fe08e903b2 100644
--- a/runtime/vm/stub_code.cc
+++ b/runtime/vm/stub_code.cc
@@ -15,11 +15,14 @@
#include "vm/virtual_memory.h"
#include "vm/visitor.h"
#include "vm/clustered_snapshot.h"
+#include "vm/code_statistics.h"
namespace dart {
DEFINE_FLAG(bool, disassemble_stubs, false, "Disassemble generated stubs.");
+DECLARE_FLAG(bool, print_instruction_stats);
+
#define STUB_CODE_DECLARE(name) StubEntry* StubCode::name##_entry_ = NULL;
VM_STUB_CODE_LIST(STUB_CODE_DECLARE);
#undef STUB_CODE_DECLARE
@@ -141,6 +144,13 @@ RawCode* StubCode::GetAllocationStubForClass(const Class& cls) {
Code& stub = Code::Handle(zone, cls.allocation_stub());
if (stub.IsNull()) {
Assembler assembler;
+
+ CodeStatistics* function_stats = NULL;
+ if (FLAG_print_instruction_stats) {
+ function_stats = new CodeStatistics(&assembler);
+ function_stats->SpecialBegin(CombinedCodeStatistics::kTagStubCode);
+ }
+
const char* name = cls.ToCString();
StubCode::GenerateAllocationStubForClass(&assembler, cls);
@@ -178,6 +188,11 @@ RawCode* StubCode::GetAllocationStubForClass(const Class& cls) {
isolate->heap()->CollectAllGarbage();
}
}
+ if (FLAG_print_instruction_stats) {
+ function_stats->SpecialEnd(CombinedCodeStatistics::kTagStubCode);
+ function_stats->Finalize();
+ stub.set_stats(function_stats);
+ }
#ifndef PRODUCT
if (FLAG_support_disassembler && FLAG_disassemble_stubs) {
LogBlock lb;
@@ -221,9 +236,23 @@ const StubEntry* StubCode::UnoptimizedStaticCallEntry(
RawCode* StubCode::Generate(const char* name,
void (*GenerateStub)(Assembler* assembler)) {
Assembler assembler;
+
+ CodeStatistics* function_stats = NULL;
+ if (FLAG_print_instruction_stats) {
+ function_stats = new CodeStatistics(&assembler);
+ function_stats->SpecialBegin(CombinedCodeStatistics::kTagStubCode);
+ }
+
GenerateStub(&assembler);
const Code& code =
Code::Handle(Code::FinalizeCode(name, &assembler, false /* optimized */));
+
+ if (FLAG_print_instruction_stats) {
+ function_stats->SpecialEnd(CombinedCodeStatistics::kTagStubCode);
+ function_stats->Finalize();
+ code.set_stats(function_stats);
+ }
+
#ifndef PRODUCT
if (FLAG_support_disassembler && FLAG_disassemble_stubs) {
LogBlock lb;
« no previous file with comments | « runtime/vm/snapshot.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698