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

Side by Side Diff: src/parsing/parser.cc

Issue 2176613002: Native try-catch syntax parsing should not crash. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-630559.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-rewriter.h" 9 #include "src/ast/ast-expression-rewriter.h"
10 #include "src/ast/ast-expression-visitor.h" 10 #include "src/ast/ast-expression-visitor.h"
(...skipping 2975 matching lines...) Expand 10 before | Expand all | Expand 10 after
2986 int pos = position(); 2986 int pos = position();
2987 2987
2988 Block* try_block; 2988 Block* try_block;
2989 { 2989 {
2990 ReturnExprScope no_tail_calls(function_state_, 2990 ReturnExprScope no_tail_calls(function_state_,
2991 ReturnExprContext::kInsideTryBlock); 2991 ReturnExprContext::kInsideTryBlock);
2992 try_block = ParseBlock(NULL, CHECK_OK); 2992 try_block = ParseBlock(NULL, CHECK_OK);
2993 } 2993 }
2994 2994
2995 Token::Value tok = peek(); 2995 Token::Value tok = peek();
2996
2996 bool catch_for_promise_reject = false; 2997 bool catch_for_promise_reject = false;
2998 if (allow_natives() && tok == Token::MOD) {
2999 Consume(Token::MOD);
3000 catch_for_promise_reject = true;
3001 tok = peek();
3002 }
3003
2997 if (tok != Token::CATCH && tok != Token::FINALLY) { 3004 if (tok != Token::CATCH && tok != Token::FINALLY) {
2998 if (allow_natives() && tok == Token::MOD) { 3005 ReportMessage(MessageTemplate::kNoCatchOrFinally);
2999 Consume(Token::MOD); 3006 *ok = false;
3000 catch_for_promise_reject = true; 3007 return NULL;
3001 tok = peek();
3002 DCHECK_EQ(Token::CATCH, tok);
3003 } else {
3004 ReportMessage(MessageTemplate::kNoCatchOrFinally);
3005 *ok = false;
3006 return NULL;
3007 }
3008 } 3008 }
3009 3009
3010 Scope* catch_scope = NULL; 3010 Scope* catch_scope = NULL;
3011 Variable* catch_variable = NULL; 3011 Variable* catch_variable = NULL;
3012 Block* catch_block = NULL; 3012 Block* catch_block = NULL;
3013 TailCallExpressionList tail_call_expressions_in_catch_block(zone()); 3013 TailCallExpressionList tail_call_expressions_in_catch_block(zone());
3014 if (tok == Token::CATCH) { 3014 if (tok == Token::CATCH) {
3015 Consume(Token::CATCH); 3015 Consume(Token::CATCH);
3016 3016
3017 Expect(Token::LPAREN, CHECK_OK); 3017 Expect(Token::LPAREN, CHECK_OK);
(...skipping 4069 matching lines...) Expand 10 before | Expand all | Expand 10 after
7087 node->Print(Isolate::Current()); 7087 node->Print(Isolate::Current());
7088 } 7088 }
7089 #endif // DEBUG 7089 #endif // DEBUG
7090 7090
7091 #undef CHECK_OK 7091 #undef CHECK_OK
7092 #undef CHECK_OK_VOID 7092 #undef CHECK_OK_VOID
7093 #undef CHECK_FAILED 7093 #undef CHECK_FAILED
7094 7094
7095 } // namespace internal 7095 } // namespace internal
7096 } // namespace v8 7096 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-630559.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698