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

Side by Side Diff: runtime/vm/service.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/parser.cc ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 return true; 1534 return true;
1535 } 1535 }
1536 if (obj.IsFunction()) { 1536 if (obj.IsFunction()) {
1537 const Function& func = Function::Cast(obj); 1537 const Function& func = Function::Cast(obj);
1538 const GrowableObjectArray& ics = 1538 const GrowableObjectArray& ics =
1539 GrowableObjectArray::Handle(func.CollectICsWithSourcePositions()); 1539 GrowableObjectArray::Handle(func.CollectICsWithSourcePositions());
1540 JSONObject jsobj(js); 1540 JSONObject jsobj(js);
1541 jsobj.AddProperty("type", "_CallSiteData"); 1541 jsobj.AddProperty("type", "_CallSiteData");
1542 jsobj.AddProperty("function", func); 1542 jsobj.AddProperty("function", func);
1543 JSONArray elements(&jsobj, "callSites"); 1543 JSONArray elements(&jsobj, "callSites");
1544 Smi& line = Smi::Handle();
1545 Smi& column = Smi::Handle();
1546 ICData& ic_data = ICData::Handle(); 1544 ICData& ic_data = ICData::Handle();
1545 Smi& token_pos = Smi::Handle();
1547 for (intptr_t i = 0; i < ics.Length();) { 1546 for (intptr_t i = 0; i < ics.Length();) {
1548 ic_data ^= ics.At(i++); 1547 ic_data ^= ics.At(i++);
1549 line ^= ics.At(i++); 1548 token_pos ^= ics.At(i++);
1550 column ^= ics.At(i++); 1549 ic_data.PrintToJSONArray(&elements, token_pos.Value());
1551 ic_data.PrintToJSONArray(&elements, line.Value(), column.Value());
1552 } 1550 }
1553 return true; 1551 return true;
1554 } 1552 }
1555 return false; 1553 return false;
1556 } 1554 }
1557 1555
1558 1556
1559 class GetInstancesVisitor : public ObjectGraph::Visitor { 1557 class GetInstancesVisitor : public ObjectGraph::Visitor {
1560 public: 1558 public:
1561 GetInstancesVisitor(const Class& cls, const Array& storage) 1559 GetInstancesVisitor(const Class& cls, const Array& storage)
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 ServiceMethodDescriptor& method = service_methods_[i]; 2568 ServiceMethodDescriptor& method = service_methods_[i];
2571 if (strcmp(method_name, method.name) == 0) { 2569 if (strcmp(method_name, method.name) == 0) {
2572 return &method; 2570 return &method;
2573 } 2571 }
2574 } 2572 }
2575 return NULL; 2573 return NULL;
2576 } 2574 }
2577 2575
2578 2576
2579 } // namespace dart 2577 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698