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

Unified Diff: vm/object.h

Issue 11648006: Create read only handles for empty_array and sentinel objects (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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
Index: vm/object.h
===================================================================
--- vm/object.h (revision 16331)
+++ vm/object.h (working copy)
@@ -248,15 +248,24 @@
}
static RawObject* null() { return null_; }
- static RawArray* empty_array() { return empty_array_; }
+ static const Array& empty_array() {
+ ASSERT(empty_array_ != NULL);
+ return *empty_array_;
+ }
// The sentinel is a value that cannot be produced by Dart code.
// It can be used to mark special values, for example to distinguish
// "uninitialized" fields.
- static RawInstance* sentinel() { return sentinel_; }
+ static const Instance& sentinel() {
+ ASSERT(sentinel_ != NULL);
+ return *sentinel_;
+ }
// Value marking that we are transitioning from sentinel, e.g., computing
// a field value. Used to detect circular initialization.
- static RawInstance* transition_sentinel() { return transition_sentinel_; }
+ static const Instance& transition_sentinel() {
+ ASSERT(transition_sentinel_ != NULL);
+ return *transition_sentinel_;
+ }
static RawClass* class_class() { return class_class_; }
static RawClass* null_class() { return null_class_; }
@@ -400,9 +409,6 @@
// The static values below are singletons shared between the different
// isolates. They are all allocated in the non-GC'd Dart::vm_isolate_.
static RawObject* null_;
- static RawArray* empty_array_;
- static RawInstance* sentinel_;
- static RawInstance* transition_sentinel_;
static RawClass* class_class_; // Class of the Class vm object.
static RawClass* null_class_; // Class of the null object.
@@ -440,6 +446,12 @@
static RawClass* unhandled_exception_class_; // Class of UnhandledException.
static RawClass* unwind_error_class_; // Class of UnwindError.
+ // The static values below are read only handle pointers for singleton
Ivan Posva 2012/12/20 23:43:52 read-only
siva 2012/12/21 02:28:06 Done.
+ // objects that are shared between the different isolates.
+ static Array* empty_array_;
+ static Instance* sentinel_;
+ static Instance* transition_sentinel_;
+
friend void ClassTable::Register(const Class& cls);
friend void RawObject::Validate(Isolate* isolate) const;
friend class Closure;
@@ -2552,7 +2564,7 @@
const String& CommentAt(intptr_t idx) const;
private:
- explicit Comments(RawArray* comments);
+ explicit Comments(const Array& comments);
// Layout of entries describing comments.
enum {

Powered by Google App Engine
This is Rietveld 408576698