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/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 enum CompletionKind { | 257 enum CompletionKind { |
258 kNormalCompletion, | 258 kNormalCompletion, |
259 kThrowCompletion, | 259 kThrowCompletion, |
260 kAbruptCompletion | 260 kAbruptCompletion |
261 }; | 261 }; |
262 | 262 |
263 Variable* NewTemporary(const AstRawString* name) { | 263 Variable* NewTemporary(const AstRawString* name) { |
264 return scope()->NewTemporary(name); | 264 return scope()->NewTemporary(name); |
265 } | 265 } |
266 | 266 |
267 void PrepareGeneratorVariables(FunctionState* function_state); | 267 void PrepareGeneratorVariables(); |
268 | 268 |
269 // Limit the allowed number of local variables in a function. The hard limit | 269 // Limit the allowed number of local variables in a function. The hard limit |
270 // is that offsets computed by FullCodeGenerator::StackOperand and similar | 270 // is that offsets computed by FullCodeGenerator::StackOperand and similar |
271 // functions are ints, and they should not overflow. In addition, accessing | 271 // functions are ints, and they should not overflow. In addition, accessing |
272 // local variables creates user-controlled constants in the generated code, | 272 // local variables creates user-controlled constants in the generated code, |
273 // and we don't want too much user-controlled memory inside the code (this was | 273 // and we don't want too much user-controlled memory inside the code (this was |
274 // the reason why this limit was introduced in the first place; see | 274 // the reason why this limit was introduced in the first place; see |
275 // https://codereview.chromium.org/7003030/ ). | 275 // https://codereview.chromium.org/7003030/ ). |
276 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 | 276 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 |
277 | 277 |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 V8_INLINE void RewriteNonPattern(bool* ok); | 623 V8_INLINE void RewriteNonPattern(bool* ok); |
624 | 624 |
625 V8_INLINE void QueueDestructuringAssignmentForRewriting( | 625 V8_INLINE void QueueDestructuringAssignmentForRewriting( |
626 Expression* assignment); | 626 Expression* assignment); |
627 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); | 627 V8_INLINE void QueueNonPatternForRewriting(Expression* expr, bool* ok); |
628 | 628 |
629 friend class InitializerRewriter; | 629 friend class InitializerRewriter; |
630 void RewriteParameterInitializer(Expression* expr, Scope* scope); | 630 void RewriteParameterInitializer(Expression* expr, Scope* scope); |
631 | 631 |
632 Expression* BuildInitialYield(int pos, FunctionKind kind); | 632 Expression* BuildInitialYield(int pos, FunctionKind kind); |
633 Expression* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); | 633 Assignment* BuildCreateJSGeneratorObject(int pos, FunctionKind kind); |
634 Expression* BuildResolvePromise(Expression* value, int pos); | 634 Expression* BuildResolvePromise(Expression* value, int pos); |
635 Expression* BuildRejectPromise(Expression* value, int pos); | 635 Expression* BuildRejectPromise(Expression* value, int pos); |
636 Variable* PromiseVariable(); | 636 Variable* PromiseVariable(); |
637 | 637 |
638 // Generic AST generator for throwing errors from compiled code. | 638 // Generic AST generator for throwing errors from compiled code. |
639 Expression* NewThrowError(Runtime::FunctionId function_id, | 639 Expression* NewThrowError(Runtime::FunctionId function_id, |
640 MessageTemplate::Template message, | 640 MessageTemplate::Template message, |
641 const AstRawString* arg, int pos); | 641 const AstRawString* arg, int pos); |
642 | 642 |
643 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, | 643 void FinalizeIteratorUse(Scope* use_scope, Variable* completion, |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 | 1188 |
1189 private: | 1189 private: |
1190 ParserTarget** variable_; | 1190 ParserTarget** variable_; |
1191 ParserTarget* previous_; | 1191 ParserTarget* previous_; |
1192 }; | 1192 }; |
1193 | 1193 |
1194 } // namespace internal | 1194 } // namespace internal |
1195 } // namespace v8 | 1195 } // namespace v8 |
1196 | 1196 |
1197 #endif // V8_PARSING_PARSER_H_ | 1197 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |