Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: src/json-parser.h

Issue 11198068: Fixed error introduced in r12761. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2373.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 Advance(); 393 Advance();
394 negative = true; 394 negative = true;
395 } 395 }
396 if (c0_ == '0') { 396 if (c0_ == '0') {
397 Advance(); 397 Advance();
398 // Prefix zero is only allowed if it's the only digit before 398 // Prefix zero is only allowed if it's the only digit before
399 // a decimal point or exponent. 399 // a decimal point or exponent.
400 if ('0' <= c0_ && c0_ <= '9') return ReportUnexpectedCharacter(); 400 if ('0' <= c0_ && c0_ <= '9') return ReportUnexpectedCharacter();
401 } else { 401 } else {
402 int i = 0; 402 int i = 0;
403 int digits = 0;
403 if (c0_ < '1' || c0_ > '9') return ReportUnexpectedCharacter(); 404 if (c0_ < '1' || c0_ > '9') return ReportUnexpectedCharacter();
404 do { 405 do {
405 i = i * 10 + c0_ - '0'; 406 i = i * 10 + c0_ - '0';
407 digits++;
406 Advance(); 408 Advance();
407 } while (c0_ >= '0' && c0_ <= '9' && i <= (kMaxInt - 9) / 10); 409 } while (c0_ >= '0' && c0_ <= '9');
408 if (c0_ != '.' && c0_ != 'e' && c0_ != 'E') { 410 if (c0_ != '.' && c0_ != 'e' && c0_ != 'E' && digits < 10) {
409 SkipWhitespace(); 411 SkipWhitespace();
410 return Handle<Smi>(Smi::FromInt((negative ? -i : i)), isolate()); 412 return Handle<Smi>(Smi::FromInt((negative ? -i : i)), isolate());
411 } 413 }
412 } 414 }
413 if (c0_ == '.') { 415 if (c0_ == '.') {
414 Advance(); 416 Advance();
415 if (c0_ < '0' || c0_ > '9') return ReportUnexpectedCharacter(); 417 if (c0_ < '0' || c0_ > '9') return ReportUnexpectedCharacter();
416 do { 418 do {
417 Advance(); 419 Advance();
418 } while (c0_ >= '0' && c0_ <= '9'); 420 } while (c0_ >= '0' && c0_ <= '9');
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 } 678 }
677 ASSERT_EQ('"', c0_); 679 ASSERT_EQ('"', c0_);
678 // Advance past the last '"'. 680 // Advance past the last '"'.
679 AdvanceSkipWhitespace(); 681 AdvanceSkipWhitespace();
680 return result; 682 return result;
681 } 683 }
682 684
683 } } // namespace v8::internal 685 } } // namespace v8::internal
684 686
685 #endif // V8_JSON_PARSER_H_ 687 #endif // V8_JSON_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2373.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698