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

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

Issue 514833003: Add a new Sentinel type for sentinel responses. (They are not Null). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js, fix tests Created 6 years, 3 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
OLDNEW
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 13579 matching lines...) Expand 10 before | Expand all | Expand 10 after
13590 const intptr_t id = ring->GetIdForObject(raw()); 13590 const intptr_t id = ring->GetIdForObject(raw());
13591 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 13591 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
13592 } 13592 }
13593 13593
13594 13594
13595 void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const { 13595 void Instance::PrintJSONImpl(JSONStream* stream, bool ref) const {
13596 JSONObject jsobj(stream); 13596 JSONObject jsobj(stream);
13597 13597
13598 // Handle certain special instance values. 13598 // Handle certain special instance values.
13599 if (raw() == Object::sentinel().raw()) { 13599 if (raw() == Object::sentinel().raw()) {
13600 jsobj.AddProperty("type", ref ? "@Null" : "Null"); 13600 jsobj.AddProperty("type", "Sentinel");
13601 jsobj.AddProperty("id", "objects/not-initialized"); 13601 jsobj.AddProperty("id", "objects/not-initialized");
13602 jsobj.AddProperty("valueAsString", "<not initialized>"); 13602 jsobj.AddProperty("valueAsString", "<not initialized>");
13603 return; 13603 return;
13604 } else if (raw() == Object::transition_sentinel().raw()) { 13604 } else if (raw() == Object::transition_sentinel().raw()) {
13605 jsobj.AddProperty("type", ref ? "@Null" : "Null"); 13605 jsobj.AddProperty("type", "Sentinel");
13606 jsobj.AddProperty("id", "objects/being-initialized"); 13606 jsobj.AddProperty("id", "objects/being-initialized");
13607 jsobj.AddProperty("valueAsString", "<being initialized>"); 13607 jsobj.AddProperty("valueAsString", "<being initialized>");
13608 return; 13608 return;
13609 } 13609 }
13610 13610
13611 PrintSharedInstanceJSON(&jsobj, ref); 13611 PrintSharedInstanceJSON(&jsobj, ref);
13612 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 13612 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
13613 const intptr_t id = ring->GetIdForObject(raw()); 13613 const intptr_t id = ring->GetIdForObject(raw());
13614 if (IsClosure()) { 13614 if (IsClosure()) {
13615 const Function& closureFunc = Function::Handle(Closure::function(*this)); 13615 const Function& closureFunc = Function::Handle(Closure::function(*this));
(...skipping 3525 matching lines...) Expand 10 before | Expand all | Expand 10 after
17141 return buffer; 17141 return buffer;
17142 } 17142 }
17143 17143
17144 17144
17145 void String::PrintJSONImpl(JSONStream* stream, bool ref) const { 17145 void String::PrintJSONImpl(JSONStream* stream, bool ref) const {
17146 JSONObject jsobj(stream); 17146 JSONObject jsobj(stream);
17147 if (raw() == Symbols::OptimizedOut().raw()) { 17147 if (raw() == Symbols::OptimizedOut().raw()) {
17148 // TODO(turnidge): This is a hack. The user could have this 17148 // TODO(turnidge): This is a hack. The user could have this
17149 // special string in their program. Fixing this involves updating 17149 // special string in their program. Fixing this involves updating
17150 // the debugging api a bit. 17150 // the debugging api a bit.
17151 jsobj.AddProperty("type", ref ? "@Null" : "Null"); 17151 jsobj.AddProperty("type", "Sentinel");
17152 jsobj.AddProperty("id", "objects/optimized-out"); 17152 jsobj.AddProperty("id", "objects/optimized-out");
17153 jsobj.AddProperty("valueAsString", "<optimized out>"); 17153 jsobj.AddProperty("valueAsString", "<optimized out>");
17154 return; 17154 return;
17155 } 17155 }
17156 PrintSharedInstanceJSON(&jsobj, ref); 17156 PrintSharedInstanceJSON(&jsobj, ref);
17157 ObjectIdRing* ring = Isolate::Current()->object_id_ring(); 17157 ObjectIdRing* ring = Isolate::Current()->object_id_ring();
17158 const intptr_t id = ring->GetIdForObject(raw()); 17158 const intptr_t id = ring->GetIdForObject(raw());
17159 jsobj.AddPropertyF("id", "objects/%" Pd "", id); 17159 jsobj.AddPropertyF("id", "objects/%" Pd "", id);
17160 jsobj.AddProperty("valueAsString", ToUserCString(1024)); 17160 jsobj.AddProperty("valueAsString", ToUserCString(1024));
17161 } 17161 }
(...skipping 2418 matching lines...) Expand 10 before | Expand all | Expand 10 after
19580 return tag_label.ToCString(); 19580 return tag_label.ToCString();
19581 } 19581 }
19582 19582
19583 19583
19584 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 19584 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
19585 Instance::PrintJSONImpl(stream, ref); 19585 Instance::PrintJSONImpl(stream, ref);
19586 } 19586 }
19587 19587
19588 19588
19589 } // namespace dart 19589 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/observatory/lib/src/elements/observatory_element.dart ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698