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/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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 kThrowCompletion, | 769 kThrowCompletion, |
770 kAbruptCompletion | 770 kAbruptCompletion |
771 }; | 771 }; |
772 | 772 |
773 DeclarationScope* GetDeclarationScope() const { | 773 DeclarationScope* GetDeclarationScope() const { |
774 return scope()->GetDeclarationScope(); | 774 return scope()->GetDeclarationScope(); |
775 } | 775 } |
776 DeclarationScope* GetClosureScope() const { | 776 DeclarationScope* GetClosureScope() const { |
777 return scope()->GetClosureScope(); | 777 return scope()->GetClosureScope(); |
778 } | 778 } |
| 779 Variable* NewTemporary(const AstRawString* name) { |
| 780 return scope()->NewTemporary(name); |
| 781 } |
779 | 782 |
780 // Limit the allowed number of local variables in a function. The hard limit | 783 // Limit the allowed number of local variables in a function. The hard limit |
781 // is that offsets computed by FullCodeGenerator::StackOperand and similar | 784 // is that offsets computed by FullCodeGenerator::StackOperand and similar |
782 // functions are ints, and they should not overflow. In addition, accessing | 785 // functions are ints, and they should not overflow. In addition, accessing |
783 // local variables creates user-controlled constants in the generated code, | 786 // local variables creates user-controlled constants in the generated code, |
784 // and we don't want too much user-controlled memory inside the code (this was | 787 // and we don't want too much user-controlled memory inside the code (this was |
785 // the reason why this limit was introduced in the first place; see | 788 // the reason why this limit was introduced in the first place; see |
786 // https://codereview.chromium.org/7003030/ ). | 789 // https://codereview.chromium.org/7003030/ ). |
787 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 | 790 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 |
788 | 791 |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 | 1373 |
1371 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1374 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
1372 return parser_->ParseDoExpression(ok); | 1375 return parser_->ParseDoExpression(ok); |
1373 } | 1376 } |
1374 | 1377 |
1375 | 1378 |
1376 } // namespace internal | 1379 } // namespace internal |
1377 } // namespace v8 | 1380 } // namespace v8 |
1378 | 1381 |
1379 #endif // V8_PARSING_PARSER_H_ | 1382 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |