int length));
template <bool is_ascii, typename Char>
- INLINE(void SerializeString_(Vector<const Char> vector,
- Handle<String> string));
+ INLINE(void SerializeString_(Handle<String> string));
template <typename Char>
INLINE(bool DoNotEscape(Char c));
template <bool is_ascii, typename Char>
-void BasicJsonStringifier::SerializeString_(Vector<const Char> vector,
- Handle<String> string) {
- int length = vector.length();
+void BasicJsonStringifier::SerializeString_(Handle<String> string) {
+ int length = string->length();
Append_<is_ascii, char>('"');
// We make a rough estimate to find out if the current string can be
// serialized without allocating a new string part. The worst case length of
// is a more pessimistic estimate, but faster to calculate.
if (((part_length_ - current_index_) >> 3) > length) {
+ AssertNoAllocation no_allocation;
+ Vector<const Char> vector = GetCharVector<Char>(string);
if (is_ascii) {
SerializeStringUnchecked_(
vector.start(),
}
} else {
String* string_location = *string;
+ Vector<const Char> vector = GetCharVector<Char>(string);
for (int i = 0; i < length; i++) {
Char c = vector[i];
if (DoNotEscape(c)) {
String::FlatContent flat = object->GetFlatContent();
if (is_ascii_) {
if (flat.IsAscii()) {
- SerializeString_<true, char>(flat.ToAsciiVector(), object);
+ SerializeString_<true, char>(object);
} else {
ChangeEncoding();
SerializeString(object);
}
} else {
if (flat.IsAscii()) {
- SerializeString_<false, char>(flat.ToAsciiVector(), object);
+ SerializeString_<false, char>(object);
} else {
- SerializeString_<false, uc16>(flat.ToUC16Vector(), object);
+ SerializeString_<false, uc16>(object);
}
}
}