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

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

Issue 18242003: Add a VM defined class MirrorReference as an opaque pointer for Dart code to VM internal objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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/lib/mirrors_sources.gypi ('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 5812 matching lines...) Expand 10 before | Expand all | Expand 10 after
5823 raw_weak->ptr()->key_ = Object::null(); 5823 raw_weak->ptr()->key_ = Object::null();
5824 raw_weak->ptr()->value_ = Object::null(); 5824 raw_weak->ptr()->value_ = Object::null();
5825 } 5825 }
5826 5826
5827 private: 5827 private:
5828 FINAL_HEAP_OBJECT_IMPLEMENTATION(WeakProperty, Instance); 5828 FINAL_HEAP_OBJECT_IMPLEMENTATION(WeakProperty, Instance);
5829 friend class Class; 5829 friend class Class;
5830 }; 5830 };
5831 5831
5832 5832
5833 class MirrorReference : public Instance {
5834 public:
5835 RawObject* referent() const {
5836 return raw_ptr()->referent_;
5837 }
5838
5839 void set_referent(const Object& referent) const {
5840 StorePointer(&raw_ptr()->referent_, referent.raw());
5841 }
5842
5843 static RawMirrorReference* New(Heap::Space space = Heap::kNew);
5844
5845 static intptr_t InstanceSize() {
5846 return RoundedAllocationSize(sizeof(RawMirrorReference));
5847 }
5848
5849 private:
5850 FINAL_HEAP_OBJECT_IMPLEMENTATION(MirrorReference, Instance);
5851 friend class Class;
5852 };
5853
5854
5833 // Breaking cycles and loops. 5855 // Breaking cycles and loops.
5834 RawClass* Object::clazz() const { 5856 RawClass* Object::clazz() const {
5835 uword raw_value = reinterpret_cast<uword>(raw_); 5857 uword raw_value = reinterpret_cast<uword>(raw_);
5836 if ((raw_value & kSmiTagMask) == kSmiTag) { 5858 if ((raw_value & kSmiTagMask) == kSmiTag) {
5837 return Smi::Class(); 5859 return Smi::Class();
5838 } 5860 }
5839 return Isolate::Current()->class_table()->At(raw()->GetClassId()); 5861 return Isolate::Current()->class_table()->At(raw()->GetClassId());
5840 } 5862 }
5841 5863
5842 5864
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
5949 5971
5950 5972
5951 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 5973 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
5952 intptr_t index) { 5974 intptr_t index) {
5953 return array.At((index * kEntryLength) + kTargetFunctionIndex); 5975 return array.At((index * kEntryLength) + kTargetFunctionIndex);
5954 } 5976 }
5955 5977
5956 } // namespace dart 5978 } // namespace dart
5957 5979
5958 #endif // VM_OBJECT_H_ 5980 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/lib/mirrors_sources.gypi ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698