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

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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5080 matching lines...) Expand 10 before | Expand all | Expand 10 after
5091 void Function::ClearCode() const { 5091 void Function::ClearCode() const {
5092 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); 5092 StorePointer(&raw_ptr()->unoptimized_code_, Code::null());
5093 StubCode* stub_code = Isolate::Current()->stub_code(); 5093 StubCode* stub_code = Isolate::Current()->stub_code();
5094 StorePointer(&raw_ptr()->instructions_, 5094 StorePointer(&raw_ptr()->instructions_,
5095 Code::Handle(stub_code->LazyCompile_entry()->code()).instructions()); 5095 Code::Handle(stub_code->LazyCompile_entry()->code()).instructions());
5096 } 5096 }
5097 5097
5098 5098
5099 void Function::SwitchToUnoptimizedCode() const { 5099 void Function::SwitchToUnoptimizedCode() const {
5100 ASSERT(HasOptimizedCode()); 5100 ASSERT(HasOptimizedCode());
5101 const Code& current_code = Code::Handle(CurrentCode()); 5101 Isolate* isolate = Isolate::Current();
5102 const Code& current_code = Code::Handle(isolate, CurrentCode());
5102 5103
5103 if (FLAG_trace_disabling_optimized_code) { 5104 if (FLAG_trace_disabling_optimized_code) {
5104 OS::Print("Disabling optimized code: '%s' entry: %#" Px "\n", 5105 OS::Print("Disabling optimized code: '%s' entry: %#" Px "\n",
5105 ToFullyQualifiedCString(), 5106 ToFullyQualifiedCString(),
5106 current_code.EntryPoint()); 5107 current_code.EntryPoint());
5107 } 5108 }
5108 // Patch entry of the optimized code. 5109 // Patch entry of the optimized code.
5109 CodePatcher::PatchEntry(current_code); 5110 CodePatcher::PatchEntry(current_code);
5110 // Use previously compiled unoptimized code. 5111 // Use previously compiled unoptimized code.
5111 AttachCode(Code::Handle(unoptimized_code())); 5112 AttachCode(Code::Handle(isolate, unoptimized_code()));
5112 CodePatcher::RestoreEntry(Code::Handle(unoptimized_code())); 5113 CodePatcher::RestoreEntry(Code::Handle(isolate, unoptimized_code()));
5114 isolate->TrackDeoptimizedCode(current_code);
5113 } 5115 }
5114 5116
5115 5117
5116 void Function::set_unoptimized_code(const Code& value) const { 5118 void Function::set_unoptimized_code(const Code& value) const {
5117 ASSERT(!value.is_optimized()); 5119 ASSERT(!value.is_optimized());
5118 StorePointer(&raw_ptr()->unoptimized_code_, value.raw()); 5120 StorePointer(&raw_ptr()->unoptimized_code_, value.raw());
5119 } 5121 }
5120 5122
5121 5123
5122 RawContextScope* Function::context_scope() const { 5124 RawContextScope* Function::context_scope() const {
(...skipping 7425 matching lines...) Expand 10 before | Expand all | Expand 10 after
12548 // Only disassemble alive code objects. 12550 // Only disassemble alive code objects.
12549 DisassembleToJSONStream formatter(jsarr); 12551 DisassembleToJSONStream formatter(jsarr);
12550 Disassemble(&formatter); 12552 Disassemble(&formatter);
12551 } 12553 }
12552 } 12554 }
12553 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); 12555 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
12554 if (!descriptors.IsNull()) { 12556 if (!descriptors.IsNull()) {
12555 JSONObject desc(&jsobj, "descriptors"); 12557 JSONObject desc(&jsobj, "descriptors");
12556 descriptors.PrintToJSONObject(&desc, false); 12558 descriptors.PrintToJSONObject(&desc, false);
12557 } 12559 }
12560 const Array& inlined_function_table = Array::Handle(inlined_id_to_function());
12561 if (!inlined_function_table.IsNull()) {
12562 JSONArray inlined_functions(&jsobj, "inlinedFunctions");
12563 Function& function = Function::Handle();
12564 for (intptr_t i = 0; i < inlined_function_table.Length(); i++) {
12565 function ^= inlined_function_table.At(i);
12566 ASSERT(!function.IsNull());
12567 inlined_functions.AddValue(function);
12568 }
12569 }
12570 const Array& intervals = Array::Handle(inlined_intervals());
12571 if (!intervals.IsNull()) {
12572 Smi& start = Smi::Handle();
12573 Smi& end = Smi::Handle();
12574 Smi& temp_smi = Smi::Handle();
12575 JSONArray inline_intervals(&jsobj, "inlinedIntervals");
12576 for (intptr_t i = 0; i < intervals.Length() - Code::kInlIntNumEntries;
12577 i += Code::kInlIntNumEntries) {
12578 start ^= intervals.At(i + Code::kInlIntStart);
12579 if (start.IsNull()) {
12580 continue;
12581 }
12582 end ^= intervals.At(i + Code::kInlIntNumEntries + Code::kInlIntStart);
12583
12584 // Format: [start, end, inline functions...]
12585 JSONArray inline_interval(&inline_intervals);
12586 inline_interval.AddValue(start.Value());
12587 inline_interval.AddValue(end.Value());
12588
12589 temp_smi ^= intervals.At(i + Code::kInlIntInliningId);
12590 intptr_t inlining_id = temp_smi.Value();
12591 ASSERT(inlining_id >= 0);
12592 temp_smi ^= intervals.At(i + Code::kInlIntCallerId);
12593 intptr_t caller_id = temp_smi.Value();
12594 while (inlining_id >= 0) {
12595 inline_interval.AddValue(inlining_id);
12596 inlining_id = caller_id;
12597 caller_id = GetCallerId(inlining_id);
12598 }
12599 }
12600 }
12558 } 12601 }
12559 12602
12560 12603
12561 uword Code::GetEntryPatchPc() const { 12604 uword Code::GetEntryPatchPc() const {
12562 return (entry_patch_pc_offset() != kInvalidPc) 12605 return (entry_patch_pc_offset() != kInvalidPc)
12563 ? EntryPoint() + entry_patch_pc_offset() : 0; 12606 ? EntryPoint() + entry_patch_pc_offset() : 0;
12564 } 12607 }
12565 12608
12566 12609
12567 uword Code::GetPatchCodePc() const { 12610 uword Code::GetPatchCodePc() const {
(...skipping 8061 matching lines...) Expand 10 before | Expand all | Expand 10 after
20629 return tag_label.ToCString(); 20672 return tag_label.ToCString();
20630 } 20673 }
20631 20674
20632 20675
20633 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20676 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20634 Instance::PrintJSONImpl(stream, ref); 20677 Instance::PrintJSONImpl(stream, ref);
20635 } 20678 }
20636 20679
20637 20680
20638 } // namespace dart 20681 } // namespace dart
OLDNEW
« 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