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

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

Issue 1000933004: Display ICData entries at call sites, with links to the targets and guarded classes. (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/service.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 6829 matching lines...) Expand 10 before | Expand all | Expand 10 after
6840 6840
6841 const Script& script = Script::Handle(this->script()); 6841 const Script& script = Script::Handle(this->script());
6842 if (!script.IsNull()) { 6842 if (!script.IsNull()) {
6843 jsobj.AddProperty("script", script); 6843 jsobj.AddProperty("script", script);
6844 jsobj.AddProperty("tokenPos", token_pos()); 6844 jsobj.AddProperty("tokenPos", token_pos());
6845 jsobj.AddProperty("endTokenPos", end_token_pos()); 6845 jsobj.AddProperty("endTokenPos", end_token_pos());
6846 } 6846 }
6847 } 6847 }
6848 6848
6849 6849
6850 RawGrowableObjectArray* Function::CollectICsWithSourcePositions() const {
6851 ZoneGrowableArray<const ICData*>* ic_data_array =
6852 new ZoneGrowableArray<const ICData*>();
6853 RestoreICDataMap(ic_data_array);
6854 const Code& code = Code::Handle(unoptimized_code());
6855 const PcDescriptors& descriptors = PcDescriptors::Handle(
6856 code.pc_descriptors());
6857
6858 const intptr_t begin_pos = token_pos();
6859 const intptr_t end_pos = end_token_pos();
6860
6861 const GrowableObjectArray& result =
6862 GrowableObjectArray::Handle(GrowableObjectArray::New());
6863
6864 PcDescriptors::Iterator iter(descriptors,
6865 RawPcDescriptors::kIcCall | RawPcDescriptors::kUnoptStaticCall);
6866 while (iter.MoveNext()) {
6867 const ICData* ic_data = (*ic_data_array)[iter.DeoptId()];
6868 if (!ic_data->IsNull()) {
6869 const intptr_t token_pos = iter.TokenPos();
6870 // Filter out descriptors that do not map to tokens in the source code.
6871 if ((token_pos < begin_pos) || (token_pos > end_pos)) {
6872 continue;
6873 }
6874
6875 result.Add(*ic_data);
6876 result.Add(Smi::Handle(Smi::New(token_pos)));
6877 }
6878 }
6879
6880 return result.raw();
6881 }
6882
6883
6884 void ClosureData::set_context_scope(const ContextScope& value) const { 6850 void ClosureData::set_context_scope(const ContextScope& value) const {
6885 StorePointer(&raw_ptr()->context_scope_, value.raw()); 6851 StorePointer(&raw_ptr()->context_scope_, value.raw());
6886 } 6852 }
6887 6853
6888 6854
6889 void ClosureData::set_implicit_static_closure(const Instance& closure) const { 6855 void ClosureData::set_implicit_static_closure(const Instance& closure) const {
6890 ASSERT(!closure.IsNull()); 6856 ASSERT(!closure.IsNull());
6891 ASSERT(raw_ptr()->closure_ == Instance::null()); 6857 ASSERT(raw_ptr()->closure_ == Instance::null());
6892 StorePointer(&raw_ptr()->closure_, closure.raw()); 6858 StorePointer(&raw_ptr()->closure_, closure.raw());
6893 } 6859 }
(...skipping 4996 matching lines...) Expand 10 before | Expand all | Expand 10 after
11890 result.WriteSentinel(ic_data); 11856 result.WriteSentinel(ic_data);
11891 return result.raw(); 11857 return result.raw();
11892 } 11858 }
11893 11859
11894 11860
11895 void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const { 11861 void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const {
11896 Object::PrintJSONImpl(stream, ref); 11862 Object::PrintJSONImpl(stream, ref);
11897 } 11863 }
11898 11864
11899 11865
11900 void ICData::PrintToJSONArray(JSONArray* jsarray, 11866 void ICData::PrintToJSONArray(const JSONArray& jsarray,
11901 intptr_t token_pos) const { 11867 intptr_t token_pos,
11868 bool is_static_call) const {
11902 Isolate* isolate = Isolate::Current(); 11869 Isolate* isolate = Isolate::Current();
11903 Class& cls = Class::Handle(); 11870 Class& cls = Class::Handle();
11904 Function& func = Function::Handle(); 11871 Function& func = Function::Handle();
11905 11872
11906 JSONObject jsobj(jsarray); 11873 JSONObject jsobj(&jsarray);
11907 jsobj.AddProperty("name", String::Handle(target_name()).ToCString()); 11874 jsobj.AddProperty("name", String::Handle(target_name()).ToCString());
11908 jsobj.AddProperty("tokenPos", token_pos); 11875 jsobj.AddProperty("tokenPos", token_pos);
11909 // TODO(rmacnak): Figure out how to stringify DeoptReasons(). 11876 // TODO(rmacnak): Figure out how to stringify DeoptReasons().
11910 // jsobj.AddProperty("deoptReasons", ...); 11877 // jsobj.AddProperty("deoptReasons", ...);
11911 11878
11912 JSONArray cache_entries(&jsobj, "cacheEntries"); 11879 JSONArray cache_entries(&jsobj, "cacheEntries");
11913 for (intptr_t i = 0; i < NumberOfChecks(); i++) { 11880 for (intptr_t i = 0; i < NumberOfChecks(); i++) {
11914 func = GetTargetAt(i); 11881 func = GetTargetAt(i);
11915 if (func.is_static() || (func.kind() == RawFunction::kConstructor)) { 11882 if (is_static_call) {
11916 cls ^= func.Owner(); 11883 cls ^= func.Owner();
11917 } else { 11884 } else {
11918 intptr_t cid = GetReceiverClassIdAt(i); 11885 intptr_t cid = GetReceiverClassIdAt(i);
11919 cls ^= isolate->class_table()->At(cid); 11886 cls ^= isolate->class_table()->At(cid);
11920 } 11887 }
11921 intptr_t count = GetCountAt(i); 11888 intptr_t count = GetCountAt(i);
11922 JSONObject cache_entry(&cache_entries); 11889 JSONObject cache_entry(&cache_entries);
11923 if (cls.IsTopLevel()) { 11890 if (cls.IsTopLevel()) {
11924 cache_entry.AddProperty("receiverContainer", 11891 cache_entry.AddProperty("receiverContainer",
11925 Library::Handle(cls.library())); 11892 Library::Handle(cls.library()));
11926 } else { 11893 } else {
11927 cache_entry.AddProperty("receiverContainer", cls); 11894 cache_entry.AddProperty("receiverContainer", cls);
11928 } 11895 }
11929 cache_entry.AddProperty("count", count); 11896 cache_entry.AddProperty("count", count);
11897 cache_entry.AddProperty("target", func);
11930 } 11898 }
11931 } 11899 }
11932 11900
11933 11901
11934 static Token::Kind RecognizeArithmeticOp(const String& name) { 11902 static Token::Kind RecognizeArithmeticOp(const String& name) {
11935 ASSERT(name.IsSymbol()); 11903 ASSERT(name.IsSymbol());
11936 if (name.raw() == Symbols::Plus().raw()) { 11904 if (name.raw() == Symbols::Plus().raw()) {
11937 return Token::kADD; 11905 return Token::kADD;
11938 } else if (name.raw() == Symbols::Minus().raw()) { 11906 } else if (name.raw() == Symbols::Minus().raw()) {
11939 return Token::kSUB; 11907 return Token::kSUB;
(...skipping 8812 matching lines...) Expand 10 before | Expand all | Expand 10 after
20752 return tag_label.ToCString(); 20720 return tag_label.ToCString();
20753 } 20721 }
20754 20722
20755 20723
20756 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20724 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20757 Instance::PrintJSONImpl(stream, ref); 20725 Instance::PrintJSONImpl(stream, ref);
20758 } 20726 }
20759 20727
20760 20728
20761 } // namespace dart 20729 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698