| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 if (c0_ < '0' || c0_ > '9') return ReportUnexpectedCharacter(); | 532 if (c0_ < '0' || c0_ > '9') return ReportUnexpectedCharacter(); |
| 533 do { | 533 do { |
| 534 Advance(); | 534 Advance(); |
| 535 } while (c0_ >= '0' && c0_ <= '9'); | 535 } while (c0_ >= '0' && c0_ <= '9'); |
| 536 } | 536 } |
| 537 int length = position_ - beg_pos; | 537 int length = position_ - beg_pos; |
| 538 double number; | 538 double number; |
| 539 if (seq_ascii) { | 539 if (seq_ascii) { |
| 540 Vector<const uint8_t> chars(seq_source_->GetChars() + beg_pos, length); | 540 Vector<const uint8_t> chars(seq_source_->GetChars() + beg_pos, length); |
| 541 number = StringToDouble(isolate()->unicode_cache(), | 541 number = StringToDouble(isolate()->unicode_cache(), |
| 542 Vector<const char>::cast(chars), | 542 chars, |
| 543 NO_FLAGS, // Hex, octal or trailing junk. | 543 NO_FLAGS, // Hex, octal or trailing junk. |
| 544 OS::nan_value()); | 544 OS::nan_value()); |
| 545 } else { | 545 } else { |
| 546 Vector<uint8_t> buffer = Vector<uint8_t>::New(length); | 546 Vector<uint8_t> buffer = Vector<uint8_t>::New(length); |
| 547 String::WriteToFlat(*source_, buffer.start(), beg_pos, position_); | 547 String::WriteToFlat(*source_, buffer.start(), beg_pos, position_); |
| 548 Vector<const uint8_t> result = | 548 Vector<const uint8_t> result = |
| 549 Vector<const uint8_t>(buffer.start(), length); | 549 Vector<const uint8_t>(buffer.start(), length); |
| 550 number = StringToDouble(isolate()->unicode_cache(), | 550 number = StringToDouble(isolate()->unicode_cache(), |
| 551 // TODO(dcarney): Convert StringToDouble to uint_t. | 551 result, |
| 552 Vector<const char>::cast(result), | |
| 553 NO_FLAGS, // Hex, octal or trailing junk. | 552 NO_FLAGS, // Hex, octal or trailing junk. |
| 554 0.0); | 553 0.0); |
| 555 buffer.Dispose(); | 554 buffer.Dispose(); |
| 556 } | 555 } |
| 557 SkipWhitespace(); | 556 SkipWhitespace(); |
| 558 return factory()->NewNumber(number, pretenure_); | 557 return factory()->NewNumber(number, pretenure_); |
| 559 } | 558 } |
| 560 | 559 |
| 561 | 560 |
| 562 template <typename StringType> | 561 template <typename StringType> |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 | 796 |
| 798 ASSERT_EQ('"', c0_); | 797 ASSERT_EQ('"', c0_); |
| 799 // Advance past the last '"'. | 798 // Advance past the last '"'. |
| 800 AdvanceSkipWhitespace(); | 799 AdvanceSkipWhitespace(); |
| 801 return result; | 800 return result; |
| 802 } | 801 } |
| 803 | 802 |
| 804 } } // namespace v8::internal | 803 } } // namespace v8::internal |
| 805 | 804 |
| 806 #endif // V8_JSON_PARSER_H_ | 805 #endif // V8_JSON_PARSER_H_ |
| OLD | NEW |