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

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

Issue 1533653003: Add SourceReport, a class for generating Dart source-level reports. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/source_report.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 12888 matching lines...) Expand 10 before | Expand all | Expand 10 after
12899 12899
12900 void ICData::PrintToJSONArray(const JSONArray& jsarray, 12900 void ICData::PrintToJSONArray(const JSONArray& jsarray,
12901 intptr_t token_pos, 12901 intptr_t token_pos,
12902 bool is_static_call) const { 12902 bool is_static_call) const {
12903 Isolate* isolate = Isolate::Current(); 12903 Isolate* isolate = Isolate::Current();
12904 Class& cls = Class::Handle(); 12904 Class& cls = Class::Handle();
12905 Function& func = Function::Handle(); 12905 Function& func = Function::Handle();
12906 12906
12907 JSONObject jsobj(&jsarray); 12907 JSONObject jsobj(&jsarray);
12908 jsobj.AddProperty("name", String::Handle(target_name()).ToCString()); 12908 jsobj.AddProperty("name", String::Handle(target_name()).ToCString());
12909 // TODO(turnidge): Use AddLocation instead.
12910 jsobj.AddProperty("tokenPos", token_pos); 12909 jsobj.AddProperty("tokenPos", token_pos);
12911 // TODO(rmacnak): Figure out how to stringify DeoptReasons(). 12910 // TODO(rmacnak): Figure out how to stringify DeoptReasons().
12912 // jsobj.AddProperty("deoptReasons", ...); 12911 // jsobj.AddProperty("deoptReasons", ...);
12913 12912
12914 JSONArray cache_entries(&jsobj, "cacheEntries"); 12913 JSONArray cache_entries(&jsobj, "cacheEntries");
12915 for (intptr_t i = 0; i < NumberOfChecks(); i++) { 12914 for (intptr_t i = 0; i < NumberOfChecks(); i++) {
12916 func = GetTargetAt(i); 12915 func = GetTargetAt(i);
12917 if (is_static_call) { 12916 if (is_static_call) {
12918 cls ^= func.Owner(); 12917 cls ^= func.Owner();
12919 } else { 12918 } else {
12920 intptr_t cid = GetReceiverClassIdAt(i); 12919 intptr_t cid = GetReceiverClassIdAt(i);
12921 cls ^= isolate->class_table()->At(cid); 12920 cls ^= isolate->class_table()->At(cid);
12922 } 12921 }
12923 intptr_t count = GetCountAt(i); 12922 intptr_t count = GetCountAt(i);
12924 JSONObject cache_entry(&cache_entries); 12923 JSONObject cache_entry(&cache_entries);
12925 if (cls.IsTopLevel()) { 12924 if (cls.IsTopLevel()) {
12926 cache_entry.AddProperty("receiverContainer", 12925 cache_entry.AddProperty("receiverContainer",
12927 Library::Handle(cls.library())); 12926 Library::Handle(cls.library()));
12928 } else { 12927 } else {
12929 cache_entry.AddProperty("receiverContainer", cls); 12928 cache_entry.AddProperty("receiverContainer", cls);
12930 } 12929 }
12931 cache_entry.AddProperty("count", count); 12930 cache_entry.AddProperty("count", count);
12932 cache_entry.AddProperty("target", func); 12931 cache_entry.AddProperty("target", func);
12933 } 12932 }
12934 } 12933 }
12935 12934
12936 12935
12936 void ICData::PrintToJSONArrayNew(const JSONArray& jsarray,
12937 intptr_t token_pos,
12938 bool is_static_call) const {
12939 Isolate* isolate = Isolate::Current();
12940 Class& cls = Class::Handle();
12941 Function& func = Function::Handle();
12942
12943 JSONObject jsobj(&jsarray);
12944 jsobj.AddProperty("name", String::Handle(target_name()).ToCString());
12945 jsobj.AddProperty("tokenPos", token_pos);
12946 // TODO(rmacnak): Figure out how to stringify DeoptReasons().
12947 // jsobj.AddProperty("deoptReasons", ...);
12948
12949 JSONArray cache_entries(&jsobj, "cacheEntries");
12950 for (intptr_t i = 0; i < NumberOfChecks(); i++) {
12951 JSONObject cache_entry(&cache_entries);
12952 func = GetTargetAt(i);
12953 intptr_t count = GetCountAt(i);
12954 if (!is_static_call) {
12955 intptr_t cid = GetReceiverClassIdAt(i);
12956 cls ^= isolate->class_table()->At(cid);
12957 cache_entry.AddProperty("receiver", cls);
12958 }
12959 cache_entry.AddProperty("target", func);
12960 cache_entry.AddProperty("count", count);
12961 }
12962 }
12963
12964
12937 static Token::Kind RecognizeArithmeticOp(const String& name) { 12965 static Token::Kind RecognizeArithmeticOp(const String& name) {
12938 ASSERT(name.IsSymbol()); 12966 ASSERT(name.IsSymbol());
12939 if (name.raw() == Symbols::Plus().raw()) { 12967 if (name.raw() == Symbols::Plus().raw()) {
12940 return Token::kADD; 12968 return Token::kADD;
12941 } else if (name.raw() == Symbols::Minus().raw()) { 12969 } else if (name.raw() == Symbols::Minus().raw()) {
12942 return Token::kSUB; 12970 return Token::kSUB;
12943 } else if (name.raw() == Symbols::Star().raw()) { 12971 } else if (name.raw() == Symbols::Star().raw()) {
12944 return Token::kMUL; 12972 return Token::kMUL;
12945 } else if (name.raw() == Symbols::Slash().raw()) { 12973 } else if (name.raw() == Symbols::Slash().raw()) {
12946 return Token::kDIV; 12974 return Token::kDIV;
(...skipping 9049 matching lines...) Expand 10 before | Expand all | Expand 10 after
21996 return tag_label.ToCString(); 22024 return tag_label.ToCString();
21997 } 22025 }
21998 22026
21999 22027
22000 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 22028 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
22001 Instance::PrintJSONImpl(stream, ref); 22029 Instance::PrintJSONImpl(stream, ref);
22002 } 22030 }
22003 22031
22004 22032
22005 } // namespace dart 22033 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/source_report.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698