Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index a26da7dd62994c73df4544545b4b2d6121def9f4..6d7bad751210ef2855ea8031c5f197684077f074 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -255,6 +255,16 @@ bool String::IsTwoByteRepresentation() { |
} |
+bool String::IsExternalTwoByteStringWithAsciiChars() { |
+ if (!IsExternalTwoByteString()) return false; |
+ const uc16* data = ExternalTwoByteString::cast(this)->resource()->data(); |
+ for (int i = 0, len = length(); i < len; i++) { |
+ if (data[i] > kMaxAsciiCharCode) return false; |
+ } |
+ return true; |
+} |
+ |
+ |
bool StringShape::IsCons() { |
return (type_ & kStringRepresentationMask) == kConsStringTag; |
} |