Chromium Code Reviews| Index: runtime/vm/object.cc |
| =================================================================== |
| --- runtime/vm/object.cc (revision 34253) |
| +++ runtime/vm/object.cc (working copy) |
| @@ -4037,7 +4037,7 @@ |
| NameVisibility name_visibility) const { |
| ASSERT(from_index + len <= Length()); |
| String& name = String::Handle(); |
| - const intptr_t num_strings = 2*len + 1; // "<""T"", ""T"">". |
| + const intptr_t num_strings = (len == 0) ? 2 : 2*len + 1; // "<""T"", ""T"">". |
| const Array& strings = Array::Handle(Array::New(num_strings)); |
| intptr_t s = 0; |
| strings.SetAt(s++, Symbols::LAngleBracket()); |
| @@ -6326,7 +6326,12 @@ |
| id = cls.FindFunctionIndex(*this); |
| selector = "functions"; |
| } |
|
turnidge
2014/03/23 22:24:20
Did you consider grabbing an id from the object id
koda
2014/03/24 17:18:34
I wasn't sure whether all fields still work in all
|
| - ASSERT(id >= 0); |
| + // TODO(17697): Oddball functions are treated as plain objects and use the |
| + // object id ring. Current known examples are signature functions of closures |
| + // and stubs like 'megamorphic_miss'. |
| + if (id < 0) { |
| + return Object::PrintToJSONStream(stream, ref); |
| + } |
| intptr_t cid = cls.id(); |
| JSONObject jsobj(stream); |
| jsobj.AddProperty("type", JSONType(ref)); |
| @@ -13481,6 +13486,10 @@ |
| void Type::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| + // TODO(koda): Decide whether to assign stable ids to non-canonical types. |
| + if (!IsCanonical()) { |
| + return Object::PrintToJSONStream(stream, ref); |
| + } |
|
turnidge
2014/03/23 22:24:20
Ditto previous comment. You could print an id fro
koda
2014/03/24 17:18:34
Also, here: not sure whether all printed propertie
|
| ASSERT(IsCanonical()); |
| JSONObject jsobj(stream); |
| jsobj.AddProperty("type", JSONType(ref)); |
| @@ -16756,9 +16765,8 @@ |
| JSONObject jselement(&jsarr); |
| jselement.AddProperty("index", index); |
| - Instance& instance = Instance::Handle(); |
| - instance ^= At(index); |
| - jselement.AddProperty("value", instance); |
| + Object& element = Object::Handle(At(index)); |
| + jselement.AddProperty("value", element); |
| } |
| } |
| } |
| @@ -17096,9 +17104,8 @@ |
| JSONObject jselement(&jsarr); |
| jselement.AddProperty("index", index); |
| - Instance& instance = Instance::Handle(); |
| - instance ^= At(index); |
| - jselement.AddProperty("value", instance); |
| + Object& element = Object::Handle(At(index)); |
| + jselement.AddProperty("value", element); |
| } |
| } |
| } |