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

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

Issue 2600313002: Revert "Fix resolution and canonicalization of typedefs and function types..." (Closed)
Patch Set: Created 3 years, 12 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.cc ('k') | runtime/vm/parser.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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/debugger.h" 5 #include "vm/debugger.h"
6 #include "vm/disassembler.h" 6 #include "vm/disassembler.h"
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/object_store.h" 8 #include "vm/object_store.h"
9 #include "vm/stub_code.h" 9 #include "vm/stub_code.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 237
238 void PatchClass::PrintJSONImpl(JSONStream* stream, bool ref) const { 238 void PatchClass::PrintJSONImpl(JSONStream* stream, bool ref) const {
239 Object::PrintJSONImpl(stream, ref); 239 Object::PrintJSONImpl(stream, ref);
240 } 240 }
241 241
242 242
243 static void AddFunctionServiceId(const JSONObject& jsobj, 243 static void AddFunctionServiceId(const JSONObject& jsobj,
244 const Function& f, 244 const Function& f,
245 const Class& cls) { 245 const Class& cls) {
246 if (cls.IsNull()) {
247 ASSERT(f.IsSignatureFunction());
248 jsobj.AddServiceId(f);
249 return;
250 }
251 // Special kinds of functions use indices in their respective lists. 246 // Special kinds of functions use indices in their respective lists.
252 intptr_t id = -1; 247 intptr_t id = -1;
253 const char* selector = NULL; 248 const char* selector = NULL;
254 if (f.IsNonImplicitClosureFunction()) { 249 if (f.IsNonImplicitClosureFunction()) {
255 id = Isolate::Current()->FindClosureIndex(f); 250 id = Isolate::Current()->FindClosureIndex(f);
256 selector = "closures"; 251 selector = "closures";
257 } else if (f.IsImplicitClosureFunction()) { 252 } else if (f.IsImplicitClosureFunction()) {
258 id = cls.FindImplicitClosureFunctionIndex(f); 253 id = cls.FindImplicitClosureFunctionIndex(f);
259 selector = "implicit_closures"; 254 selector = "implicit_closures";
260 } else if (f.IsNoSuchMethodDispatcher() || f.IsInvokeFieldDispatcher()) { 255 } else if (f.IsNoSuchMethodDispatcher() || f.IsInvokeFieldDispatcher()) {
(...skipping 16 matching lines...) Expand all
277 } 272 }
278 // Oddball functions (not known to their owner) fall back to use the object 273 // Oddball functions (not known to their owner) fall back to use the object
279 // id ring. Current known examples are signature functions of closures 274 // id ring. Current known examples are signature functions of closures
280 // and stubs like 'megamorphic_miss'. 275 // and stubs like 'megamorphic_miss'.
281 jsobj.AddServiceId(f); 276 jsobj.AddServiceId(f);
282 } 277 }
283 278
284 279
285 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const { 280 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const {
286 Class& cls = Class::Handle(Owner()); 281 Class& cls = Class::Handle(Owner());
287 if (!cls.IsNull()) { 282 ASSERT(!cls.IsNull());
288 Error& err = Error::Handle(); 283 Error& err = Error::Handle();
289 err ^= cls.EnsureIsFinalized(Thread::Current()); 284 err ^= cls.EnsureIsFinalized(Thread::Current());
290 ASSERT(err.IsNull()); 285 ASSERT(err.IsNull());
291 } else {
292 ASSERT(IsSignatureFunction());
293 }
294 JSONObject jsobj(stream); 286 JSONObject jsobj(stream);
295 AddCommonObjectProperties(&jsobj, "Function", ref); 287 AddCommonObjectProperties(&jsobj, "Function", ref);
296 AddFunctionServiceId(jsobj, *this, cls); 288 AddFunctionServiceId(jsobj, *this, cls);
297 const String& user_name = String::Handle(UserVisibleName()); 289 const String& user_name = String::Handle(UserVisibleName());
298 const String& vm_name = String::Handle(name()); 290 const String& vm_name = String::Handle(name());
299 AddNameProperties(&jsobj, user_name.ToCString(), vm_name.ToCString()); 291 AddNameProperties(&jsobj, user_name.ToCString(), vm_name.ToCString());
300 const Function& parent = Function::Handle(parent_function()); 292 const Function& parent = Function::Handle(parent_function());
301 if (!parent.IsNull()) { 293 if (!parent.IsNull()) {
302 jsobj.AddProperty("owner", parent); 294 jsobj.AddProperty("owner", parent);
303 } else if (!cls.IsNull()) { 295 } else if (cls.IsTopLevel()) {
304 if (cls.IsTopLevel()) { 296 const Library& library = Library::Handle(cls.library());
305 const Library& library = Library::Handle(cls.library()); 297 jsobj.AddProperty("owner", library);
306 jsobj.AddProperty("owner", library); 298 } else {
307 } else { 299 jsobj.AddProperty("owner", cls);
308 jsobj.AddProperty("owner", cls);
309 }
310 } 300 }
311 301
312 const char* kind_string = Function::KindToCString(kind()); 302 const char* kind_string = Function::KindToCString(kind());
313 jsobj.AddProperty("_kind", kind_string); 303 jsobj.AddProperty("_kind", kind_string);
314 jsobj.AddProperty("static", is_static()); 304 jsobj.AddProperty("static", is_static());
315 jsobj.AddProperty("const", is_const()); 305 jsobj.AddProperty("const", is_const());
316 jsobj.AddProperty("_intrinsic", is_intrinsic()); 306 jsobj.AddProperty("_intrinsic", is_intrinsic());
317 jsobj.AddProperty("_native", is_native()); 307 jsobj.AddProperty("_native", is_native());
318 if (ref) { 308 if (ref) {
319 return; 309 return;
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 } 1092 }
1103 } 1093 }
1104 1094
1105 1095
1106 void AbstractType::PrintJSONImpl(JSONStream* stream, bool ref) const { 1096 void AbstractType::PrintJSONImpl(JSONStream* stream, bool ref) const {
1107 UNREACHABLE(); 1097 UNREACHABLE();
1108 } 1098 }
1109 1099
1110 1100
1111 void Type::PrintJSONImpl(JSONStream* stream, bool ref) const { 1101 void Type::PrintJSONImpl(JSONStream* stream, bool ref) const {
1112 // TODO(regis): Function types are not handled properly.
1113 JSONObject jsobj(stream); 1102 JSONObject jsobj(stream);
1114 PrintSharedInstanceJSON(&jsobj, ref); 1103 PrintSharedInstanceJSON(&jsobj, ref);
1115 jsobj.AddProperty("kind", "Type"); 1104 jsobj.AddProperty("kind", "Type");
1116 if (HasResolvedTypeClass()) { 1105 if (HasResolvedTypeClass()) {
1117 const Class& type_cls = Class::Handle(type_class()); 1106 const Class& type_cls = Class::Handle(type_class());
1118 if (type_cls.CanonicalType() == raw()) { 1107 if (type_cls.CanonicalType() == raw()) {
1119 intptr_t cid = type_cls.id(); 1108 intptr_t cid = type_cls.id();
1120 jsobj.AddFixedServiceId("classes/%" Pd "/types/%d", cid, 0); 1109 jsobj.AddFixedServiceId("classes/%" Pd "/types/%d", cid, 0);
1121 } else { 1110 } else {
1122 jsobj.AddServiceId(*this); 1111 jsobj.AddServiceId(*this);
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 jsobj.AddProperty("mirrorReferent", referent_handle); 1579 jsobj.AddProperty("mirrorReferent", referent_handle);
1591 } 1580 }
1592 1581
1593 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 1582 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
1594 Instance::PrintJSONImpl(stream, ref); 1583 Instance::PrintJSONImpl(stream, ref);
1595 } 1584 }
1596 1585
1597 #endif 1586 #endif
1598 1587
1599 } // namespace dart 1588 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698