OLD | NEW |
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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 } | 367 } |
368 // DEPRECATED: Use Zone version. | 368 // DEPRECATED: Use Zone version. |
369 static Object& Handle(Isolate* isolate) { | 369 static Object& Handle(Isolate* isolate) { |
370 return Handle(isolate->current_zone(), null_); | 370 return Handle(isolate->current_zone(), null_); |
371 } | 371 } |
372 | 372 |
373 static Object& Handle(RawObject* raw_ptr) { | 373 static Object& Handle(RawObject* raw_ptr) { |
374 return Handle(Isolate::Current(), raw_ptr); | 374 return Handle(Isolate::Current(), raw_ptr); |
375 } | 375 } |
376 | 376 |
377 static Object& ZoneHandle(Isolate* isolate, RawObject* raw_ptr) { | 377 static Object& ZoneHandle(Zone* zone, RawObject* raw_ptr) { |
378 Object* obj = reinterpret_cast<Object*>( | 378 Object* obj = reinterpret_cast<Object*>( |
379 VMHandles::AllocateZoneHandle(isolate->current_zone())); | 379 VMHandles::AllocateZoneHandle(zone)); |
380 initializeHandle(obj, raw_ptr); | 380 initializeHandle(obj, raw_ptr); |
381 return *obj; | 381 return *obj; |
382 } | 382 } |
| 383 // DEPRECATED: Use Zone version. |
| 384 static Object& ZoneHandle(Isolate* isolate, RawObject* raw_ptr) { |
| 385 return ZoneHandle(isolate->current_zone(), raw_ptr); |
| 386 } |
383 | 387 |
384 static Object& ZoneHandle() { | 388 static Object& ZoneHandle() { |
385 return ZoneHandle(Isolate::Current(), null_); | 389 return ZoneHandle(Isolate::Current(), null_); |
386 } | 390 } |
387 | 391 |
388 static Object& ZoneHandle(RawObject* raw_ptr) { | 392 static Object& ZoneHandle(RawObject* raw_ptr) { |
389 return ZoneHandle(Isolate::Current(), raw_ptr); | 393 return ZoneHandle(Isolate::Current(), raw_ptr); |
390 } | 394 } |
391 | 395 |
392 static RawObject* null() { return null_; } | 396 static RawObject* null() { return null_; } |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 | 830 |
827 | 831 |
828 class PassiveObject : public Object { | 832 class PassiveObject : public Object { |
829 public: | 833 public: |
830 void operator=(RawObject* value) { | 834 void operator=(RawObject* value) { |
831 raw_ = value; | 835 raw_ = value; |
832 } | 836 } |
833 void operator^=(RawObject* value) { | 837 void operator^=(RawObject* value) { |
834 raw_ = value; | 838 raw_ = value; |
835 } | 839 } |
836 static PassiveObject& Handle(Isolate* I, RawObject* raw_ptr) { | 840 |
| 841 static PassiveObject& Handle(Zone* zone, RawObject* raw_ptr) { |
837 PassiveObject* obj = reinterpret_cast<PassiveObject*>( | 842 PassiveObject* obj = reinterpret_cast<PassiveObject*>( |
838 VMHandles::AllocateHandle(I->current_zone())); | 843 VMHandles::AllocateHandle(zone)); |
839 obj->raw_ = raw_ptr; | 844 obj->raw_ = raw_ptr; |
840 obj->set_vtable(0); | 845 obj->set_vtable(0); |
841 return *obj; | 846 return *obj; |
842 } | 847 } |
| 848 // DEPRECATED - use Zone version. |
| 849 static PassiveObject& Handle(Isolate* I, RawObject* raw_ptr) { |
| 850 return Handle(I->current_zone(), raw_ptr); |
| 851 } |
843 static PassiveObject& Handle(RawObject* raw_ptr) { | 852 static PassiveObject& Handle(RawObject* raw_ptr) { |
844 return Handle(Isolate::Current(), raw_ptr); | 853 return Handle(Isolate::Current(), raw_ptr); |
845 } | 854 } |
846 static PassiveObject& Handle() { | 855 static PassiveObject& Handle() { |
847 return Handle(Isolate::Current(), Object::null()); | 856 return Handle(Isolate::Current(), Object::null()); |
848 } | 857 } |
849 // DEPRECATED | 858 static PassiveObject& Handle(Zone* zone) { |
850 // TODO(koda): Add Zone version. | 859 return Handle(zone, Object::null()); |
| 860 } |
| 861 // DEPRECATED - use Zone version. |
851 static PassiveObject& Handle(Isolate* I) { | 862 static PassiveObject& Handle(Isolate* I) { |
852 return Handle(I, Object::null()); | 863 return Handle(I, Object::null()); |
853 } | 864 } |
854 // DEPRECATED | 865 static PassiveObject& ZoneHandle(Zone* zone, RawObject* raw_ptr) { |
855 // TODO(koda): Add Zone version. | |
856 static PassiveObject& ZoneHandle(Isolate* I, RawObject* raw_ptr) { | |
857 PassiveObject* obj = reinterpret_cast<PassiveObject*>( | 866 PassiveObject* obj = reinterpret_cast<PassiveObject*>( |
858 VMHandles::AllocateZoneHandle(I->current_zone())); | 867 VMHandles::AllocateZoneHandle(zone)); |
859 obj->raw_ = raw_ptr; | 868 obj->raw_ = raw_ptr; |
860 obj->set_vtable(0); | 869 obj->set_vtable(0); |
861 return *obj; | 870 return *obj; |
862 } | 871 } |
| 872 // DEPRECATED - use Zone version. |
| 873 static PassiveObject& ZoneHandle(Isolate* I, RawObject* raw_ptr) { |
| 874 return ZoneHandle(I->current_zone(), raw_ptr); |
| 875 } |
863 static PassiveObject& ZoneHandle(RawObject* raw_ptr) { | 876 static PassiveObject& ZoneHandle(RawObject* raw_ptr) { |
864 return ZoneHandle(Isolate::Current(), raw_ptr); | 877 return ZoneHandle(Isolate::Current(), raw_ptr); |
865 } | 878 } |
866 static PassiveObject& ZoneHandle() { | 879 static PassiveObject& ZoneHandle() { |
867 return ZoneHandle(Isolate::Current(), Object::null()); | 880 return ZoneHandle(Isolate::Current(), Object::null()); |
868 } | 881 } |
869 // DEPRECATED | 882 static PassiveObject& ZoneHandle(Zone* zone) { |
870 // TODO(koda): Add Zone version. | 883 return ZoneHandle(zone, Object::null()); |
| 884 } |
| 885 // DEPRECATED - use Zone version. |
871 static PassiveObject& ZoneHandle(Isolate* I) { | 886 static PassiveObject& ZoneHandle(Isolate* I) { |
872 return ZoneHandle(I, Object::null()); | 887 return ZoneHandle(I->current_zone(), Object::null()); |
873 } | 888 } |
874 | 889 |
875 private: | 890 private: |
876 PassiveObject() : Object() {} | 891 PassiveObject() : Object() {} |
877 DISALLOW_ALLOCATION(); | 892 DISALLOW_ALLOCATION(); |
878 DISALLOW_COPY_AND_ASSIGN(PassiveObject); | 893 DISALLOW_COPY_AND_ASSIGN(PassiveObject); |
879 }; | 894 }; |
880 | 895 |
881 | 896 |
882 class Class : public Object { | 897 class Class : public Object { |
(...skipping 6942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7825 | 7840 |
7826 | 7841 |
7827 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7842 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7828 intptr_t index) { | 7843 intptr_t index) { |
7829 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7844 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7830 } | 7845 } |
7831 | 7846 |
7832 } // namespace dart | 7847 } // namespace dart |
7833 | 7848 |
7834 #endif // VM_OBJECT_H_ | 7849 #endif // VM_OBJECT_H_ |
OLD | NEW |