| OLD | NEW |
| 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 12425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12436 const Context& parent_ctx = Context::Handle(parent()); | 12436 const Context& parent_ctx = Context::Handle(parent()); |
| 12437 if (!parent_ctx.IsNull()) { | 12437 if (!parent_ctx.IsNull()) { |
| 12438 parent_ctx.Dump(indent + 2); | 12438 parent_ctx.Dump(indent + 2); |
| 12439 } | 12439 } |
| 12440 IndentN(indent); | 12440 IndentN(indent); |
| 12441 OS::PrintErr("}\n"); | 12441 OS::PrintErr("}\n"); |
| 12442 } | 12442 } |
| 12443 | 12443 |
| 12444 | 12444 |
| 12445 void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { | 12445 void Context::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 12446 Object::PrintJSONImpl(stream, ref); | 12446 JSONObject jsobj(stream); |
| 12447 jsobj.AddProperty("type", JSONType(ref)); |
| 12448 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 12449 const intptr_t id = ring->GetIdForObject(raw()); |
| 12450 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 12451 |
| 12452 jsobj.AddProperty("length", num_variables()); |
| 12453 |
| 12454 if (ref) { |
| 12455 return; |
| 12456 } |
| 12457 |
| 12458 Class& cls = Class::Handle(this->clazz()); |
| 12459 jsobj.AddProperty("class", cls); |
| 12460 |
| 12461 jsobj.AddProperty("size", raw()->Size()); |
| 12462 |
| 12463 const Context& parent_context = Context::Handle(parent()); |
| 12464 jsobj.AddProperty("parent", parent_context); |
| 12465 |
| 12466 JSONArray jsarr(&jsobj, "variables"); |
| 12467 for (intptr_t i = 0; i < num_variables(); i++) { |
| 12468 const Instance& var = Instance::Handle(At(i)); |
| 12469 JSONObject jselement(&jsarr); |
| 12470 jselement.AddProperty("index", i); |
| 12471 jselement.AddProperty("value", var); |
| 12472 } |
| 12447 } | 12473 } |
| 12448 | 12474 |
| 12449 | 12475 |
| 12450 RawContextScope* ContextScope::New(intptr_t num_variables) { | 12476 RawContextScope* ContextScope::New(intptr_t num_variables) { |
| 12451 ASSERT(Object::context_scope_class() != Class::null()); | 12477 ASSERT(Object::context_scope_class() != Class::null()); |
| 12452 if (num_variables < 0 || num_variables > kMaxElements) { | 12478 if (num_variables < 0 || num_variables > kMaxElements) { |
| 12453 // This should be caught before we reach here. | 12479 // This should be caught before we reach here. |
| 12454 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", | 12480 FATAL1("Fatal error in ContextScope::New: invalid num_variables %" Pd "\n", |
| 12455 num_variables); | 12481 num_variables); |
| 12456 } | 12482 } |
| (...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13614 jsobj.AddProperty("valueAsString", "<being initialized>"); | 13640 jsobj.AddProperty("valueAsString", "<being initialized>"); |
| 13615 return; | 13641 return; |
| 13616 } | 13642 } |
| 13617 | 13643 |
| 13618 PrintSharedInstanceJSON(&jsobj, ref); | 13644 PrintSharedInstanceJSON(&jsobj, ref); |
| 13619 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); | 13645 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); |
| 13620 const intptr_t id = ring->GetIdForObject(raw()); | 13646 const intptr_t id = ring->GetIdForObject(raw()); |
| 13621 if (IsClosure()) { | 13647 if (IsClosure()) { |
| 13622 const Function& closureFunc = Function::Handle(Closure::function(*this)); | 13648 const Function& closureFunc = Function::Handle(Closure::function(*this)); |
| 13623 jsobj.AddProperty("closureFunc", closureFunc); | 13649 jsobj.AddProperty("closureFunc", closureFunc); |
| 13650 const Context& closureCtxt = Context::Handle(Closure::context(*this)); |
| 13651 jsobj.AddProperty("closureCtxt", closureCtxt); |
| 13624 } | 13652 } |
| 13625 jsobj.AddPropertyF("id", "objects/%" Pd "", id); | 13653 jsobj.AddPropertyF("id", "objects/%" Pd "", id); |
| 13626 if (ref) { | 13654 if (ref) { |
| 13627 return; | 13655 return; |
| 13628 } | 13656 } |
| 13629 } | 13657 } |
| 13630 | 13658 |
| 13631 | 13659 |
| 13632 bool AbstractType::IsResolved() const { | 13660 bool AbstractType::IsResolved() const { |
| 13633 // AbstractType is an abstract class. | 13661 // AbstractType is an abstract class. |
| (...skipping 6010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19644 return tag_label.ToCString(); | 19672 return tag_label.ToCString(); |
| 19645 } | 19673 } |
| 19646 | 19674 |
| 19647 | 19675 |
| 19648 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 19676 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 19649 Instance::PrintJSONImpl(stream, ref); | 19677 Instance::PrintJSONImpl(stream, ref); |
| 19650 } | 19678 } |
| 19651 | 19679 |
| 19652 | 19680 |
| 19653 } // namespace dart | 19681 } // namespace dart |
| OLD | NEW |