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

Unified Diff: runtime/vm/object.h

Issue 16336021: Create specific null read only handles for the frequently used types (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 23557)
+++ runtime/vm/object.h (working copy)
@@ -117,9 +117,6 @@
static Raw##object* null() { \
return reinterpret_cast<Raw##object*>(Object::null()); \
} \
- static const object& null_object() { \
- return reinterpret_cast<const object&>(Object::null_object()); \
- } \
virtual const char* ToCString() const; \
static const ClassId kClassId = k##object##Cid; \
private: /* NOLINT */ \
@@ -283,6 +280,12 @@
initializeHandle(obj, raw_ptr);
return *obj;
}
+ static Object* ReadOnlyHandle() {
+ Object* obj = reinterpret_cast<Object*>(
+ Dart::AllocateReadOnlyHandle());
+ initializeHandle(obj, Object::null());
+ return obj;
+ }
static Object& Handle() {
return Handle(Isolate::Current(), null_);
@@ -316,6 +319,22 @@
ASSERT(null_object_ != NULL);
return *null_object_;
}
+ static const Array& null_array() {
+ ASSERT(null_array_ != NULL);
+ return *null_array_;
+ }
+ static const String& null_string() {
+ ASSERT(null_string_ != NULL);
+ return *null_string_;
+ }
+ static const Instance& null_instance() {
+ ASSERT(null_instance_ != NULL);
+ return *null_instance_;
+ }
+ static const AbstractTypeArguments& null_abstract_type_arguments() {
+ ASSERT(null_abstract_type_arguments_ != NULL);
+ return *null_abstract_type_arguments_;
+ }
static const Array& empty_array() {
ASSERT(empty_array_ != NULL);
return *empty_array_;
@@ -550,6 +569,10 @@
// The static values below are read-only handle pointers for singleton
// objects that are shared between the different isolates.
static Object* null_object_;
+ static Array* null_array_;
+ static String* null_string_;
+ static Instance* null_instance_;
+ static AbstractTypeArguments* null_abstract_type_arguments_;
static Array* empty_array_;
static Instance* sentinel_;
static Instance* transition_sentinel_;
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698