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

Unified Diff: runtime/vm/raw_object.h

Issue 11367044: Merged String subclasses into String. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/raw_object.h
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 18ae342710808fe7f730c6c52c4952401ef030b7..e8a9c0f2ac2f357673f99327ce4acd42fc31ff2e 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -57,10 +57,6 @@ namespace dart {
V(Bigint) \
V(Double) \
V(String) \
- V(OneByteString) \
- V(TwoByteString) \
- V(ExternalOneByteString) \
- V(ExternalTwoByteString) \
V(Bool) \
V(Array) \
V(ImmutableArray) \
@@ -95,6 +91,12 @@ namespace dart {
V(Object) \
CLASS_LIST_NO_OBJECT(V)
+#define CLASS_LIST_STRING_SUBTYPES(V) \
+ V(OneByteString) \
+ V(TwoByteString) \
+ V(ExternalOneByteString) \
+ V(ExternalTwoByteString)
+
// Forward declarations.
class Isolate;
@@ -114,6 +116,12 @@ enum ClassId {
CLASS_LIST(DEFINE_OBJECT_KIND)
#undef DEFINE_OBJECT_KIND
+ // The following entries describe the types of string subtypes.
+ kOneByteStringCid,
+ kTwoByteStringCid,
+ kExternalOneByteStringCid,
+ kExternalTwoByteStringCid,
+
// The following entries do not describe a predefined class, but instead
// are class indexes for pre-allocated instance (Null, dynamic and Void).
kNullCid,
@@ -385,6 +393,7 @@ class RawObject {
friend class Scavenger;
friend class SnapshotReader;
friend class SnapshotWriter;
+ friend class String;
DISALLOW_ALLOCATION();
DISALLOW_IMPLICIT_CONSTRUCTORS(RawObject);
@@ -1511,33 +1520,27 @@ inline bool RawObject::IsIntegerClassId(intptr_t index) {
inline bool RawObject::IsStringClassId(intptr_t index) {
// Make sure this function is updated when new StringCid types are added.
- ASSERT(kOneByteStringCid == kStringCid + 1 &&
- kTwoByteStringCid == kStringCid + 2 &&
- kExternalOneByteStringCid == kStringCid + 3 &&
- kExternalTwoByteStringCid == kStringCid + 4 &&
- kBoolCid == kStringCid + 5);
- return (index >= kStringCid && index < kBoolCid);
+ ASSERT(kTwoByteStringCid == kOneByteStringCid + 1 &&
+ kExternalOneByteStringCid == kOneByteStringCid + 2 &&
+ kExternalTwoByteStringCid == kOneByteStringCid + 3);
+ return (index >= kOneByteStringCid && index <= kExternalTwoByteStringCid);
}
inline bool RawObject::IsOneByteStringClassId(intptr_t index) {
// Make sure this function is updated when new StringCid types are added.
- ASSERT(kOneByteStringCid == kStringCid + 1 &&
- kTwoByteStringCid == kStringCid + 2 &&
- kExternalOneByteStringCid == kStringCid + 3 &&
- kExternalTwoByteStringCid == kStringCid + 4 &&
- kBoolCid == kStringCid + 5);
+ ASSERT(kTwoByteStringCid == kOneByteStringCid + 1 &&
+ kExternalOneByteStringCid == kOneByteStringCid + 2 &&
+ kExternalTwoByteStringCid == kOneByteStringCid + 3);
return (index == kOneByteStringCid || index == kExternalOneByteStringCid);
}
inline bool RawObject::IsTwoByteStringClassId(intptr_t index) {
// Make sure this function is updated when new StringCid types are added.
- ASSERT(kOneByteStringCid == kStringCid + 1 &&
- kTwoByteStringCid == kStringCid + 2 &&
- kExternalOneByteStringCid == kStringCid + 3 &&
- kExternalTwoByteStringCid == kStringCid + 4 &&
- kBoolCid == kStringCid + 5);
+ ASSERT(kTwoByteStringCid == kOneByteStringCid + 1 &&
+ kExternalOneByteStringCid == kOneByteStringCid + 2 &&
+ kExternalTwoByteStringCid == kOneByteStringCid + 3);
return (index == kOneByteStringCid ||
index == kTwoByteStringCid ||
index == kExternalOneByteStringCid ||
@@ -1547,11 +1550,9 @@ inline bool RawObject::IsTwoByteStringClassId(intptr_t index) {
inline bool RawObject::IsExternalStringClassId(intptr_t index) {
// Make sure this function is updated when new StringCid types are added.
- ASSERT(kOneByteStringCid == kStringCid + 1 &&
- kTwoByteStringCid == kStringCid + 2 &&
- kExternalOneByteStringCid == kStringCid + 3 &&
- kExternalTwoByteStringCid == kStringCid + 4 &&
- kBoolCid == kStringCid + 5);
+ ASSERT(kTwoByteStringCid == kOneByteStringCid + 1 &&
+ kExternalOneByteStringCid == kOneByteStringCid + 2 &&
+ kExternalTwoByteStringCid == kOneByteStringCid + 3);
return (index == kExternalOneByteStringCid ||
index == kExternalTwoByteStringCid);
}

Powered by Google App Engine
This is Rietveld 408576698