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

Unified Diff: src/objects.h

Issue 2621913002: Revert of Internalize strings in-place (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips64/codegen-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 2d9235f23e17888f2577b965c29a84f961c6adec..53c5e18c53dc60602d28997bffa3236ec2b04ffb 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -108,7 +108,6 @@
// - SeqTwoByteString
// - SlicedString
// - ConsString
-// - ThinString
// - ExternalString
// - ExternalOneByteString
// - ExternalTwoByteString
@@ -334,12 +333,10 @@
V(CONS_STRING_TYPE) \
V(EXTERNAL_STRING_TYPE) \
V(SLICED_STRING_TYPE) \
- V(THIN_STRING_TYPE) \
V(ONE_BYTE_STRING_TYPE) \
V(CONS_ONE_BYTE_STRING_TYPE) \
V(EXTERNAL_ONE_BYTE_STRING_TYPE) \
V(SLICED_ONE_BYTE_STRING_TYPE) \
- V(THIN_ONE_BYTE_STRING_TYPE) \
V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \
V(SHORT_EXTERNAL_STRING_TYPE) \
V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE) \
@@ -523,10 +520,7 @@
V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE, \
ExternalTwoByteString::kShortSize, \
short_external_internalized_string_with_one_byte_data, \
- ShortExternalInternalizedStringWithOneByteData) \
- V(THIN_STRING_TYPE, ThinString::kSize, thin_string, ThinString) \
- V(THIN_ONE_BYTE_STRING_TYPE, ThinString::kSize, thin_one_byte_string, \
- ThinOneByteString)
+ ShortExternalInternalizedStringWithOneByteData)
// A struct is a simple object a set of object-valued fields. Including an
// object type in this causes the compiler to generate most of the boilerplate
@@ -578,21 +572,20 @@
const uint32_t kNotInternalizedTag = 0x40;
const uint32_t kInternalizedTag = 0x0;
-// If bit 7 is clear then bit 3 indicates whether the string consists of
+// If bit 7 is clear then bit 2 indicates whether the string consists of
// two-byte characters or one-byte characters.
-const uint32_t kStringEncodingMask = 0x8;
+const uint32_t kStringEncodingMask = 0x4;
const uint32_t kTwoByteStringTag = 0x0;
-const uint32_t kOneByteStringTag = 0x8;
-
-// If bit 7 is clear, the low-order 3 bits indicate the representation
+const uint32_t kOneByteStringTag = 0x4;
+
+// If bit 7 is clear, the low-order 2 bits indicate the representation
// of the string.
-const uint32_t kStringRepresentationMask = 0x07;
+const uint32_t kStringRepresentationMask = 0x03;
enum StringRepresentationTag {
kSeqStringTag = 0x0,
kConsStringTag = 0x1,
kExternalStringTag = 0x2,
- kSlicedStringTag = 0x3,
- kThinStringTag = 0x5
+ kSlicedStringTag = 0x3
};
const uint32_t kIsIndirectStringMask = 0x1;
const uint32_t kIsIndirectStringTag = 0x1;
@@ -602,17 +595,22 @@
kIsIndirectStringMask) == kIsIndirectStringTag); // NOLINT
STATIC_ASSERT((kSlicedStringTag &
kIsIndirectStringMask) == kIsIndirectStringTag); // NOLINT
-STATIC_ASSERT((kThinStringTag & kIsIndirectStringMask) == kIsIndirectStringTag);
-
-// If bit 7 is clear, then bit 4 indicates whether this two-byte
+
+// Use this mask to distinguish between cons and slice only after making
+// sure that the string is one of the two (an indirect string).
+const uint32_t kSlicedNotConsMask = kSlicedStringTag & ~kConsStringTag;
+STATIC_ASSERT(IS_POWER_OF_TWO(kSlicedNotConsMask));
+
+// If bit 7 is clear, then bit 3 indicates whether this two-byte
// string actually contains one byte data.
-const uint32_t kOneByteDataHintMask = 0x10;
-const uint32_t kOneByteDataHintTag = 0x10;
+const uint32_t kOneByteDataHintMask = 0x08;
+const uint32_t kOneByteDataHintTag = 0x08;
// If bit 7 is clear and string representation indicates an external string,
-// then bit 5 indicates whether the data pointer is cached.
-const uint32_t kShortExternalStringMask = 0x20;
-const uint32_t kShortExternalStringTag = 0x20;
+// then bit 4 indicates whether the data pointer is cached.
+const uint32_t kShortExternalStringMask = 0x10;
+const uint32_t kShortExternalStringTag = 0x10;
+
// A ConsString with an empty string as the right side is a candidate
// for being shortcut by the garbage collector. We don't allocate any
@@ -676,9 +674,6 @@
SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE =
SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE |
kNotInternalizedTag,
- THIN_STRING_TYPE = kTwoByteStringTag | kThinStringTag | kNotInternalizedTag,
- THIN_ONE_BYTE_STRING_TYPE =
- kOneByteStringTag | kThinStringTag | kNotInternalizedTag,
// Non-string names
SYMBOL_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE, LAST_NAME_TYPE
@@ -1033,7 +1028,6 @@
V(SeqTwoByteString) \
V(SeqOneByteString) \
V(InternalizedString) \
- V(ThinString) \
V(Symbol) \
\
V(FixedTypedArrayBase) \
@@ -9325,7 +9319,6 @@
inline bool IsExternal();
inline bool IsCons();
inline bool IsSliced();
- inline bool IsThin();
inline bool IsIndirect();
inline bool IsExternalOneByte();
inline bool IsExternalTwoByte();
@@ -10039,34 +10032,6 @@
DISALLOW_IMPLICIT_CONSTRUCTORS(ConsString);
};
-// The ThinString class describes string objects that are just references
-// to another string object. They are used for in-place internalization when
-// the original string cannot actually be internalized in-place: in these
-// cases, the original string is converted to a ThinString pointing at its
-// internalized version (which is allocated as a new object).
-// In terms of memory layout and most algorithms operating on strings,
-// ThinStrings can be thought of as "one-part cons strings".
-class ThinString : public String {
- public:
- // Actual string that this ThinString refers to.
- inline String* actual() const;
- inline void set_actual(String* s,
- WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
-
- V8_EXPORT_PRIVATE uint16_t ThinStringGet(int index);
-
- DECLARE_CAST(ThinString)
- DECLARE_VERIFIER(ThinString)
-
- // Layout description.
- static const int kActualOffset = String::kSize;
- static const int kSize = kActualOffset + kPointerSize;
-
- typedef FixedBodyDescriptor<kActualOffset, kSize, kSize> BodyDescriptor;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(ThinString);
-};
// The Sliced String class describes strings that are substrings of another
// sequential string. The motivation is to save time and memory when creating
« no previous file with comments | « src/mips64/codegen-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698