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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 // string, return with an empty handle. | 570 // string, return with an empty handle. |
571 uint32_t running_hash = isolate()->heap()->HashSeed(); | 571 uint32_t running_hash = isolate()->heap()->HashSeed(); |
572 int position = position_; | 572 int position = position_; |
573 uc32 c0 = c0_; | 573 uc32 c0 = c0_; |
574 do { | 574 do { |
575 if (c0 == '\\') { | 575 if (c0 == '\\') { |
576 return SlowScanJsonString<SeqAsciiString, char>(source_, | 576 return SlowScanJsonString<SeqAsciiString, char>(source_, |
577 position_, | 577 position_, |
578 position); | 578 position); |
579 } | 579 } |
| 580 if (c0_ < 0x20) return Handle<String>::null(); |
580 running_hash = StringHasher::AddCharacterCore(running_hash, c0); | 581 running_hash = StringHasher::AddCharacterCore(running_hash, c0); |
581 position++; | 582 position++; |
582 if (position > source_length_) return Handle<String>::null(); | 583 if (position > source_length_) return Handle<String>::null(); |
583 c0 = seq_source_->SeqAsciiStringGet(position); | 584 c0 = seq_source_->SeqAsciiStringGet(position); |
584 } while (c0 != '"'); | 585 } while (c0 != '"'); |
585 int length = position - position_; | 586 int length = position - position_; |
586 uint32_t hash = (length <= String::kMaxHashCalcLength) | 587 uint32_t hash = (length <= String::kMaxHashCalcLength) |
587 ? StringHasher::GetHashCore(running_hash) : length; | 588 ? StringHasher::GetHashCore(running_hash) : length; |
588 Vector<const char> string_vector( | 589 Vector<const char> string_vector( |
589 seq_source_->GetChars() + position_, length); | 590 seq_source_->GetChars() + position_, length); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 } | 642 } |
642 ASSERT_EQ('"', c0_); | 643 ASSERT_EQ('"', c0_); |
643 // Advance past the last '"'. | 644 // Advance past the last '"'. |
644 AdvanceSkipWhitespace(); | 645 AdvanceSkipWhitespace(); |
645 return result; | 646 return result; |
646 } | 647 } |
647 | 648 |
648 } } // namespace v8::internal | 649 } } // namespace v8::internal |
649 | 650 |
650 #endif // V8_JSON_PARSER_H_ | 651 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |