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

Unified Diff: src/objects.h

Issue 7977001: Added ability to lock strings to prevent their representation or encoding from changing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: More tweaks. Created 9 years, 3 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
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index e64bdbfff2011658bb94022cbd5c48e2e5d29ce8..c69ee2a8af0bc0453ed3e6a574600b11883d5c3c 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -5693,7 +5693,6 @@ class StringHasher {
uint32_t raw_running_hash_;
uint32_t array_index_;
bool is_array_index_;
- bool is_first_char_;
bool is_valid_;
friend class TwoCharHashTableKey;
};
@@ -6150,10 +6149,11 @@ class SeqString: public String {
};
-// The AsciiString class captures sequential ascii string objects.
-// Each character in the AsciiString is an ascii character.
+// The SeqAsciiString class captures sequential ASCII string objects.
+// Each character in the AsciiString is an ASCII character.
class SeqAsciiString: public SeqString {
public:
+ typedef char CharType;
static const bool kHasAsciiEncoding = true;
// Dispatched behavior.
@@ -6168,6 +6168,11 @@ class SeqAsciiString: public SeqString {
// Casting
static inline SeqAsciiString* cast(Object* obj);
+ bool IsSeqAsciiString() {
Rico 2011/09/23 07:06:52 Why this, we can always just call IsSequentialAsci
Lasse Reichstein 2011/09/23 09:54:39 As discussed offline, this is to allow templated f
+ ASSERT(this->Object::IsSeqAsciiString());
+ return true;
+ }
+
// Garbage collection support. This method is called by the
// garbage collector to compute the actual size of an AsciiString
// instance.
@@ -6197,10 +6202,12 @@ class SeqAsciiString: public SeqString {
};
-// The TwoByteString class captures sequential unicode string objects.
+// The SeqTwoByteString class captures sequential unicode string objects.
// Each character in the TwoByteString is a two-byte uint16_t.
class SeqTwoByteString: public SeqString {
public:
+ typedef uc16 CharType;
+
static const bool kHasAsciiEncoding = false;
// Dispatched behavior.
@@ -6217,6 +6224,10 @@ class SeqTwoByteString: public SeqString {
// Casting
static inline SeqTwoByteString* cast(Object* obj);
+ bool IsSeqTwoByteString() {
+ ASSERT(this->Object::IsSeqTwoByteString());
Rico 2011/09/23 07:06:52 Same question as for ascii
Lasse Reichstein 2011/09/23 09:54:39 Same answer.
+ return true;
+ }
// Garbage collection support. This method is called by the
// garbage collector to compute the actual size of a TwoByteString
@@ -6386,6 +6397,8 @@ class ExternalString: public String {
// ASCII string.
class ExternalAsciiString: public ExternalString {
public:
+ typedef char CharType;
+
static const bool kHasAsciiEncoding = true;
typedef v8::String::ExternalAsciiStringResource Resource;
@@ -6399,6 +6412,10 @@ class ExternalAsciiString: public ExternalString {
// Casting.
static inline ExternalAsciiString* cast(Object* obj);
+ bool IsExternalAsciiString() {
+ ASSERT(this->Object::IsExternalAsciiString());
+ return true;
+ }
// Garbage collection support.
inline void ExternalAsciiStringIterateBody(ObjectVisitor* v);
@@ -6419,10 +6436,11 @@ class ExternalAsciiString: public ExternalString {
};
-// The ExternalTwoByteString class is an external string backed by a UTF-16
-// encoded string.
+// The ExternalTwoByteString class is an external string backed by a 16-bit
+// character sequence.
class ExternalTwoByteString: public ExternalString {
public:
+ typedef uc16 CharType;
static const bool kHasAsciiEncoding = false;
typedef v8::String::ExternalStringResource Resource;
@@ -6439,6 +6457,10 @@ class ExternalTwoByteString: public ExternalString {
// Casting.
static inline ExternalTwoByteString* cast(Object* obj);
+ bool IsExternalTwoByteString() {
+ ASSERT(this->Object::IsExternalTwoByteString());
+ return true;
+ }
// Garbage collection support.
inline void ExternalTwoByteStringIterateBody(ObjectVisitor* v);

Powered by Google App Engine
This is Rietveld 408576698