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

Unified Diff: src/objects.h

Issue 11818025: Continues Latin-1 support. All tests pass with ENABLE_LATIN_1 flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ARM fix Created 7 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
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 3da05c2ca8e85764b735da06496f0248a375afb5..ca8be86486c199a315906e55eab07e9f4519618d 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -7088,13 +7088,6 @@ class String: public HeapObject {
// Returns true if the structure contains two-byte content.
bool IsTwoByte() { return state_ == TWO_BYTE; }
- // TODO(dcarney): Remove this function.
- // Return the ASCII content of the string. Only use if IsAscii() returns
- // true.
- Vector<const char> ToAsciiVector() {
- ASSERT_EQ(ASCII, state_);
- return Vector<const char>::cast(buffer_);
- }
// Return the one byte content of the string. Only use if IsAscii() returns
// true.
Vector<const uint8_t> ToOneByteVector() {
@@ -7112,15 +7105,15 @@ class String: public HeapObject {
enum State { NON_FLAT, ASCII, TWO_BYTE };
// Constructors only used by String::GetFlatContent().
- explicit FlatContent(Vector<const char> chars)
- : buffer_(Vector<const byte>::cast(chars)),
+ explicit FlatContent(Vector<const uint8_t> chars)
+ : buffer_(chars),
state_(ASCII) { }
explicit FlatContent(Vector<const uc16> chars)
: buffer_(Vector<const byte>::cast(chars)),
state_(TWO_BYTE) { }
FlatContent() : buffer_(), state_(NON_FLAT) { }
- Vector<const byte> buffer_;
+ Vector<const uint8_t> buffer_;
State state_;
friend class String;
@@ -7389,6 +7382,11 @@ class String: public HeapObject {
return NonAsciiStart(chars, length) >= length;
}
+ static inline bool IsAscii(const uint8_t* chars, int length) {
+ return
+ NonAsciiStart(reinterpret_cast<const char*>(chars), length) >= length;
Yang 2013/01/09 15:39:30 Could we also change NonAsciiStart to take const u
drcarney 2013/01/09 16:27:31 we need the char implementation for utf8 code patc
+ }
+
static inline int NonOneByteStart(const uc16* chars, int length) {
const uc16* limit = chars + length;
const uc16* start = chars;
@@ -7465,9 +7463,7 @@ class SeqOneByteString: public SeqString {
// Get the address of the characters in this string.
inline Address GetCharsAddress();
- // TODO(dcarney): remove GetChars and rename GetCharsU to GetChars.
- inline char* GetChars();
- inline uint8_t* GetCharsU();
+ inline uint8_t* GetChars();
// Casting
static inline SeqOneByteString* cast(Object* obj);
@@ -7680,7 +7676,7 @@ class ExternalAsciiString: public ExternalString {
// which the pointer cache has to be refreshed.
inline void update_data_cache();
- inline const char* GetChars();
+ inline const uint8_t* GetChars();
// Dispatched behavior.
inline uint16_t ExternalAsciiStringGet(int index);

Powered by Google App Engine
This is Rietveld 408576698