Chromium Code Reviews

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

Issue 1772793002: Implement iterator finalization in array destructuring. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | src/parsing/pattern-rewriter.cc » ('J')
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 #ifndef V8_PARSING_PARSER_H_ 5 #ifndef V8_PARSING_PARSER_H_
6 #define V8_PARSING_PARSER_H_ 6 #define V8_PARSING_PARSER_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 448 matching lines...)
459 // Generate AST node that throws a TypeError with the given 459 // Generate AST node that throws a TypeError with the given
460 // type. Both arguments must be non-null (in the handle sense). 460 // type. Both arguments must be non-null (in the handle sense).
461 Expression* NewThrowTypeError(MessageTemplate::Template message, 461 Expression* NewThrowTypeError(MessageTemplate::Template message,
462 const AstRawString* arg, int pos); 462 const AstRawString* arg, int pos);
463 463
464 // Generic AST generator for throwing errors from compiled code. 464 // Generic AST generator for throwing errors from compiled code.
465 Expression* NewThrowError(Runtime::FunctionId function_id, 465 Expression* NewThrowError(Runtime::FunctionId function_id,
466 MessageTemplate::Template message, 466 MessageTemplate::Template message,
467 const AstRawString* arg, int pos); 467 const AstRawString* arg, int pos);
468 468
469 void FinalizeIteratorUse(Variable* completion, Expression* condition,
470 Variable* iter, Block* iterator_use, Block* result);
471
469 Statement* FinalizeForOfStatement(ForOfStatement* loop, int pos); 472 Statement* FinalizeForOfStatement(ForOfStatement* loop, int pos);
470 473
471 // Reporting errors. 474 // Reporting errors.
472 void ReportMessageAt(Scanner::Location source_location, 475 void ReportMessageAt(Scanner::Location source_location,
473 MessageTemplate::Template message, 476 MessageTemplate::Template message,
474 const char* arg = NULL, 477 const char* arg = NULL,
475 ParseErrorType error_type = kSyntaxError); 478 ParseErrorType error_type = kSyntaxError);
476 void ReportMessage(MessageTemplate::Template message, const char* arg = NULL, 479 void ReportMessage(MessageTemplate::Template message, const char* arg = NULL,
477 ParseErrorType error_type = kSyntaxError); 480 ParseErrorType error_type = kSyntaxError);
478 void ReportMessage(MessageTemplate::Template message, const AstRawString* arg, 481 void ReportMessage(MessageTemplate::Template message, const AstRawString* arg,
(...skipping 220 matching lines...)
699 void ParseOnBackground(ParseInfo* info); 702 void ParseOnBackground(ParseInfo* info);
700 703
701 // Handle errors detected during parsing, move statistics to Isolate, 704 // Handle errors detected during parsing, move statistics to Isolate,
702 // internalize strings (move them to the heap). 705 // internalize strings (move them to the heap).
703 void Internalize(Isolate* isolate, Handle<Script> script, bool error); 706 void Internalize(Isolate* isolate, Handle<Script> script, bool error);
704 void HandleSourceURLComments(Isolate* isolate, Handle<Script> script); 707 void HandleSourceURLComments(Isolate* isolate, Handle<Script> script);
705 708
706 private: 709 private:
707 friend class ParserTraits; 710 friend class ParserTraits;
708 711
712 // Runtime encoding of different completion modes.
713 enum CompletionKind { NORMAL, THROW, ABRUPT };
714
709 // Limit the allowed number of local variables in a function. The hard limit 715 // Limit the allowed number of local variables in a function. The hard limit
710 // is that offsets computed by FullCodeGenerator::StackOperand and similar 716 // is that offsets computed by FullCodeGenerator::StackOperand and similar
711 // functions are ints, and they should not overflow. In addition, accessing 717 // functions are ints, and they should not overflow. In addition, accessing
712 // local variables creates user-controlled constants in the generated code, 718 // local variables creates user-controlled constants in the generated code,
713 // and we don't want too much user-controlled memory inside the code (this was 719 // and we don't want too much user-controlled memory inside the code (this was
714 // the reason why this limit was introduced in the first place; see 720 // the reason why this limit was introduced in the first place; see
715 // https://codereview.chromium.org/7003030/ ). 721 // https://codereview.chromium.org/7003030/ ).
716 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 722 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1
717 723
718 // Returns NULL if parsing failed. 724 // Returns NULL if parsing failed.
(...skipping 519 matching lines...)
1238 1244
1239 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { 1245 DoExpression* ParserTraits::ParseDoExpression(bool* ok) {
1240 return parser_->ParseDoExpression(ok); 1246 return parser_->ParseDoExpression(ok);
1241 } 1247 }
1242 1248
1243 1249
1244 } // namespace internal 1250 } // namespace internal
1245 } // namespace v8 1251 } // namespace v8
1246 1252
1247 #endif // V8_PARSING_PARSER_H_ 1253 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | src/parsing/pattern-rewriter.cc » ('J')

Powered by Google App Engine