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

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

Issue 11364134: Merge libv1. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload due to error Created 8 years, 1 month 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/parser.cc ('k') | runtime/vm/raw_object_snapshot.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"
11 #include "vm/snapshot.h" 11 #include "vm/snapshot.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 // Macrobatics to define the Object hierarchy of VM implementation classes. 15 // Macrobatics to define the Object hierarchy of VM implementation classes.
16 #define CLASS_LIST_NO_OBJECT(V) \ 16 #define CLASS_LIST_NO_OBJECT_OR_STRING(V) \
17 V(Class) \ 17 V(Class) \
18 V(UnresolvedClass) \ 18 V(UnresolvedClass) \
19 V(AbstractTypeArguments) \ 19 V(AbstractTypeArguments) \
20 V(TypeArguments) \ 20 V(TypeArguments) \
21 V(InstantiatedTypeArguments) \ 21 V(InstantiatedTypeArguments) \
22 V(PatchClass) \ 22 V(PatchClass) \
23 V(Function) \ 23 V(Function) \
24 V(ClosureData) \ 24 V(ClosureData) \
25 V(RedirectionData) \ 25 V(RedirectionData) \
26 V(Field) \ 26 V(Field) \
(...skipping 22 matching lines...) Expand all
49 V(Instance) \ 49 V(Instance) \
50 V(AbstractType) \ 50 V(AbstractType) \
51 V(Type) \ 51 V(Type) \
52 V(TypeParameter) \ 52 V(TypeParameter) \
53 V(Number) \ 53 V(Number) \
54 V(Integer) \ 54 V(Integer) \
55 V(Smi) \ 55 V(Smi) \
56 V(Mint) \ 56 V(Mint) \
57 V(Bigint) \ 57 V(Bigint) \
58 V(Double) \ 58 V(Double) \
59 V(String) \
60 V(OneByteString) \
61 V(TwoByteString) \
62 V(ExternalOneByteString) \
63 V(ExternalTwoByteString) \
64 V(Bool) \ 59 V(Bool) \
65 V(Array) \ 60 V(Array) \
66 V(ImmutableArray) \ 61 V(ImmutableArray) \
67 V(GrowableObjectArray) \ 62 V(GrowableObjectArray) \
68 V(ByteArray) \ 63 V(ByteArray) \
69 V(Int8Array) \ 64 V(Int8Array) \
70 V(Uint8Array) \ 65 V(Uint8Array) \
71 V(Int16Array) \ 66 V(Int16Array) \
72 V(Uint16Array) \ 67 V(Uint16Array) \
73 V(Int32Array) \ 68 V(Int32Array) \
(...skipping 10 matching lines...) Expand all
84 V(ExternalUint32Array) \ 79 V(ExternalUint32Array) \
85 V(ExternalInt64Array) \ 80 V(ExternalInt64Array) \
86 V(ExternalUint64Array) \ 81 V(ExternalUint64Array) \
87 V(ExternalFloat32Array) \ 82 V(ExternalFloat32Array) \
88 V(ExternalFloat64Array) \ 83 V(ExternalFloat64Array) \
89 V(Stacktrace) \ 84 V(Stacktrace) \
90 V(JSRegExp) \ 85 V(JSRegExp) \
91 V(WeakProperty) \ 86 V(WeakProperty) \
92 V(DartFunction) \ 87 V(DartFunction) \
93 88
89 #define CLASS_LIST_STRINGS(V) \
90 V(String) \
91 V(OneByteString) \
92 V(TwoByteString) \
93 V(ExternalOneByteString) \
94 V(ExternalTwoByteString)
95
96 #define CLASS_LIST_FOR_HANDLES(V) \
97 CLASS_LIST_NO_OBJECT_OR_STRING(V) \
98 V(String)
99
100 #define CLASS_LIST_NO_OBJECT(V) \
101 CLASS_LIST_NO_OBJECT_OR_STRING(V) \
102 CLASS_LIST_STRINGS(V)
103
94 #define CLASS_LIST(V) \ 104 #define CLASS_LIST(V) \
95 V(Object) \ 105 V(Object) \
96 CLASS_LIST_NO_OBJECT(V) 106 CLASS_LIST_NO_OBJECT(V)
97 107
98 108
99 // Forward declarations. 109 // Forward declarations.
100 class Isolate; 110 class Isolate;
101 #define DEFINE_FORWARD_DECLARATION(clazz) \ 111 #define DEFINE_FORWARD_DECLARATION(clazz) \
102 class Raw##clazz; 112 class Raw##clazz;
103 CLASS_LIST(DEFINE_FORWARD_DECLARATION) 113 CLASS_LIST(DEFINE_FORWARD_DECLARATION)
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 friend class Heap; 388 friend class Heap;
379 friend class HeapProfiler; 389 friend class HeapProfiler;
380 friend class HeapProfilerRootVisitor; 390 friend class HeapProfilerRootVisitor;
381 friend class MarkingVisitor; 391 friend class MarkingVisitor;
382 friend class Object; 392 friend class Object;
383 friend class RawInstructions; 393 friend class RawInstructions;
384 friend class RawInstance; 394 friend class RawInstance;
385 friend class Scavenger; 395 friend class Scavenger;
386 friend class SnapshotReader; 396 friend class SnapshotReader;
387 friend class SnapshotWriter; 397 friend class SnapshotWriter;
398 friend class String;
388 399
389 DISALLOW_ALLOCATION(); 400 DISALLOW_ALLOCATION();
390 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject); 401 DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject);
391 }; 402 };
392 403
393 404
394 class RawClass : public RawObject { 405 class RawClass : public RawObject {
395 public: 406 public:
396 enum ClassState { 407 enum ClassState {
397 kAllocated, // Initial state. 408 kAllocated, // Initial state.
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 return (index >= kErrorCid && index < kInstanceCid); 1497 return (index >= kErrorCid && index < kInstanceCid);
1487 } 1498 }
1488 1499
1489 1500
1490 inline bool RawObject::IsNumberClassId(intptr_t index) { 1501 inline bool RawObject::IsNumberClassId(intptr_t index) {
1491 // Make sure this function is updated when new Number types are added. 1502 // Make sure this function is updated when new Number types are added.
1492 ASSERT(kIntegerCid == kNumberCid + 1 && 1503 ASSERT(kIntegerCid == kNumberCid + 1 &&
1493 kSmiCid == kNumberCid + 2 && 1504 kSmiCid == kNumberCid + 2 &&
1494 kMintCid == kNumberCid + 3 && 1505 kMintCid == kNumberCid + 3 &&
1495 kBigintCid == kNumberCid + 4 && 1506 kBigintCid == kNumberCid + 4 &&
1496 kDoubleCid == kNumberCid + 5 && 1507 kDoubleCid == kNumberCid + 5);
1497 kStringCid == kNumberCid + 6); 1508 return (index >= kNumberCid && index < kBoolCid);
1498 return (index >= kNumberCid && index < kStringCid);
1499 } 1509 }
1500 1510
1501 1511
1502 inline bool RawObject::IsIntegerClassId(intptr_t index) { 1512 inline bool RawObject::IsIntegerClassId(intptr_t index) {
1503 // Make sure this function is updated when new Integer types are added. 1513 // Make sure this function is updated when new Integer types are added.
1504 ASSERT(kSmiCid == kIntegerCid + 1 && 1514 ASSERT(kSmiCid == kIntegerCid + 1 &&
1505 kMintCid == kIntegerCid + 2 && 1515 kMintCid == kIntegerCid + 2 &&
1506 kBigintCid == kIntegerCid + 3 && 1516 kBigintCid == kIntegerCid + 3 &&
1507 kDoubleCid == kIntegerCid + 4); 1517 kDoubleCid == kIntegerCid + 4);
1508 return (index >= kIntegerCid && index < kDoubleCid); 1518 return (index >= kIntegerCid && index < kDoubleCid);
1509 } 1519 }
1510 1520
1511 1521
1512 inline bool RawObject::IsStringClassId(intptr_t index) { 1522 inline bool RawObject::IsStringClassId(intptr_t index) {
1513 // Make sure this function is updated when new StringCid types are added. 1523 // Make sure this function is updated when new StringCid types are added.
1514 ASSERT(kOneByteStringCid == kStringCid + 1 && 1524 ASSERT(kOneByteStringCid == kStringCid + 1 &&
1515 kTwoByteStringCid == kStringCid + 2 && 1525 kTwoByteStringCid == kStringCid + 2 &&
1516 kExternalOneByteStringCid == kStringCid + 3 && 1526 kExternalOneByteStringCid == kStringCid + 3 &&
1517 kExternalTwoByteStringCid == kStringCid + 4 && 1527 kExternalTwoByteStringCid == kStringCid + 4);
1518 kBoolCid == kStringCid + 5); 1528 return (index >= kStringCid && index <= kExternalTwoByteStringCid);
1519 return (index >= kStringCid && index < kBoolCid);
1520 } 1529 }
1521 1530
1522 1531
1523 inline bool RawObject::IsOneByteStringClassId(intptr_t index) { 1532 inline bool RawObject::IsOneByteStringClassId(intptr_t index) {
1524 // Make sure this function is updated when new StringCid types are added. 1533 // Make sure this function is updated when new StringCid types are added.
1525 ASSERT(kOneByteStringCid == kStringCid + 1 && 1534 ASSERT(kOneByteStringCid == kStringCid + 1 &&
1526 kTwoByteStringCid == kStringCid + 2 && 1535 kTwoByteStringCid == kStringCid + 2 &&
1527 kExternalOneByteStringCid == kStringCid + 3 && 1536 kExternalOneByteStringCid == kStringCid + 3 &&
1528 kExternalTwoByteStringCid == kStringCid + 4 && 1537 kExternalTwoByteStringCid == kStringCid + 4);
1529 kBoolCid == kStringCid + 5);
1530 return (index == kOneByteStringCid || index == kExternalOneByteStringCid); 1538 return (index == kOneByteStringCid || index == kExternalOneByteStringCid);
1531 } 1539 }
1532 1540
1533 1541
1534 inline bool RawObject::IsTwoByteStringClassId(intptr_t index) { 1542 inline bool RawObject::IsTwoByteStringClassId(intptr_t index) {
1535 // Make sure this function is updated when new StringCid types are added. 1543 // Make sure this function is updated when new StringCid types are added.
1536 ASSERT(kOneByteStringCid == kStringCid + 1 && 1544 ASSERT(kOneByteStringCid == kStringCid + 1 &&
1537 kTwoByteStringCid == kStringCid + 2 && 1545 kTwoByteStringCid == kStringCid + 2 &&
1538 kExternalOneByteStringCid == kStringCid + 3 && 1546 kExternalOneByteStringCid == kStringCid + 3 &&
1539 kExternalTwoByteStringCid == kStringCid + 4 && 1547 kExternalTwoByteStringCid == kStringCid + 4);
1540 kBoolCid == kStringCid + 5);
1541 return (index == kOneByteStringCid || 1548 return (index == kOneByteStringCid ||
1542 index == kTwoByteStringCid || 1549 index == kTwoByteStringCid ||
1543 index == kExternalOneByteStringCid || 1550 index == kExternalOneByteStringCid ||
1544 index == kExternalTwoByteStringCid); 1551 index == kExternalTwoByteStringCid);
1545 } 1552 }
1546 1553
1547 1554
1548 inline bool RawObject::IsExternalStringClassId(intptr_t index) { 1555 inline bool RawObject::IsExternalStringClassId(intptr_t index) {
1549 // Make sure this function is updated when new StringCid types are added. 1556 // Make sure this function is updated when new StringCid types are added.
1550 ASSERT(kOneByteStringCid == kStringCid + 1 && 1557 ASSERT(kOneByteStringCid == kStringCid + 1 &&
1551 kTwoByteStringCid == kStringCid + 2 && 1558 kTwoByteStringCid == kStringCid + 2 &&
1552 kExternalOneByteStringCid == kStringCid + 3 && 1559 kExternalOneByteStringCid == kStringCid + 3 &&
1553 kExternalTwoByteStringCid == kStringCid + 4 && 1560 kExternalTwoByteStringCid == kStringCid + 4);
1554 kBoolCid == kStringCid + 5);
1555 return (index == kExternalOneByteStringCid || 1561 return (index == kExternalOneByteStringCid ||
1556 index == kExternalTwoByteStringCid); 1562 index == kExternalTwoByteStringCid);
1557 } 1563 }
1558 1564
1559 1565
1560 inline bool RawObject::IsBuiltinListClassId(intptr_t index) { 1566 inline bool RawObject::IsBuiltinListClassId(intptr_t index) {
1561 // Make sure this function is updated when new builtin List types are added. 1567 // Make sure this function is updated when new builtin List types are added.
1562 ASSERT(kImmutableArrayCid == kArrayCid + 1 && 1568 ASSERT(kImmutableArrayCid == kArrayCid + 1 &&
1563 kGrowableObjectArrayCid == kArrayCid + 2 && 1569 kGrowableObjectArrayCid == kArrayCid + 2 &&
1564 kByteArrayCid == kArrayCid + 3); 1570 kByteArrayCid == kArrayCid + 3);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 7 && 1610 kExternalUint64ArrayCid == kExternalInt8ArrayCid + 7 &&
1605 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 8 && 1611 kExternalFloat32ArrayCid == kExternalInt8ArrayCid + 8 &&
1606 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 9 && 1612 kExternalFloat64ArrayCid == kExternalInt8ArrayCid + 9 &&
1607 kStacktraceCid == kExternalInt8ArrayCid + 10); 1613 kStacktraceCid == kExternalInt8ArrayCid + 10);
1608 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid); 1614 return (index >= kExternalInt8ArrayCid && index <= kExternalFloat64ArrayCid);
1609 } 1615 }
1610 1616
1611 } // namespace dart 1617 } // namespace dart
1612 1618
1613 #endif // VM_RAW_OBJECT_H_ 1619 #endif // VM_RAW_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698