| 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 do { | 624 do { |
| 625 if (c0 == '\\') { | 625 if (c0 == '\\') { |
| 626 c0_ = c0; | 626 c0_ = c0; |
| 627 int beg_pos = position_; | 627 int beg_pos = position_; |
| 628 position_ = position; | 628 position_ = position; |
| 629 return SlowScanJsonString<SeqOneByteString, char>(source_, | 629 return SlowScanJsonString<SeqOneByteString, char>(source_, |
| 630 beg_pos, | 630 beg_pos, |
| 631 position_); | 631 position_); |
| 632 } | 632 } |
| 633 if (c0 < 0x20) return Handle<String>::null(); | 633 if (c0 < 0x20) return Handle<String>::null(); |
| 634 running_hash = StringHasher::AddCharacterCore(running_hash, c0); | 634 if (static_cast<uint32_t>(c0) > |
| 635 unibrow::Utf16::kMaxNonSurrogateCharCode) { |
| 636 running_hash = |
| 637 StringHasher::AddCharacterCore(running_hash, |
| 638 unibrow::Utf16::LeadSurrogate(c0)); |
| 639 running_hash = |
| 640 StringHasher::AddCharacterCore(running_hash, |
| 641 unibrow::Utf16::TrailSurrogate(c0)); |
| 642 } else { |
| 643 running_hash = StringHasher::AddCharacterCore(running_hash, c0); |
| 644 } |
| 635 position++; | 645 position++; |
| 636 if (position >= source_length_) return Handle<String>::null(); | 646 if (position >= source_length_) return Handle<String>::null(); |
| 637 c0 = seq_source_->SeqOneByteStringGet(position); | 647 c0 = seq_source_->SeqOneByteStringGet(position); |
| 638 } while (c0 != '"'); | 648 } while (c0 != '"'); |
| 639 int length = position - position_; | 649 int length = position - position_; |
| 640 uint32_t hash = (length <= String::kMaxHashCalcLength) | 650 uint32_t hash = (length <= String::kMaxHashCalcLength) |
| 641 ? StringHasher::GetHashCore(running_hash) : length; | 651 ? StringHasher::GetHashCore(running_hash) : length; |
| 642 Vector<const char> string_vector( | 652 Vector<const char> string_vector( |
| 643 seq_source_->GetChars() + position_, length); | 653 seq_source_->GetChars() + position_, length); |
| 644 SymbolTable* symbol_table = isolate()->heap()->symbol_table(); | 654 SymbolTable* symbol_table = isolate()->heap()->symbol_table(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 } | 705 } |
| 696 ASSERT_EQ('"', c0_); | 706 ASSERT_EQ('"', c0_); |
| 697 // Advance past the last '"'. | 707 // Advance past the last '"'. |
| 698 AdvanceSkipWhitespace(); | 708 AdvanceSkipWhitespace(); |
| 699 return result; | 709 return result; |
| 700 } | 710 } |
| 701 | 711 |
| 702 } } // namespace v8::internal | 712 } } // namespace v8::internal |
| 703 | 713 |
| 704 #endif // V8_JSON_PARSER_H_ | 714 #endif // V8_JSON_PARSER_H_ |
| OLD | NEW |