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