OLD | NEW |
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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 | 573 |
574 if (seq_ascii && is_symbol) { | 574 if (seq_ascii && is_symbol) { |
575 // Fast path for existing symbols. If the the string being parsed is not | 575 // Fast path for existing symbols. If the the string being parsed is not |
576 // a known symbol, contains backslashes or unexpectedly reaches the end of | 576 // a known symbol, contains backslashes or unexpectedly reaches the end of |
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 c0_ = c0; |
| 584 int beg_pos = position_; |
| 585 position_ = position; |
583 return SlowScanJsonString<SeqAsciiString, char>(source_, | 586 return SlowScanJsonString<SeqAsciiString, char>(source_, |
584 position_, | 587 beg_pos, |
585 position); | 588 position_); |
586 } | 589 } |
587 if (c0 < 0x20) return Handle<String>::null(); | 590 if (c0 < 0x20) return Handle<String>::null(); |
588 running_hash = StringHasher::AddCharacterCore(running_hash, c0); | 591 running_hash = StringHasher::AddCharacterCore(running_hash, c0); |
589 position++; | 592 position++; |
590 if (position >= source_length_) return Handle<String>::null(); | 593 if (position >= source_length_) return Handle<String>::null(); |
591 c0 = seq_source_->SeqAsciiStringGet(position); | 594 c0 = seq_source_->SeqAsciiStringGet(position); |
592 } while (c0 != '"'); | 595 } while (c0 != '"'); |
593 int length = position - position_; | 596 int length = position - position_; |
594 uint32_t hash = (length <= String::kMaxHashCalcLength) | 597 uint32_t hash = (length <= String::kMaxHashCalcLength) |
595 ? StringHasher::GetHashCore(running_hash) : length; | 598 ? StringHasher::GetHashCore(running_hash) : length; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 } | 652 } |
650 ASSERT_EQ('"', c0_); | 653 ASSERT_EQ('"', c0_); |
651 // Advance past the last '"'. | 654 // Advance past the last '"'. |
652 AdvanceSkipWhitespace(); | 655 AdvanceSkipWhitespace(); |
653 return result; | 656 return result; |
654 } | 657 } |
655 | 658 |
656 } } // namespace v8::internal | 659 } } // namespace v8::internal |
657 | 660 |
658 #endif // V8_JSON_PARSER_H_ | 661 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |