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

Unified Diff: runtime/vm/object.cc

Issue 928833003: Add Function based profile tree (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 32f70302d97eeadde72b515a5742568d4776885b..ad209ff3f06f282cfd6de72b7c6d59ef70d64f90 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -5098,7 +5098,8 @@ void Function::ClearCode() const {
void Function::SwitchToUnoptimizedCode() const {
ASSERT(HasOptimizedCode());
- const Code& current_code = Code::Handle(CurrentCode());
+ Isolate* isolate = Isolate::Current();
+ const Code& current_code = Code::Handle(isolate, CurrentCode());
if (FLAG_trace_disabling_optimized_code) {
OS::Print("Disabling optimized code: '%s' entry: %#" Px "\n",
@@ -5108,8 +5109,9 @@ void Function::SwitchToUnoptimizedCode() const {
// Patch entry of the optimized code.
CodePatcher::PatchEntry(current_code);
// Use previously compiled unoptimized code.
- AttachCode(Code::Handle(unoptimized_code()));
- CodePatcher::RestoreEntry(Code::Handle(unoptimized_code()));
+ AttachCode(Code::Handle(isolate, unoptimized_code()));
+ CodePatcher::RestoreEntry(Code::Handle(isolate, unoptimized_code()));
+ isolate->TrackDeoptimizedCode(current_code);
}
@@ -12555,6 +12557,47 @@ void Code::PrintJSONImpl(JSONStream* stream, bool ref) const {
JSONObject desc(&jsobj, "descriptors");
descriptors.PrintToJSONObject(&desc, false);
}
+ const Array& inlined_function_table = Array::Handle(inlined_id_to_function());
+ if (!inlined_function_table.IsNull()) {
+ JSONArray inlined_functions(&jsobj, "inlinedFunctions");
+ Function& function = Function::Handle();
+ for (intptr_t i = 0; i < inlined_function_table.Length(); i++) {
+ function ^= inlined_function_table.At(i);
+ ASSERT(!function.IsNull());
+ inlined_functions.AddValue(function);
+ }
+ }
+ const Array& intervals = Array::Handle(inlined_intervals());
+ if (!intervals.IsNull()) {
+ Smi& start = Smi::Handle();
+ Smi& end = Smi::Handle();
+ Smi& temp_smi = Smi::Handle();
+ JSONArray inline_intervals(&jsobj, "inlinedIntervals");
+ for (intptr_t i = 0; i < intervals.Length() - Code::kInlIntNumEntries;
+ i += Code::kInlIntNumEntries) {
+ start ^= intervals.At(i + Code::kInlIntStart);
+ if (start.IsNull()) {
+ continue;
+ }
+ end ^= intervals.At(i + Code::kInlIntNumEntries + Code::kInlIntStart);
+
+ // Format: [start, end, inline functions...]
+ JSONArray inline_interval(&inline_intervals);
+ inline_interval.AddValue(start.Value());
+ inline_interval.AddValue(end.Value());
+
+ temp_smi ^= intervals.At(i + Code::kInlIntInliningId);
+ intptr_t inlining_id = temp_smi.Value();
+ ASSERT(inlining_id >= 0);
+ temp_smi ^= intervals.At(i + Code::kInlIntCallerId);
+ intptr_t caller_id = temp_smi.Value();
+ while (inlining_id >= 0) {
+ inline_interval.AddValue(inlining_id);
+ inlining_id = caller_id;
+ caller_id = GetCallerId(inlining_id);
+ }
+ }
+ }
}
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698