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

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

Issue 1012333002: Keep zone cached in SnapshotReader to allow removing ZoneHandle(Isolate*) interface. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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
« no previous file with comments | « runtime/vm/native_entry_test.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 static object& CheckedHandle(Zone* zone, RawObject* raw_ptr) { \ 86 static object& CheckedHandle(Zone* zone, RawObject* raw_ptr) { \
87 object* obj = \ 87 object* obj = \
88 reinterpret_cast<object*>(VMHandles::AllocateHandle(zone)); \ 88 reinterpret_cast<object*>(VMHandles::AllocateHandle(zone)); \
89 initializeHandle(obj, raw_ptr); \ 89 initializeHandle(obj, raw_ptr); \
90 if (!obj->Is##object()) { \ 90 if (!obj->Is##object()) { \
91 FATAL2("Handle check failed: saw %s expected %s", \ 91 FATAL2("Handle check failed: saw %s expected %s", \
92 obj->ToCString(), #object); \ 92 obj->ToCString(), #object); \
93 } \ 93 } \
94 return *obj; \ 94 return *obj; \
95 } \ 95 } \
96 /* DEPRECATED: Use Zone version. */ \
97 static object& CheckedHandle(Isolate* isolate, RawObject* raw_ptr) { \
98 return CheckedHandle(isolate->current_zone(), raw_ptr); \
99 } \
100 static object& CheckedHandle(RawObject* raw_ptr) { \ 96 static object& CheckedHandle(RawObject* raw_ptr) { \
101 return CheckedHandle(Thread::Current()->zone(), raw_ptr); \ 97 return CheckedHandle(Thread::Current()->zone(), raw_ptr); \
102 } \ 98 } \
103 static object& ZoneHandle(Zone* zone, Raw##object* raw_ptr) { \ 99 static object& ZoneHandle(Zone* zone, Raw##object* raw_ptr) { \
104 object* obj = reinterpret_cast<object*>( \ 100 object* obj = reinterpret_cast<object*>( \
105 VMHandles::AllocateZoneHandle(zone)); \ 101 VMHandles::AllocateZoneHandle(zone)); \
106 initializeHandle(obj, raw_ptr); \ 102 initializeHandle(obj, raw_ptr); \
107 return *obj; \ 103 return *obj; \
108 } \ 104 } \
109 /* DEPRECATED: Use Zone version. */ \
110 static object& ZoneHandle(Isolate* isolate, Raw##object* raw_ptr) { \
111 return ZoneHandle(isolate->current_zone(), raw_ptr); \
112 } \
113 static object* ReadOnlyHandle() { \ 105 static object* ReadOnlyHandle() { \
114 object* obj = reinterpret_cast<object*>( \ 106 object* obj = reinterpret_cast<object*>( \
115 Dart::AllocateReadOnlyHandle()); \ 107 Dart::AllocateReadOnlyHandle()); \
116 initializeHandle(obj, object::null()); \ 108 initializeHandle(obj, object::null()); \
117 return obj; \ 109 return obj; \
118 } \ 110 } \
119 static object& ZoneHandle(Zone* zone) { \ 111 static object& ZoneHandle(Zone* zone) { \
120 return ZoneHandle(zone, object::null()); \ 112 return ZoneHandle(zone, object::null()); \
121 } \ 113 } \
122 /* DEPRECATED: Use Zone version. */ \
123 static object& ZoneHandle(Isolate* isolate) { \
124 return ZoneHandle(isolate->current_zone(), object::null()); \
125 } \
126 static object& ZoneHandle() { \ 114 static object& ZoneHandle() { \
127 return ZoneHandle(Thread::Current()->zone(), object::null()); \ 115 return ZoneHandle(Thread::Current()->zone(), object::null()); \
128 } \ 116 } \
129 static object& ZoneHandle(Raw##object* raw_ptr) { \ 117 static object& ZoneHandle(Raw##object* raw_ptr) { \
130 return ZoneHandle(Thread::Current()->zone(), raw_ptr); \ 118 return ZoneHandle(Thread::Current()->zone(), raw_ptr); \
131 } \ 119 } \
132 static object& CheckedZoneHandle(Zone* zone, RawObject* raw_ptr) { \ 120 static object& CheckedZoneHandle(Zone* zone, RawObject* raw_ptr) { \
133 object* obj = reinterpret_cast<object*>( \ 121 object* obj = reinterpret_cast<object*>( \
134 VMHandles::AllocateZoneHandle(zone)); \ 122 VMHandles::AllocateZoneHandle(zone)); \
135 initializeHandle(obj, raw_ptr); \ 123 initializeHandle(obj, raw_ptr); \
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 static Object& Handle(RawObject* raw_ptr) { 361 static Object& Handle(RawObject* raw_ptr) {
374 return Handle(Isolate::Current(), raw_ptr); 362 return Handle(Isolate::Current(), raw_ptr);
375 } 363 }
376 364
377 static Object& ZoneHandle(Zone* zone, RawObject* raw_ptr) { 365 static Object& ZoneHandle(Zone* zone, RawObject* raw_ptr) {
378 Object* obj = reinterpret_cast<Object*>( 366 Object* obj = reinterpret_cast<Object*>(
379 VMHandles::AllocateZoneHandle(zone)); 367 VMHandles::AllocateZoneHandle(zone));
380 initializeHandle(obj, raw_ptr); 368 initializeHandle(obj, raw_ptr);
381 return *obj; 369 return *obj;
382 } 370 }
383 // DEPRECATED: Use Zone version.
384 static Object& ZoneHandle(Isolate* isolate, RawObject* raw_ptr) {
385 return ZoneHandle(isolate->current_zone(), raw_ptr);
386 }
387 371
388 static Object& ZoneHandle() { 372 static Object& ZoneHandle() {
389 return ZoneHandle(Isolate::Current(), null_); 373 return ZoneHandle(Thread::Current()->zone(), null_);
390 } 374 }
391 375
392 static Object& ZoneHandle(RawObject* raw_ptr) { 376 static Object& ZoneHandle(RawObject* raw_ptr) {
393 return ZoneHandle(Isolate::Current(), raw_ptr); 377 return ZoneHandle(Thread::Current()->zone(), raw_ptr);
394 } 378 }
395 379
396 static RawObject* null() { return null_; } 380 static RawObject* null() { return null_; }
397 381
398 static const Object& null_object() { 382 static const Object& null_object() {
399 ASSERT(null_object_ != NULL); 383 ASSERT(null_object_ != NULL);
400 return *null_object_; 384 return *null_object_;
401 } 385 }
402 static const Array& null_array() { 386 static const Array& null_array() {
403 ASSERT(null_array_ != NULL); 387 ASSERT(null_array_ != NULL);
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 static PassiveObject& Handle(Isolate* I) { 846 static PassiveObject& Handle(Isolate* I) {
863 return Handle(I, Object::null()); 847 return Handle(I, Object::null());
864 } 848 }
865 static PassiveObject& ZoneHandle(Zone* zone, RawObject* raw_ptr) { 849 static PassiveObject& ZoneHandle(Zone* zone, RawObject* raw_ptr) {
866 PassiveObject* obj = reinterpret_cast<PassiveObject*>( 850 PassiveObject* obj = reinterpret_cast<PassiveObject*>(
867 VMHandles::AllocateZoneHandle(zone)); 851 VMHandles::AllocateZoneHandle(zone));
868 obj->raw_ = raw_ptr; 852 obj->raw_ = raw_ptr;
869 obj->set_vtable(0); 853 obj->set_vtable(0);
870 return *obj; 854 return *obj;
871 } 855 }
872 // DEPRECATED - use Zone version.
873 static PassiveObject& ZoneHandle(Isolate* I, RawObject* raw_ptr) {
874 return ZoneHandle(I->current_zone(), raw_ptr);
875 }
876 static PassiveObject& ZoneHandle(RawObject* raw_ptr) { 856 static PassiveObject& ZoneHandle(RawObject* raw_ptr) {
877 return ZoneHandle(Isolate::Current(), raw_ptr); 857 return ZoneHandle(Thread::Current()->zone(), raw_ptr);
878 } 858 }
879 static PassiveObject& ZoneHandle() { 859 static PassiveObject& ZoneHandle() {
880 return ZoneHandle(Isolate::Current(), Object::null()); 860 return ZoneHandle(Thread::Current()->zone(), Object::null());
881 } 861 }
882 static PassiveObject& ZoneHandle(Zone* zone) { 862 static PassiveObject& ZoneHandle(Zone* zone) {
883 return ZoneHandle(zone, Object::null()); 863 return ZoneHandle(zone, Object::null());
884 } 864 }
885 // DEPRECATED - use Zone version.
886 static PassiveObject& ZoneHandle(Isolate* I) {
887 return ZoneHandle(I->current_zone(), Object::null());
888 }
889 865
890 private: 866 private:
891 PassiveObject() : Object() {} 867 PassiveObject() : Object() {}
892 DISALLOW_ALLOCATION(); 868 DISALLOW_ALLOCATION();
893 DISALLOW_COPY_AND_ASSIGN(PassiveObject); 869 DISALLOW_COPY_AND_ASSIGN(PassiveObject);
894 }; 870 };
895 871
896 872
897 class Class : public Object { 873 class Class : public Object {
898 public: 874 public:
(...skipping 6961 matching lines...) Expand 10 before | Expand all | Expand 10 after
7860 7836
7861 7837
7862 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7838 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7863 intptr_t index) { 7839 intptr_t index) {
7864 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7840 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7865 } 7841 }
7866 7842
7867 } // namespace dart 7843 } // namespace dart
7868 7844
7869 #endif // VM_OBJECT_H_ 7845 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/native_entry_test.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698