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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 0.0); | 406 0.0); |
407 buffer.Dispose(); | 407 buffer.Dispose(); |
408 } | 408 } |
409 SkipWhitespace(); | 409 SkipWhitespace(); |
410 return isolate()->factory()->NewNumber(number); | 410 return isolate()->factory()->NewNumber(number); |
411 } | 411 } |
412 | 412 |
413 template <bool seq_ascii> | 413 template <bool seq_ascii> |
414 Handle<String> JsonParser<seq_ascii>::SlowScanJsonString(int beg_pos) { | 414 Handle<String> JsonParser<seq_ascii>::SlowScanJsonString(int beg_pos) { |
415 // The currently scanned ascii characters. | 415 // The currently scanned ascii characters. |
416 Handle<String> ascii(isolate()->factory()->NewStrictSubString(source_, | 416 Handle<String> ascii(isolate()->factory()->NewProperSubString(source_, |
417 beg_pos, | 417 beg_pos, |
418 position_)); | 418 position_)); |
419 Handle<String> two_byte = | 419 Handle<String> two_byte = |
420 isolate()->factory()->NewRawTwoByteString(kInitialSpecialStringSize, | 420 isolate()->factory()->NewRawTwoByteString(kInitialSpecialStringSize, |
421 NOT_TENURED); | 421 NOT_TENURED); |
422 Handle<SeqTwoByteString> seq_two_byte = | 422 Handle<SeqTwoByteString> seq_two_byte = |
423 Handle<SeqTwoByteString>::cast(two_byte); | 423 Handle<SeqTwoByteString>::cast(two_byte); |
424 | 424 |
425 int allocation_count = 1; | 425 int allocation_count = 1; |
426 int count = 0; | 426 int count = 0; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 } | 525 } |
526 ASSERT_EQ('"', c0_); | 526 ASSERT_EQ('"', c0_); |
527 int end_pos = position_; | 527 int end_pos = position_; |
528 // Advance past the last '"'. | 528 // Advance past the last '"'. |
529 AdvanceSkipWhitespace(); | 529 AdvanceSkipWhitespace(); |
530 if (seq_ascii && is_symbol) { | 530 if (seq_ascii && is_symbol) { |
531 return isolate()->factory()->LookupAsciiSymbol(seq_source_, | 531 return isolate()->factory()->LookupAsciiSymbol(seq_source_, |
532 beg_pos, | 532 beg_pos, |
533 end_pos - beg_pos); | 533 end_pos - beg_pos); |
534 } else { | 534 } else { |
535 return isolate()->factory()->NewStrictSubString(source_, | 535 return isolate()->factory()->NewProperSubString(source_, |
536 beg_pos, | 536 beg_pos, |
537 end_pos); | 537 end_pos); |
538 } | 538 } |
539 } | 539 } |
540 | 540 |
541 } } // namespace v8::internal | 541 } } // namespace v8::internal |
542 | 542 |
543 #endif // V8_JSON_PARSER_H_ | 543 #endif // V8_JSON_PARSER_H_ |
OLD | NEW |