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

Side by Side Diff: runtime/vm/raw_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/vm/object_test.cc ('k') | runtime/vm/raw_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_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/token.h" 10 #include "vm/token.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 V(Mint) \ 59 V(Mint) \
60 V(Bigint) \ 60 V(Bigint) \
61 V(Double) \ 61 V(Double) \
62 V(Bool) \ 62 V(Bool) \
63 V(GrowableObjectArray) \ 63 V(GrowableObjectArray) \
64 V(TypedData) \ 64 V(TypedData) \
65 V(ExternalTypedData) \ 65 V(ExternalTypedData) \
66 V(Stacktrace) \ 66 V(Stacktrace) \
67 V(JSRegExp) \ 67 V(JSRegExp) \
68 V(WeakProperty) \ 68 V(WeakProperty) \
69 V(MirrorReference) \
69 V(DartFunction) \ 70 V(DartFunction) \
70 V(Float32x4) \ 71 V(Float32x4) \
71 V(Uint32x4) \ 72 V(Uint32x4) \
72 73
73 #define CLASS_LIST_ARRAYS(V) \ 74 #define CLASS_LIST_ARRAYS(V) \
74 V(Array) \ 75 V(Array) \
75 V(ImmutableArray) \ 76 V(ImmutableArray) \
76 77
77 #define CLASS_LIST_STRINGS(V) \ 78 #define CLASS_LIST_STRINGS(V) \
78 V(String) \ 79 V(String) \
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 RawObject** to() { 1520 RawObject** to() {
1520 return reinterpret_cast<RawObject**>(&ptr()->value_); 1521 return reinterpret_cast<RawObject**>(&ptr()->value_);
1521 } 1522 }
1522 1523
1523 friend class GCMarker; 1524 friend class GCMarker;
1524 friend class MarkingVisitor; 1525 friend class MarkingVisitor;
1525 friend class Scavenger; 1526 friend class Scavenger;
1526 friend class ScavengerVisitor; 1527 friend class ScavengerVisitor;
1527 }; 1528 };
1528 1529
1530 // MirrorReferences are used by mirrors to hold reflectees that are VM
1531 // internal objects, such as libraries, classes, functions or types.
1532 class RawMirrorReference : public RawInstance {
1533 RAW_HEAP_OBJECT_IMPLEMENTATION(MirrorReference);
1534
1535 RawObject** from() {
1536 return reinterpret_cast<RawObject**>(&ptr()->referent_);
1537 }
1538 RawObject* referent_;
1539 RawObject** to() {
1540 return reinterpret_cast<RawObject**>(&ptr()->referent_);
1541 }
1542 };
1543
1529 1544
1530 // Class Id predicates. 1545 // Class Id predicates.
1531 1546
1532 inline bool RawObject::IsErrorClassId(intptr_t index) { 1547 inline bool RawObject::IsErrorClassId(intptr_t index) {
1533 // Make sure this function is updated when new Error types are added. 1548 // Make sure this function is updated when new Error types are added.
1534 ASSERT(kApiErrorCid == kErrorCid + 1 && 1549 ASSERT(kApiErrorCid == kErrorCid + 1 &&
1535 kLanguageErrorCid == kErrorCid + 2 && 1550 kLanguageErrorCid == kErrorCid + 2 &&
1536 kUnhandledExceptionCid == kErrorCid + 3 && 1551 kUnhandledExceptionCid == kErrorCid + 3 &&
1537 kUnwindErrorCid == kErrorCid + 4 && 1552 kUnwindErrorCid == kErrorCid + 4 &&
1538 kInstanceCid == kErrorCid + 5); 1553 kInstanceCid == kErrorCid + 5);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 // Make sure this is updated when new TypedData types are added. 1705 // Make sure this is updated when new TypedData types are added.
1691 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12); 1706 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 12);
1692 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13); 1707 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 13);
1693 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12); 1708 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 12);
1694 return (kNullCid - kTypedDataInt8ArrayCid); 1709 return (kNullCid - kTypedDataInt8ArrayCid);
1695 } 1710 }
1696 1711
1697 } // namespace dart 1712 } // namespace dart
1698 1713
1699 #endif // VM_RAW_OBJECT_H_ 1714 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698