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

Side by Side Diff: src/preparser.cc

Issue 16549003: Fix crasher when checking for "of", but next token has no literal buffer (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test suite (thanks Michael) Created 7 years, 6 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 | src/scanner.h » ('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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 ParseExpression(true, CHECK_OK); 655 ParseExpression(true, CHECK_OK);
656 Expect(i::Token::RPAREN, CHECK_OK); 656 Expect(i::Token::RPAREN, CHECK_OK);
657 ParseStatement(ok); 657 ParseStatement(ok);
658 return Statement::Default(); 658 return Statement::Default();
659 } 659 }
660 660
661 661
662 bool PreParser::CheckInOrOf() { 662 bool PreParser::CheckInOrOf() {
663 if (peek() == i::Token::IN || 663 if (peek() == i::Token::IN ||
664 (allow_for_of() && 664 (allow_for_of() &&
665 peek() == i::Token::IDENTIFIER &&
665 scanner_->is_next_contextual_keyword(v8::internal::CStrVector("of")))) { 666 scanner_->is_next_contextual_keyword(v8::internal::CStrVector("of")))) {
666 Next(); 667 Next();
667 return true; 668 return true;
668 } 669 }
669 return false; 670 return false;
670 } 671 }
671 672
672 673
673 PreParser::Statement PreParser::ParseForStatement(bool* ok) { 674 PreParser::Statement PreParser::ParseForStatement(bool* ok) {
674 // ForStatement :: 675 // ForStatement ::
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1819 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); 1820 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u));
1820 } 1821 }
1821 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); 1822 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u));
1822 } 1823 }
1823 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); 1824 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f));
1824 1825
1825 backing_store_.AddBlock(bytes); 1826 backing_store_.AddBlock(bytes);
1826 return backing_store_.EndSequence().start(); 1827 return backing_store_.EndSequence().start();
1827 } 1828 }
1828 } } // v8::preparser 1829 } } // v8::preparser
OLDNEW
« no previous file with comments | « no previous file | src/scanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698