summaryrefslogtreecommitdiffstats
path: root/js/src/vm/StringBuffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/vm/StringBuffer.h')
-rw-r--r--js/src/vm/StringBuffer.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/js/src/vm/StringBuffer.h b/js/src/vm/StringBuffer.h
index f2437384a..502a3bc6f 100644
--- a/js/src/vm/StringBuffer.h
+++ b/js/src/vm/StringBuffer.h
@@ -61,12 +61,8 @@ class StringBuffer
MOZ_ALWAYS_INLINE bool isLatin1() const { return cb.constructed<Latin1CharBuffer>(); }
MOZ_ALWAYS_INLINE bool isTwoByte() const { return !isLatin1(); }
- MOZ_ALWAYS_INLINE Latin1CharBuffer& latin1Chars() { return cb.ref<Latin1CharBuffer>(); }
MOZ_ALWAYS_INLINE TwoByteCharBuffer& twoByteChars() { return cb.ref<TwoByteCharBuffer>(); }
- MOZ_ALWAYS_INLINE const Latin1CharBuffer& latin1Chars() const {
- return cb.ref<Latin1CharBuffer>();
- }
MOZ_ALWAYS_INLINE const TwoByteCharBuffer& twoByteChars() const {
return cb.ref<TwoByteCharBuffer>();
}
@@ -84,6 +80,12 @@ class StringBuffer
cb.construct<Latin1CharBuffer>(cx);
}
+ MOZ_ALWAYS_INLINE Latin1CharBuffer& latin1Chars() { return cb.ref<Latin1CharBuffer>(); }
+
+ MOZ_ALWAYS_INLINE const Latin1CharBuffer& latin1Chars() const {
+ return cb.ref<Latin1CharBuffer>();
+ }
+
void clear() {
if (isLatin1())
latin1Chars().clear();
@@ -134,6 +136,11 @@ class StringBuffer
return append(Latin1Char(c));
}
+ TwoByteCharBuffer& rawTwoByteBuffer() {
+ MOZ_ASSERT(hasEnsuredTwoByteChars_);
+ return twoByteChars();
+ }
+
inline MOZ_MUST_USE bool append(const char16_t* begin, const char16_t* end);
MOZ_MUST_USE bool append(const char16_t* chars, size_t len) {