Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 52b7add58f4f75409c947070bfb2a8e74add2fef..bd544963a590c9a5eff1ed4e869b57b02a2262df 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -5509,6 +5509,9 @@ bool String::IsEqualTo(Vector<const char> str) { |
bool String::IsAsciiEqualTo(Vector<const char> str) { |
int slen = length(); |
if (str.length() != slen) return false; |
+ if (IsFlat() && IsAsciiRepresentation()) { |
Erik Corry
2011/05/24 07:14:07
CompareChars doesn't require that the two strings
|
+ return CompareChars(ToAsciiVector().start(), str.start(), slen) == 0; |
+ } |
for (int i = 0; i < slen; i++) { |
if (Get(i) != static_cast<uint16_t>(str[i])) return false; |
} |
@@ -5519,6 +5522,9 @@ bool String::IsAsciiEqualTo(Vector<const char> str) { |
bool String::IsTwoByteEqualTo(Vector<const uc16> str) { |
int slen = length(); |
if (str.length() != slen) return false; |
+ if (IsFlat() && IsTwoByteRepresentation()) { |
+ return CompareChars(ToUC16Vector().start(), str.start(), slen) == 0; |
+ } |
for (int i = 0; i < slen; i++) { |
if (Get(i) != str[i]) return false; |
} |