Chromium Code Reviews| Index: src/json-parser.h |
| diff --git a/src/json-parser.h b/src/json-parser.h |
| index 28ef8b33c8be019fb465830650d48bf41c40b23b..be0c86a7b035fe9fd01db25dac656f754935863c 100644 |
| --- a/src/json-parser.h |
| +++ b/src/json-parser.h |
| @@ -580,22 +580,16 @@ Handle<String> JsonParser<seq_ascii>::SlowScanJsonString( |
| Advance(); |
| } |
| } |
| - // Shrink seq_string length to count. |
| - if (isolate()->heap()->InNewSpace(*seq_str)) { |
| - isolate()->heap()->new_space()-> |
| - template ShrinkStringAtAllocationBoundary<StringType>( |
| - *seq_str, count); |
| - } else { |
| - int string_size = StringType::SizeFor(count); |
| - int allocated_string_size = StringType::SizeFor(length); |
| - int delta = allocated_string_size - string_size; |
| - Address start_filler_object = seq_str->address() + string_size; |
| - seq_str->set_length(count); |
| - isolate()->heap()->CreateFillerObjectAt(start_filler_object, delta); |
| - } |
| + |
| ASSERT_EQ('"', c0_); |
| // Advance past the last '"'. |
| AdvanceSkipWhitespace(); |
| + |
| + // Shrink seq_string length to count and return. |
|
Hannes Payer (out of office)
2013/03/21 12:48:30
See comment in src/objects.h. I would let Truncate
|
| + if (count == 0) { |
| + return isolate_->factory()->empty_string(); |
| + } |
| + SeqString::cast(*seq_str)->Truncate(count); |
| return seq_str; |
| } |
| @@ -623,8 +617,8 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() { |
| int beg_pos = position_; |
| position_ = position; |
| return SlowScanJsonString<SeqOneByteString, uint8_t>(source_, |
| - beg_pos, |
| - position_); |
| + beg_pos, |
| + position_); |
| } |
| if (c0 < 0x20) return Handle<String>::null(); |
| if (static_cast<uint32_t>(c0) > |