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

Unified Diff: src/objects.cc

Issue 11759008: Introduce ENABLE_LATIN_1 compile flag (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix FilterASCII 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
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index a97590ae69dccd09c35868ce7c3c6a1a632a7603..e20d0da8ba06586d050db22aa116449482db6f1d 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -7284,7 +7284,7 @@ bool String::MarkAsUndetectable() {
}
-bool String::IsEqualTo(Vector<const char> str) {
+bool String::IsUtf8EqualTo(Vector<const char> str) {
int slen = length();
// Can't check exact length equality, but we can check bounds.
int str_len = str.length();
@@ -7313,12 +7313,12 @@ bool String::IsEqualTo(Vector<const char> str) {
}
-bool String::IsAsciiEqualTo(Vector<const char> str) {
+bool String::IsOneByteEqualTo(Vector<const uint8_t> str) {
int slen = length();
if (str.length() != slen) return false;
FlatContent content = GetFlatContent();
if (content.IsAscii()) {
- return CompareChars(content.ToAsciiVector().start(),
+ return CompareChars(content.ToOneByteVector().start(),
str.start(), slen) == 0;
}
for (int i = 0; i < slen; i++) {
@@ -11387,7 +11387,7 @@ class Utf8SymbolKey : public HashTableKey {
: string_(string), hash_field_(0), seed_(seed) { }
bool IsMatch(Object* string) {
- return String::cast(string)->IsEqualTo(string_);
+ return String::cast(string)->IsUtf8EqualTo(string_);
}
uint32_t Hash() {
@@ -11404,7 +11404,7 @@ class Utf8SymbolKey : public HashTableKey {
MaybeObject* AsObject() {
if (hash_field_ == 0) Hash();
- return Isolate::Current()->heap()->AllocateSymbol(
+ return Isolate::Current()->heap()->AllocateSymbolFromUtf8(
string_, chars_, hash_field_);
}
@@ -11443,25 +11443,25 @@ class SequentialSymbolKey : public HashTableKey {
-class AsciiSymbolKey : public SequentialSymbolKey<char> {
+class OneByteSymbolKey : public SequentialSymbolKey<uint8_t> {
public:
- AsciiSymbolKey(Vector<const char> str, uint32_t seed)
- : SequentialSymbolKey<char>(str, seed) { }
+ OneByteSymbolKey(Vector<const uint8_t> str, uint32_t seed)
+ : SequentialSymbolKey<uint8_t>(str, seed) { }
bool IsMatch(Object* string) {
- return String::cast(string)->IsAsciiEqualTo(string_);
+ return String::cast(string)->IsOneByteEqualTo(string_);
}
MaybeObject* AsObject() {
if (hash_field_ == 0) Hash();
- return HEAP->AllocateAsciiSymbol(string_, hash_field_);
+ return HEAP->AllocateOneByteSymbol(string_, hash_field_);
}
};
-class SubStringAsciiSymbolKey : public HashTableKey {
+class SubStringOneByteSymbolKey : public HashTableKey {
public:
- explicit SubStringAsciiSymbolKey(Handle<SeqOneByteString> string,
+ explicit SubStringOneByteSymbolKey(Handle<SeqOneByteString> string,
int from,
int length)
: string_(string), from_(from), length_(length) { }
@@ -11483,14 +11483,16 @@ class SubStringAsciiSymbolKey : public HashTableKey {
}
bool IsMatch(Object* string) {
- Vector<const char> chars(string_->GetChars() + from_, length_);
- return String::cast(string)->IsAsciiEqualTo(chars);
+ Vector<const uint8_t> chars(string_->GetCharsU() + from_, length_);
+ return String::cast(string)->IsOneByteEqualTo(chars);
}
MaybeObject* AsObject() {
if (hash_field_ == 0) Hash();
- Vector<const char> chars(string_->GetChars() + from_, length_);
- return HEAP->AllocateAsciiSymbol(chars, hash_field_);
+ Vector<const uint8_t> chars(
+ reinterpret_cast<uint8_t*>(string_->GetChars()) + from_,
+ length_);
+ return HEAP->AllocateOneByteSymbol(chars, hash_field_);
}
private:
@@ -12410,9 +12412,9 @@ MaybeObject* SymbolTable::LookupUtf8Symbol(Vector<const char> str,
}
-MaybeObject* SymbolTable::LookupOneByteSymbol(Vector<const char> str,
+MaybeObject* SymbolTable::LookupOneByteSymbol(Vector<const uint8_t> str,
Object** s) {
- AsciiSymbolKey key(str, GetHeap()->HashSeed());
+ OneByteSymbolKey key(str, GetHeap()->HashSeed());
return LookupKey(&key, s);
}
@@ -12422,7 +12424,7 @@ MaybeObject* SymbolTable::LookupSubStringOneByteSymbol(
int from,
int length,
Object** s) {
- SubStringAsciiSymbolKey key(str, from, length);
+ SubStringOneByteSymbolKey key(str, from, length);
return LookupKey(&key, s);
}
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698