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

Unified Diff: vm/object.h

Issue 11745022: - Make Boolean 'true' and 'false' singleton VM isolate objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/intrinsifier_x64.cc ('k') | vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/object.h
===================================================================
--- vm/object.h (revision 16591)
+++ vm/object.h (working copy)
@@ -269,6 +269,15 @@
return *transition_sentinel_;
}
+ static const Bool& bool_true() {
+ ASSERT(bool_true_ != NULL);
+ return *bool_true_;
+ }
+ static const Bool& bool_false() {
+ ASSERT(bool_false_ != NULL);
+ return *bool_false_;
+ }
+
static RawClass* class_class() { return class_class_; }
static RawClass* null_class() { return null_class_; }
static RawClass* dynamic_class() { return dynamic_class_; }
@@ -453,6 +462,8 @@
static Array* empty_array_;
static Instance* sentinel_;
static Instance* transition_sentinel_;
+ static Bool* bool_true_;
+ static Bool* bool_false_;
friend void ClassTable::Register(const Class& cls);
friend void RawObject::Validate(Isolate* isolate) const;
@@ -4394,11 +4405,16 @@
return RoundedAllocationSize(sizeof(RawBool));
}
- static RawBool* True();
- static RawBool* False();
+ static const Bool& True() {
+ return Object::bool_true();
+ }
+ static const Bool& False() {
+ return Object::bool_false();
+ }
+
static RawBool* Get(bool value) {
- return value ? Bool::True() : Bool::False();
+ return value ? Bool::True().raw() : Bool::False().raw();
}
private:
« no previous file with comments | « vm/intrinsifier_x64.cc ('k') | vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698