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

Side by Side Diff: src/parser.cc

Issue 9159043: Fix handling of 'c: if (0) break c; else ()' where a parser optimization (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 10 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-1924.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2121 Expect(Token::BREAK, CHECK_OK); 2121 Expect(Token::BREAK, CHECK_OK);
2122 Handle<String> label; 2122 Handle<String> label;
2123 Token::Value tok = peek(); 2123 Token::Value tok = peek();
2124 if (!scanner().HasAnyLineTerminatorBeforeNext() && 2124 if (!scanner().HasAnyLineTerminatorBeforeNext() &&
2125 tok != Token::SEMICOLON && tok != Token::RBRACE && tok != Token::EOS) { 2125 tok != Token::SEMICOLON && tok != Token::RBRACE && tok != Token::EOS) {
2126 label = ParseIdentifier(CHECK_OK); 2126 label = ParseIdentifier(CHECK_OK);
2127 } 2127 }
2128 // Parse labeled break statements that target themselves into 2128 // Parse labeled break statements that target themselves into
2129 // empty statements, e.g. 'l1: l2: l3: break l2;' 2129 // empty statements, e.g. 'l1: l2: l3: break l2;'
2130 if (!label.is_null() && ContainsLabel(labels, label)) { 2130 if (!label.is_null() && ContainsLabel(labels, label)) {
2131 ExpectSemicolon(CHECK_OK);
2131 return EmptyStatement(); 2132 return EmptyStatement();
2132 } 2133 }
2133 BreakableStatement* target = NULL; 2134 BreakableStatement* target = NULL;
2134 target = LookupBreakTarget(label, CHECK_OK); 2135 target = LookupBreakTarget(label, CHECK_OK);
2135 if (target == NULL) { 2136 if (target == NULL) {
2136 // Illegal break statement. 2137 // Illegal break statement.
2137 const char* message = "illegal_break"; 2138 const char* message = "illegal_break";
2138 Vector<Handle<String> > args; 2139 Vector<Handle<String> > args;
2139 if (!label.is_null()) { 2140 if (!label.is_null()) {
2140 message = "unknown_label"; 2141 message = "unknown_label";
(...skipping 3548 matching lines...) Expand 10 before | Expand all | Expand 10 after
5689 ASSERT(info->isolate()->has_pending_exception()); 5690 ASSERT(info->isolate()->has_pending_exception());
5690 } else { 5691 } else {
5691 result = parser.ParseProgram(info); 5692 result = parser.ParseProgram(info);
5692 } 5693 }
5693 } 5694 }
5694 info->SetFunction(result); 5695 info->SetFunction(result);
5695 return (result != NULL); 5696 return (result != NULL);
5696 } 5697 }
5697 5698
5698 } } // namespace v8::internal 5699 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-1924.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698