OLD | NEW |
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/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/parsing/parser-base.h" | 10 #include "src/parsing/parser-base.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 enum CompletionKind { | 209 enum CompletionKind { |
210 kNormalCompletion, | 210 kNormalCompletion, |
211 kThrowCompletion, | 211 kThrowCompletion, |
212 kAbruptCompletion | 212 kAbruptCompletion |
213 }; | 213 }; |
214 | 214 |
215 Variable* NewTemporary(const AstRawString* name) { | 215 Variable* NewTemporary(const AstRawString* name) { |
216 return scope()->NewTemporary(name); | 216 return scope()->NewTemporary(name); |
217 } | 217 } |
218 | 218 |
| 219 void PrepareGeneratorVariables(FunctionState* function_state); |
| 220 |
219 // Limit the allowed number of local variables in a function. The hard limit | 221 // Limit the allowed number of local variables in a function. The hard limit |
220 // is that offsets computed by FullCodeGenerator::StackOperand and similar | 222 // is that offsets computed by FullCodeGenerator::StackOperand and similar |
221 // functions are ints, and they should not overflow. In addition, accessing | 223 // functions are ints, and they should not overflow. In addition, accessing |
222 // local variables creates user-controlled constants in the generated code, | 224 // local variables creates user-controlled constants in the generated code, |
223 // and we don't want too much user-controlled memory inside the code (this was | 225 // and we don't want too much user-controlled memory inside the code (this was |
224 // the reason why this limit was introduced in the first place; see | 226 // the reason why this limit was introduced in the first place; see |
225 // https://codereview.chromium.org/7003030/ ). | 227 // https://codereview.chromium.org/7003030/ ). |
226 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 | 228 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 |
227 | 229 |
228 // Returns NULL if parsing failed. | 230 // Returns NULL if parsing failed. |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 // Rewrite expressions that are not used as patterns | 570 // Rewrite expressions that are not used as patterns |
569 V8_INLINE void RewriteNonPattern(bool* ok); | 571 V8_INLINE void RewriteNonPattern(bool* ok); |
570 | 572 |
571 V8_INLINE void QueueDestructuringAssignmentForRewriting( | 573 V8_INLINE void QueueDestructuringAssignmentForRewriting( |
572 Expression* assignment); | 574 Expression* assignment); |
573 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); | 575 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); |
574 | 576 |
575 friend class InitializerRewriter; | 577 friend class InitializerRewriter; |
576 void RewriteParameterInitializer(Expression* expr, Scope* scope); | 578 void RewriteParameterInitializer(Expression* expr, Scope* scope); |
577 | 579 |
| 580 Expression* BuildInitialYield(int pos, FunctionKind kind); |
578 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); | 581 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); |
579 Expression* BuildResolvePromise(Expression* value, int pos); | 582 Expression* BuildResolvePromise(Expression* value, int pos); |
580 Expression* BuildRejectPromise(Expression* value, int pos); | 583 Expression* BuildRejectPromise(Expression* value, int pos); |
581 Variable* PromiseVariable(); | 584 Variable* PromiseVariable(); |
582 | 585 |
583 // Generic AST generator for throwing errors from compiled code. | 586 // Generic AST generator for throwing errors from compiled code. |
584 Expression* NewThrowError(Runtime::FunctionId function_id, | 587 Expression* NewThrowError(Runtime::FunctionId function_id, |
585 MessageTemplate::Template message, | 588 MessageTemplate::Template message, |
586 const AstRawString* arg, int pos); | 589 const AstRawString* arg, int pos); |
587 | 590 |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 int total_preparse_skipped_; | 1093 int total_preparse_skipped_; |
1091 HistogramTimer* pre_parse_timer_; | 1094 HistogramTimer* pre_parse_timer_; |
1092 | 1095 |
1093 bool parsing_on_main_thread_; | 1096 bool parsing_on_main_thread_; |
1094 }; | 1097 }; |
1095 | 1098 |
1096 } // namespace internal | 1099 } // namespace internal |
1097 } // namespace v8 | 1100 } // namespace v8 |
1098 | 1101 |
1099 #endif // V8_PARSING_PARSER_H_ | 1102 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |