OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_PARSING_JSON_PARSER_H_ | 5 #ifndef V8_PARSING_JSON_PARSER_H_ |
6 #define V8_PARSING_JSON_PARSER_H_ | 6 #define V8_PARSING_JSON_PARSER_H_ |
7 | 7 |
8 #include "src/char-predicates.h" | 8 #include "src/char-predicates.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 do { | 754 do { |
755 if (c0 == '\\') { | 755 if (c0 == '\\') { |
756 c0_ = c0; | 756 c0_ = c0; |
757 int beg_pos = position_; | 757 int beg_pos = position_; |
758 position_ = position; | 758 position_ = position; |
759 return SlowScanJsonString<SeqOneByteString, uint8_t>(source_, | 759 return SlowScanJsonString<SeqOneByteString, uint8_t>(source_, |
760 beg_pos, | 760 beg_pos, |
761 position_); | 761 position_); |
762 } | 762 } |
763 if (c0 < 0x20) return Handle<String>::null(); | 763 if (c0 < 0x20) return Handle<String>::null(); |
764 if (static_cast<uint32_t>(c0) > | 764 running_hash = StringHasher::AddCharacterCore(running_hash, |
765 unibrow::Utf16::kMaxNonSurrogateCharCode) { | 765 static_cast<uint16_t>(c0)); |
766 running_hash = | |
767 StringHasher::AddCharacterCore(running_hash, | |
768 unibrow::Utf16::LeadSurrogate(c0)); | |
769 running_hash = | |
770 StringHasher::AddCharacterCore(running_hash, | |
771 unibrow::Utf16::TrailSurrogate(c0)); | |
772 } else { | |
773 running_hash = StringHasher::AddCharacterCore(running_hash, c0); | |
774 } | |
775 position++; | 766 position++; |
776 if (position >= source_length_) return Handle<String>::null(); | 767 if (position >= source_length_) return Handle<String>::null(); |
777 c0 = seq_source_->SeqOneByteStringGet(position); | 768 c0 = seq_source_->SeqOneByteStringGet(position); |
778 } while (c0 != '"'); | 769 } while (c0 != '"'); |
779 int length = position - position_; | 770 int length = position - position_; |
780 uint32_t hash = (length <= String::kMaxHashCalcLength) | 771 uint32_t hash = (length <= String::kMaxHashCalcLength) |
781 ? StringHasher::GetHashCore(running_hash) | 772 ? StringHasher::GetHashCore(running_hash) |
782 : static_cast<uint32_t>(length); | 773 : static_cast<uint32_t>(length); |
783 Vector<const uint8_t> string_vector( | 774 Vector<const uint8_t> string_vector( |
784 seq_source_->GetChars() + position_, length); | 775 seq_source_->GetChars() + position_, length); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 DCHECK_EQ('"', c0_); | 833 DCHECK_EQ('"', c0_); |
843 // Advance past the last '"'. | 834 // Advance past the last '"'. |
844 AdvanceSkipWhitespace(); | 835 AdvanceSkipWhitespace(); |
845 return result; | 836 return result; |
846 } | 837 } |
847 | 838 |
848 } // namespace internal | 839 } // namespace internal |
849 } // namespace v8 | 840 } // namespace v8 |
850 | 841 |
851 #endif // V8_PARSING_JSON_PARSER_H_ | 842 #endif // V8_PARSING_JSON_PARSER_H_ |
OLD | NEW |