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

Side by Side Diff: src/json-parser.cc

Issue 7084023: Correctly set the length of string before creating filler object in the json parser (fixes crbug ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 if (isolate()->heap()->InNewSpace(*seq_two_byte)) { 446 if (isolate()->heap()->InNewSpace(*seq_two_byte)) {
447 isolate()->heap()->new_space()-> 447 isolate()->heap()->new_space()->
448 ShrinkStringAtAllocationBoundary<SeqTwoByteString>(*seq_two_byte, 448 ShrinkStringAtAllocationBoundary<SeqTwoByteString>(*seq_two_byte,
449 count); 449 count);
450 } else { 450 } else {
451 int string_size = SeqTwoByteString::SizeFor(count); 451 int string_size = SeqTwoByteString::SizeFor(count);
452 int allocated_string_size = 452 int allocated_string_size =
453 SeqTwoByteString::SizeFor(kInitialSpecialStringSize * allocation_count); 453 SeqTwoByteString::SizeFor(kInitialSpecialStringSize * allocation_count);
454 int delta = allocated_string_size - string_size; 454 int delta = allocated_string_size - string_size;
455 Address start_filler_object = seq_two_byte->address() + string_size; 455 Address start_filler_object = seq_two_byte->address() + string_size;
456 seq_two_byte->set_length(count);
456 isolate()->heap()->CreateFillerObjectAt(start_filler_object, delta); 457 isolate()->heap()->CreateFillerObjectAt(start_filler_object, delta);
457 } 458 }
458 string_val_ = isolate()->factory()->NewConsString(ascii, seq_two_byte); 459 string_val_ = isolate()->factory()->NewConsString(ascii, seq_two_byte);
459 return Token::STRING; 460 return Token::STRING;
460 } 461 }
461 462
462 463
463 Token::Value JsonParser::ScanJsonString() { 464 Token::Value JsonParser::ScanJsonString() {
464 ASSERT_EQ('"', c0_); 465 ASSERT_EQ('"', c0_);
465 // Set string_val to null. If string_val is not set we assume an 466 // Set string_val to null. If string_val is not set we assume an
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 return isolate()->factory()->LookupAsciiSymbol(seq_source_, 504 return isolate()->factory()->LookupAsciiSymbol(seq_source_,
504 current_.beg_pos + 1, 505 current_.beg_pos + 1,
505 length); 506 length);
506 } 507 }
507 // The current token includes the '"' in both ends. 508 // The current token includes the '"' in both ends.
508 return isolate()->factory()->NewSubString( 509 return isolate()->factory()->NewSubString(
509 source_, current_.beg_pos + 1, current_.end_pos - 1); 510 source_, current_.beg_pos + 1, current_.end_pos - 1);
510 } 511 }
511 512
512 } } // namespace v8::internal 513 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-84186.js » ('j') | test/mjsunit/regress/regress-crbug-84186.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698