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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 5075 matching lines...) Expand 10 before | Expand all | Expand 10 after
5086 void Function::ClearCode() const { 5086 void Function::ClearCode() const {
5087 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); 5087 StorePointer(&raw_ptr()->unoptimized_code_, Code::null());
5088 StubCode* stub_code = Isolate::Current()->stub_code(); 5088 StubCode* stub_code = Isolate::Current()->stub_code();
5089 StorePointer(&raw_ptr()->instructions_, 5089 StorePointer(&raw_ptr()->instructions_,
5090 Code::Handle(stub_code->LazyCompile_entry()->code()).instructions()); 5090 Code::Handle(stub_code->LazyCompile_entry()->code()).instructions());
5091 } 5091 }
5092 5092
5093 5093
5094 void Function::SwitchToUnoptimizedCode() const { 5094 void Function::SwitchToUnoptimizedCode() const {
5095 ASSERT(HasOptimizedCode()); 5095 ASSERT(HasOptimizedCode());
5096 const Code& current_code = Code::Handle(CurrentCode()); 5096 Isolate* isolate = Isolate::Current();
5097 const Code& current_code = Code::Handle(isolate, CurrentCode());
5097 5098
5098 if (FLAG_trace_disabling_optimized_code) { 5099 if (FLAG_trace_disabling_optimized_code) {
5099 OS::Print("Disabling optimized code: '%s' entry: %#" Px "\n", 5100 OS::Print("Disabling optimized code: '%s' entry: %#" Px "\n",
5100 ToFullyQualifiedCString(), 5101 ToFullyQualifiedCString(),
5101 current_code.EntryPoint()); 5102 current_code.EntryPoint());
5102 } 5103 }
5103 // Patch entry of the optimized code. 5104 // Patch entry of the optimized code.
5104 CodePatcher::PatchEntry(current_code); 5105 CodePatcher::PatchEntry(current_code);
5105 // Use previously compiled unoptimized code. 5106 // Use previously compiled unoptimized code.
5106 AttachCode(Code::Handle(unoptimized_code())); 5107 AttachCode(Code::Handle(isolate, unoptimized_code()));
5107 CodePatcher::RestoreEntry(Code::Handle(unoptimized_code())); 5108 CodePatcher::RestoreEntry(Code::Handle(isolate, unoptimized_code()));
5109 isolate->TrackDeoptimizedCode(current_code);
5108 } 5110 }
5109 5111
5110 5112
5111 void Function::set_unoptimized_code(const Code& value) const { 5113 void Function::set_unoptimized_code(const Code& value) const {
5112 ASSERT(!value.is_optimized()); 5114 ASSERT(!value.is_optimized());
5113 StorePointer(&raw_ptr()->unoptimized_code_, value.raw()); 5115 StorePointer(&raw_ptr()->unoptimized_code_, value.raw());
5114 } 5116 }
5115 5117
5116 5118
5117 RawContextScope* Function::context_scope() const { 5119 RawContextScope* Function::context_scope() const {
(...skipping 7425 matching lines...) Expand 10 before | Expand all | Expand 10 after
12543 // Only disassemble alive code objects. 12545 // Only disassemble alive code objects.
12544 DisassembleToJSONStream formatter(jsarr); 12546 DisassembleToJSONStream formatter(jsarr);
12545 Disassemble(&formatter); 12547 Disassemble(&formatter);
12546 } 12548 }
12547 } 12549 }
12548 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); 12550 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
12549 if (!descriptors.IsNull()) { 12551 if (!descriptors.IsNull()) {
12550 JSONObject desc(&jsobj, "descriptors"); 12552 JSONObject desc(&jsobj, "descriptors");
12551 descriptors.PrintToJSONObject(&desc, false); 12553 descriptors.PrintToJSONObject(&desc, false);
12552 } 12554 }
12555 const Array& inlined_function_table = Array::Handle(inlined_id_to_function());
12556 if (!inlined_function_table.IsNull()) {
12557 JSONArray inlined_functions(&jsobj, "inlinedFunctions");
12558 Function& function = Function::Handle();
12559 for (intptr_t i = 0; i < inlined_function_table.Length(); i++) {
12560 function ^= inlined_function_table.At(i);
12561 ASSERT(!function.IsNull());
12562 inlined_functions.AddValue(function);
12563 }
12564 }
12565 const Array& intervals = Array::Handle(inlined_intervals());
12566 if (!intervals.IsNull()) {
12567 Smi& start = Smi::Handle();
12568 Smi& end = Smi::Handle();
12569 JSONArray inline_intervals(&jsobj, "inlinedIntervals");
12570 for (intptr_t i = 0; i < intervals.Length() - Code::kInlIntNumEntries;
12571 i += Code::kInlIntNumEntries) {
12572 start ^= intervals.At(i + Code::kInlIntStart);
12573 if (start.IsNull()) {
12574 continue;
12575 }
12576 end ^= intervals.At(i + Code::kInlIntNumEntries + Code::kInlIntStart);
12577
12578 // Format: [start, end, inline functions...]
12579 JSONArray inline_interval(&inline_intervals);
12580 inline_interval.AddValue(start.Value());
12581 inline_interval.AddValue(end.Value());
12582
12583 Smi& temp_smi = Smi::Handle();
siva 2015/02/25 22:58:39 This handle can be hoisted out of the for loop?
Cutch 2015/02/26 18:44:40 Done.
12584 temp_smi ^= intervals.At(i + Code::kInlIntInliningId);
12585 intptr_t inlining_id = temp_smi.Value();
12586 ASSERT(inlining_id >= 0);
12587 temp_smi ^= intervals.At(i + Code::kInlIntCallerId);
12588 intptr_t caller_id = temp_smi.Value();
12589 while (inlining_id >= 0) {
12590 inline_interval.AddValue(inlining_id);
12591 inlining_id = caller_id;
12592 caller_id = GetCallerId(inlining_id);
12593 }
12594 }
12595 }
12553 } 12596 }
12554 12597
12555 12598
12556 uword Code::GetEntryPatchPc() const { 12599 uword Code::GetEntryPatchPc() const {
12557 return (entry_patch_pc_offset() != kInvalidPc) 12600 return (entry_patch_pc_offset() != kInvalidPc)
12558 ? EntryPoint() + entry_patch_pc_offset() : 0; 12601 ? EntryPoint() + entry_patch_pc_offset() : 0;
12559 } 12602 }
12560 12603
12561 12604
12562 uword Code::GetPatchCodePc() const { 12605 uword Code::GetPatchCodePc() const {
(...skipping 8061 matching lines...) Expand 10 before | Expand all | Expand 10 after
20624 return tag_label.ToCString(); 20667 return tag_label.ToCString();
20625 } 20668 }
20626 20669
20627 20670
20628 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20671 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20629 Instance::PrintJSONImpl(stream, ref); 20672 Instance::PrintJSONImpl(stream, ref);
20630 } 20673 }
20631 20674
20632 20675
20633 } // namespace dart 20676 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698