| 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 private: | 763 private: |
| 764 friend class ParserTraits; | 764 friend class ParserTraits; |
| 765 | 765 |
| 766 // Runtime encoding of different completion modes. | 766 // Runtime encoding of different completion modes. |
| 767 enum CompletionKind { | 767 enum CompletionKind { |
| 768 kNormalCompletion, | 768 kNormalCompletion, |
| 769 kThrowCompletion, | 769 kThrowCompletion, |
| 770 kAbruptCompletion | 770 kAbruptCompletion |
| 771 }; | 771 }; |
| 772 | 772 |
| 773 DeclarationScope* GetDeclarationScope() const { |
| 774 return scope()->GetDeclarationScope(); |
| 775 } |
| 776 DeclarationScope* GetClosureScope() const { |
| 777 return scope()->GetClosureScope(); |
| 778 } |
| 779 |
| 773 // Limit the allowed number of local variables in a function. The hard limit | 780 // Limit the allowed number of local variables in a function. The hard limit |
| 774 // is that offsets computed by FullCodeGenerator::StackOperand and similar | 781 // is that offsets computed by FullCodeGenerator::StackOperand and similar |
| 775 // functions are ints, and they should not overflow. In addition, accessing | 782 // functions are ints, and they should not overflow. In addition, accessing |
| 776 // local variables creates user-controlled constants in the generated code, | 783 // local variables creates user-controlled constants in the generated code, |
| 777 // and we don't want too much user-controlled memory inside the code (this was | 784 // and we don't want too much user-controlled memory inside the code (this was |
| 778 // the reason why this limit was introduced in the first place; see | 785 // the reason why this limit was introduced in the first place; see |
| 779 // https://codereview.chromium.org/7003030/ ). | 786 // https://codereview.chromium.org/7003030/ ). |
| 780 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 | 787 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 |
| 781 | 788 |
| 782 // Returns NULL if parsing failed. | 789 // Returns NULL if parsing failed. |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 | 1370 |
| 1364 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1371 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
| 1365 return parser_->ParseDoExpression(ok); | 1372 return parser_->ParseDoExpression(ok); |
| 1366 } | 1373 } |
| 1367 | 1374 |
| 1368 | 1375 |
| 1369 } // namespace internal | 1376 } // namespace internal |
| 1370 } // namespace v8 | 1377 } // namespace v8 |
| 1371 | 1378 |
| 1372 #endif // V8_PARSING_PARSER_H_ | 1379 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |