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