Chromium Code Reviews| Index: src/json-stringifier.h |
| diff --git a/src/json-stringifier.h b/src/json-stringifier.h |
| index 418d4794595367f088e09cbb519d65209ff7bd96..355c4fcb1fe9ca170e8d9a1573312afe5b55bbb0 100644 |
| --- a/src/json-stringifier.h |
| +++ b/src/json-stringifier.h |
| @@ -322,15 +322,8 @@ MaybeObject* BasicJsonStringifier::StringifyString_(Isolate* isolate, |
| dest->GetChars() + 1, |
| string->length()); |
| dest->Set(final_size++, '\"'); |
| - if (isolate->heap()->InNewSpace(*result)) { |
| - // In new space, simply lower the allocation top to fit the actual size. |
| - isolate->heap()->new_space()->ShrinkStringAtAllocationBoundary<StringType>( |
| - *result, final_size); |
| - return *result; |
| - } else { |
| - // Not in new space, need to fill the wasted space with filler objects. |
| - return SeqString::cast(*result)->Truncate(final_size); |
| - } |
| + SeqString::cast(*result)->Truncate(final_size); |
| + return *result; |
| } |
| @@ -697,8 +690,11 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSObject( |
| void BasicJsonStringifier::ShrinkCurrentPart() { |
| ASSERT(current_index_ < part_length_); |
| - current_part_ = Handle<String>( |
| - SeqString::cast(*current_part_)->Truncate(current_index_), isolate_); |
| + if (current_index_ == 0) { |
|
Hannes Payer (out of office)
2013/03/21 12:48:30
Again, Truncate() should do the right thing for yo
|
| + current_part_ = isolate_->factory()->empty_string(); |
| + } else { |
| + SeqString::cast(*current_part_)->Truncate(current_index_); |
| + } |
| } |