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

Unified Diff: src/objects-inl.h

Issue 756983003: Force inline Stirng::GetCharVector<>. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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/runtime/runtime-uri.cc » ('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 0a85a137d8b6507e13e3263a4729c2fbd2cce2ef..004b941cff4208694f812f7f01a8b929b1bcb452 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -3581,6 +3581,22 @@ ConsString* String::VisitFlat(Visitor* visitor,
}
+template <>
+inline Vector<const uint8_t> String::GetCharVector() {
+ String::FlatContent flat = GetFlatContent();
+ DCHECK(flat.IsOneByte());
+ return flat.ToOneByteVector();
+}
+
+
+template <>
+inline Vector<const uc16> String::GetCharVector() {
+ String::FlatContent flat = GetFlatContent();
+ DCHECK(flat.IsTwoByte());
+ return flat.ToUC16Vector();
+}
+
+
uint16_t SeqOneByteString::SeqOneByteStringGet(int index) {
DCHECK(index >= 0 && index < length());
return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-uri.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698