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

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

Issue 11191055: Fix typo in fast path for scanning json strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 // string, return with an empty handle. 577 // string, return with an empty handle.
578 uint32_t running_hash = isolate()->heap()->HashSeed(); 578 uint32_t running_hash = isolate()->heap()->HashSeed();
579 int position = position_; 579 int position = position_;
580 uc32 c0 = c0_; 580 uc32 c0 = c0_;
581 do { 581 do {
582 if (c0 == '\\') { 582 if (c0 == '\\') {
583 return SlowScanJsonString<SeqAsciiString, char>(source_, 583 return SlowScanJsonString<SeqAsciiString, char>(source_,
584 position_, 584 position_,
585 position); 585 position);
586 } 586 }
587 if (c0_ < 0x20) return Handle<String>::null(); 587 if (c0 < 0x20) return Handle<String>::null();
588 running_hash = StringHasher::AddCharacterCore(running_hash, c0); 588 running_hash = StringHasher::AddCharacterCore(running_hash, c0);
589 position++; 589 position++;
590 if (position >= source_length_) return Handle<String>::null(); 590 if (position >= source_length_) return Handle<String>::null();
591 c0 = seq_source_->SeqAsciiStringGet(position); 591 c0 = seq_source_->SeqAsciiStringGet(position);
592 } while (c0 != '"'); 592 } while (c0 != '"');
593 int length = position - position_; 593 int length = position - position_;
594 uint32_t hash = (length <= String::kMaxHashCalcLength) 594 uint32_t hash = (length <= String::kMaxHashCalcLength)
595 ? StringHasher::GetHashCore(running_hash) : length; 595 ? StringHasher::GetHashCore(running_hash) : length;
596 Vector<const char> string_vector( 596 Vector<const char> string_vector(
597 seq_source_->GetChars() + position_, length); 597 seq_source_->GetChars() + position_, length);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 } 649 }
650 ASSERT_EQ('"', c0_); 650 ASSERT_EQ('"', c0_);
651 // Advance past the last '"'. 651 // Advance past the last '"'.
652 AdvanceSkipWhitespace(); 652 AdvanceSkipWhitespace();
653 return result; 653 return result;
654 } 654 }
655 655
656 } } // namespace v8::internal 656 } } // namespace v8::internal
657 657
658 #endif // V8_JSON_PARSER_H_ 658 #endif // V8_JSON_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698