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

Unified Diff: src/objects-inl.h

Issue 1444001: Some string optimizations: (Closed)
Patch Set: Review fix. Created 10 years, 9 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.cc ('k') | src/v8-counters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/objects.cc ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698