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

Side by Side Diff: runtime/vm/object.cc

Issue 977283002: Display call site data for functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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/object.h ('k') | runtime/vm/object_test.cc » ('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 6840 matching lines...) Expand 10 before | Expand all | Expand 10 after
6851 ZoneGrowableArray<const ICData*>* ic_data_array = 6851 ZoneGrowableArray<const ICData*>* ic_data_array =
6852 new ZoneGrowableArray<const ICData*>(); 6852 new ZoneGrowableArray<const ICData*>();
6853 RestoreICDataMap(ic_data_array); 6853 RestoreICDataMap(ic_data_array);
6854 const Code& code = Code::Handle(unoptimized_code()); 6854 const Code& code = Code::Handle(unoptimized_code());
6855 const PcDescriptors& descriptors = PcDescriptors::Handle( 6855 const PcDescriptors& descriptors = PcDescriptors::Handle(
6856 code.pc_descriptors()); 6856 code.pc_descriptors());
6857 6857
6858 const intptr_t begin_pos = token_pos(); 6858 const intptr_t begin_pos = token_pos();
6859 const intptr_t end_pos = end_token_pos(); 6859 const intptr_t end_pos = end_token_pos();
6860 6860
6861 const Script& script = Script::Handle(this->script());
6862 const GrowableObjectArray& result = 6861 const GrowableObjectArray& result =
6863 GrowableObjectArray::Handle(GrowableObjectArray::New()); 6862 GrowableObjectArray::Handle(GrowableObjectArray::New());
6864 6863
6865 PcDescriptors::Iterator iter(descriptors, 6864 PcDescriptors::Iterator iter(descriptors,
6866 RawPcDescriptors::kIcCall | RawPcDescriptors::kUnoptStaticCall); 6865 RawPcDescriptors::kIcCall | RawPcDescriptors::kUnoptStaticCall);
6867 while (iter.MoveNext()) { 6866 while (iter.MoveNext()) {
6868 const ICData* ic_data = (*ic_data_array)[iter.DeoptId()]; 6867 const ICData* ic_data = (*ic_data_array)[iter.DeoptId()];
6869 if (!ic_data->IsNull()) { 6868 if (!ic_data->IsNull()) {
6870 const intptr_t token_pos = iter.TokenPos(); 6869 const intptr_t token_pos = iter.TokenPos();
6871 // Filter out descriptors that do not map to tokens in the source code. 6870 // Filter out descriptors that do not map to tokens in the source code.
6872 if ((token_pos < begin_pos) || (token_pos > end_pos)) { 6871 if ((token_pos < begin_pos) || (token_pos > end_pos)) {
6873 continue; 6872 continue;
6874 } 6873 }
6875 6874
6876 intptr_t line = -1;
6877 intptr_t column = -1;
6878 script.GetTokenLocation(token_pos, &line, &column);
6879
6880 result.Add(*ic_data); 6875 result.Add(*ic_data);
6881 result.Add(Smi::Handle(Smi::New(line))); 6876 result.Add(Smi::Handle(Smi::New(token_pos)));
6882 result.Add(Smi::Handle(Smi::New(column)));
6883 } 6877 }
6884 } 6878 }
6885 6879
6886 return result.raw(); 6880 return result.raw();
6887 } 6881 }
6888 6882
6889 6883
6890 void ClosureData::set_context_scope(const ContextScope& value) const { 6884 void ClosureData::set_context_scope(const ContextScope& value) const {
6891 StorePointer(&raw_ptr()->context_scope_, value.raw()); 6885 StorePointer(&raw_ptr()->context_scope_, value.raw());
6892 } 6886 }
(...skipping 5003 matching lines...) Expand 10 before | Expand all | Expand 10 after
11896 return result.raw(); 11890 return result.raw();
11897 } 11891 }
11898 11892
11899 11893
11900 void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const { 11894 void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const {
11901 Object::PrintJSONImpl(stream, ref); 11895 Object::PrintJSONImpl(stream, ref);
11902 } 11896 }
11903 11897
11904 11898
11905 void ICData::PrintToJSONArray(JSONArray* jsarray, 11899 void ICData::PrintToJSONArray(JSONArray* jsarray,
11906 intptr_t line, 11900 intptr_t token_pos) const {
11907 intptr_t column) const {
11908 Isolate* isolate = Isolate::Current(); 11901 Isolate* isolate = Isolate::Current();
11909 Class& cls = Class::Handle(); 11902 Class& cls = Class::Handle();
11903 Function& func = Function::Handle();
11910 11904
11911 JSONObject jsobj(jsarray); 11905 JSONObject jsobj(jsarray);
11912 jsobj.AddProperty("name", String::Handle(target_name()).ToCString()); 11906 jsobj.AddProperty("name", String::Handle(target_name()).ToCString());
11913 jsobj.AddProperty("line", line); 11907 jsobj.AddProperty("tokenPos", token_pos);
11914 jsobj.AddProperty("column", column);
11915 // TODO(rmacnak): Figure out how to stringify DeoptReasons(). 11908 // TODO(rmacnak): Figure out how to stringify DeoptReasons().
11916 // jsobj.AddProperty("deoptReasons", ...); 11909 // jsobj.AddProperty("deoptReasons", ...);
11917 11910
11918 JSONArray cache_entries(&jsobj, "cacheEntries"); 11911 JSONArray cache_entries(&jsobj, "cacheEntries");
11919 for (intptr_t i = 0; i < NumberOfChecks(); i++) { 11912 for (intptr_t i = 0; i < NumberOfChecks(); i++) {
11920 intptr_t cid = GetReceiverClassIdAt(i); 11913 func = GetTargetAt(i);
11921 cls ^= isolate->class_table()->At(cid); 11914 if (func.is_static() || (func.kind() == RawFunction::kConstructor)) {
11915 cls ^= func.Owner();
11916 } else {
11917 intptr_t cid = GetReceiverClassIdAt(i);
11918 cls ^= isolate->class_table()->At(cid);
11919 }
11922 intptr_t count = GetCountAt(i); 11920 intptr_t count = GetCountAt(i);
11923 JSONObject cache_entry(&cache_entries); 11921 JSONObject cache_entry(&cache_entries);
11924 cache_entry.AddProperty("receiverClass", cls); 11922 if (cls.IsTopLevel()) {
11923 cache_entry.AddProperty("receiverContainer",
11924 Library::Handle(cls.library()));
11925 } else {
11926 cache_entry.AddProperty("receiverContainer", cls);
11927 }
11925 cache_entry.AddProperty("count", count); 11928 cache_entry.AddProperty("count", count);
11926 } 11929 }
11927 } 11930 }
11928 11931
11929 11932
11930 static Token::Kind RecognizeArithmeticOp(const String& name) { 11933 static Token::Kind RecognizeArithmeticOp(const String& name) {
11931 ASSERT(name.IsSymbol()); 11934 ASSERT(name.IsSymbol());
11932 if (name.raw() == Symbols::Plus().raw()) { 11935 if (name.raw() == Symbols::Plus().raw()) {
11933 return Token::kADD; 11936 return Token::kADD;
11934 } else if (name.raw() == Symbols::Minus().raw()) { 11937 } else if (name.raw() == Symbols::Minus().raw()) {
(...skipping 8813 matching lines...) Expand 10 before | Expand all | Expand 10 after
20748 return tag_label.ToCString(); 20751 return tag_label.ToCString();
20749 } 20752 }
20750 20753
20751 20754
20752 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20755 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20753 Instance::PrintJSONImpl(stream, ref); 20756 Instance::PrintJSONImpl(stream, ref);
20754 } 20757 }
20755 20758
20756 20759
20757 } // namespace dart 20760 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698