| 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_JSON_PARSER_H_ | 5 #ifndef V8_JSON_PARSER_H_ |
| 6 #define V8_JSON_PARSER_H_ | 6 #define V8_JSON_PARSER_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/char-predicates-inl.h" | 10 #include "src/char-predicates-inl.h" |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 if (c0_ == '-' || c0_ == '+') Advance(); | 546 if (c0_ == '-' || c0_ == '+') Advance(); |
| 547 if (c0_ < '0' || c0_ > '9') return ReportUnexpectedCharacter(); | 547 if (c0_ < '0' || c0_ > '9') return ReportUnexpectedCharacter(); |
| 548 do { | 548 do { |
| 549 Advance(); | 549 Advance(); |
| 550 } while (c0_ >= '0' && c0_ <= '9'); | 550 } while (c0_ >= '0' && c0_ <= '9'); |
| 551 } | 551 } |
| 552 int length = position_ - beg_pos; | 552 int length = position_ - beg_pos; |
| 553 double number; | 553 double number; |
| 554 if (seq_one_byte) { | 554 if (seq_one_byte) { |
| 555 Vector<const uint8_t> chars(seq_source_->GetChars() + beg_pos, length); | 555 Vector<const uint8_t> chars(seq_source_->GetChars() + beg_pos, length); |
| 556 number = StringToDouble(isolate()->unicode_cache(), | 556 number = StringToDouble(isolate()->unicode_cache(), chars, |
| 557 chars, | |
| 558 NO_FLAGS, // Hex, octal or trailing junk. | 557 NO_FLAGS, // Hex, octal or trailing junk. |
| 559 base::OS::nan_value()); | 558 std::numeric_limits<double>::quiet_NaN()); |
| 560 } else { | 559 } else { |
| 561 Vector<uint8_t> buffer = Vector<uint8_t>::New(length); | 560 Vector<uint8_t> buffer = Vector<uint8_t>::New(length); |
| 562 String::WriteToFlat(*source_, buffer.start(), beg_pos, position_); | 561 String::WriteToFlat(*source_, buffer.start(), beg_pos, position_); |
| 563 Vector<const uint8_t> result = | 562 Vector<const uint8_t> result = |
| 564 Vector<const uint8_t>(buffer.start(), length); | 563 Vector<const uint8_t>(buffer.start(), length); |
| 565 number = StringToDouble(isolate()->unicode_cache(), | 564 number = StringToDouble(isolate()->unicode_cache(), |
| 566 result, | 565 result, |
| 567 NO_FLAGS, // Hex, octal or trailing junk. | 566 NO_FLAGS, // Hex, octal or trailing junk. |
| 568 0.0); | 567 0.0); |
| 569 buffer.Dispose(); | 568 buffer.Dispose(); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 811 |
| 813 DCHECK_EQ('"', c0_); | 812 DCHECK_EQ('"', c0_); |
| 814 // Advance past the last '"'. | 813 // Advance past the last '"'. |
| 815 AdvanceSkipWhitespace(); | 814 AdvanceSkipWhitespace(); |
| 816 return result; | 815 return result; |
| 817 } | 816 } |
| 818 | 817 |
| 819 } } // namespace v8::internal | 818 } } // namespace v8::internal |
| 820 | 819 |
| 821 #endif // V8_JSON_PARSER_H_ | 820 #endif // V8_JSON_PARSER_H_ |
| OLD | NEW |