| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 enum CompletionKind { | 208 enum CompletionKind { |
| 209 kNormalCompletion, | 209 kNormalCompletion, |
| 210 kThrowCompletion, | 210 kThrowCompletion, |
| 211 kAbruptCompletion | 211 kAbruptCompletion |
| 212 }; | 212 }; |
| 213 | 213 |
| 214 Variable* NewTemporary(const AstRawString* name) { | 214 Variable* NewTemporary(const AstRawString* name) { |
| 215 return scope()->NewTemporary(name); | 215 return scope()->NewTemporary(name); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void PrepareGeneratorVariables(FunctionState* function_state); |
| 219 |
| 218 // Limit the allowed number of local variables in a function. The hard limit | 220 // Limit the allowed number of local variables in a function. The hard limit |
| 219 // is that offsets computed by FullCodeGenerator::StackOperand and similar | 221 // is that offsets computed by FullCodeGenerator::StackOperand and similar |
| 220 // functions are ints, and they should not overflow. In addition, accessing | 222 // functions are ints, and they should not overflow. In addition, accessing |
| 221 // local variables creates user-controlled constants in the generated code, | 223 // local variables creates user-controlled constants in the generated code, |
| 222 // and we don't want too much user-controlled memory inside the code (this was | 224 // and we don't want too much user-controlled memory inside the code (this was |
| 223 // the reason why this limit was introduced in the first place; see | 225 // the reason why this limit was introduced in the first place; see |
| 224 // https://codereview.chromium.org/7003030/ ). | 226 // https://codereview.chromium.org/7003030/ ). |
| 225 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 | 227 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 |
| 226 | 228 |
| 227 // Returns NULL if parsing failed. | 229 // Returns NULL if parsing failed. |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 // Rewrite expressions that are not used as patterns | 562 // Rewrite expressions that are not used as patterns |
| 561 V8_INLINE void RewriteNonPattern(bool* ok); | 563 V8_INLINE void RewriteNonPattern(bool* ok); |
| 562 | 564 |
| 563 V8_INLINE void QueueDestructuringAssignmentForRewriting( | 565 V8_INLINE void QueueDestructuringAssignmentForRewriting( |
| 564 Expression* assignment); | 566 Expression* assignment); |
| 565 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); | 567 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); |
| 566 | 568 |
| 567 friend class InitializerRewriter; | 569 friend class InitializerRewriter; |
| 568 void RewriteParameterInitializer(Expression* expr, Scope* scope); | 570 void RewriteParameterInitializer(Expression* expr, Scope* scope); |
| 569 | 571 |
| 572 Expression* BuildInitialYield(int pos, FunctionKind kind); |
| 570 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); | 573 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); |
| 571 Expression* BuildResolvePromise(Expression* value, int pos); | 574 Expression* BuildResolvePromise(Expression* value, int pos); |
| 572 Expression* BuildRejectPromise(Expression* value, int pos); | 575 Expression* BuildRejectPromise(Expression* value, int pos); |
| 573 Variable* PromiseVariable(); | 576 Variable* PromiseVariable(); |
| 574 | 577 |
| 575 // Generic AST generator for throwing errors from compiled code. | 578 // Generic AST generator for throwing errors from compiled code. |
| 576 Expression* NewThrowError(Runtime::FunctionId function_id, | 579 Expression* NewThrowError(Runtime::FunctionId function_id, |
| 577 MessageTemplate::Template message, | 580 MessageTemplate::Template message, |
| 578 const AstRawString* arg, int pos); | 581 const AstRawString* arg, int pos); |
| 579 | 582 |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 int total_preparse_skipped_; | 1079 int total_preparse_skipped_; |
| 1077 HistogramTimer* pre_parse_timer_; | 1080 HistogramTimer* pre_parse_timer_; |
| 1078 | 1081 |
| 1079 bool parsing_on_main_thread_; | 1082 bool parsing_on_main_thread_; |
| 1080 }; | 1083 }; |
| 1081 | 1084 |
| 1082 } // namespace internal | 1085 } // namespace internal |
| 1083 } // namespace v8 | 1086 } // namespace v8 |
| 1084 | 1087 |
| 1085 #endif // V8_PARSING_PARSER_H_ | 1088 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |