Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: src/preparser.h

Issue 668143003: Move BailoutReason and flags computation to post-pass (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_PREPARSER_H 5 #ifndef V8_PREPARSER_H
6 #define V8_PREPARSER_H 6 #define V8_PREPARSER_H
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 // and PreParser. 809 // and PreParser.
810 PreParserExpression* operator->() { return this; } 810 PreParserExpression* operator->() { return this; }
811 811
812 // More dummy implementations of things PreParser doesn't need to track: 812 // More dummy implementations of things PreParser doesn't need to track:
813 void set_index(int index) {} // For YieldExpressions 813 void set_index(int index) {} // For YieldExpressions
814 void set_parenthesized() {} 814 void set_parenthesized() {}
815 815
816 int position() const { return RelocInfo::kNoPosition; } 816 int position() const { return RelocInfo::kNoPosition; }
817 void set_function_token_position(int position) {} 817 void set_function_token_position(int position) {}
818 void set_ast_properties(int* ast_properties) {} 818 void set_ast_properties(int* ast_properties) {}
819 void set_dont_optimize_reason(BailoutReason dont_optimize_reason) {}
820 819
821 private: 820 private:
822 enum Type { 821 enum Type {
823 kExpression, 822 kExpression,
824 kIdentifierExpression, 823 kIdentifierExpression,
825 kStringLiteralExpression, 824 kStringLiteralExpression,
826 kBinaryOperationExpression 825 kBinaryOperationExpression
827 }; 826 };
828 827
829 enum Parenthesization { 828 enum Parenthesization {
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 PreParserExpression extends, 1095 PreParserExpression extends,
1097 PreParserExpression constructor, 1096 PreParserExpression constructor,
1098 PreParserExpressionList properties, 1097 PreParserExpressionList properties,
1099 int start_position, int end_position) { 1098 int start_position, int end_position) {
1100 return PreParserExpression::Default(); 1099 return PreParserExpression::Default();
1101 } 1100 }
1102 1101
1103 // Return the object itself as AstVisitor and implement the needed 1102 // Return the object itself as AstVisitor and implement the needed
1104 // dummy method right in this class. 1103 // dummy method right in this class.
1105 PreParserFactory* visitor() { return this; } 1104 PreParserFactory* visitor() { return this; }
1106 BailoutReason dont_optimize_reason() { return kNoReason; }
1107 int* ast_properties() { 1105 int* ast_properties() {
1108 static int dummy = 42; 1106 static int dummy = 42;
1109 return &dummy; 1107 return &dummy;
1110 } 1108 }
1111 }; 1109 };
1112 1110
1113 1111
1114 class PreParser; 1112 class PreParser;
1115 1113
1116 class PreParserTraits { 1114 class PreParserTraits {
(...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 } 2626 }
2629 2627
2630 2628
2631 template <class Traits> 2629 template <class Traits>
2632 typename ParserBase<Traits>::ExpressionT ParserBase< 2630 typename ParserBase<Traits>::ExpressionT ParserBase<
2633 Traits>::ParseArrowFunctionLiteral(int start_pos, ExpressionT params_ast, 2631 Traits>::ParseArrowFunctionLiteral(int start_pos, ExpressionT params_ast,
2634 bool* ok) { 2632 bool* ok) {
2635 typename Traits::Type::ScopePtr scope = this->NewScope(scope_, ARROW_SCOPE); 2633 typename Traits::Type::ScopePtr scope = this->NewScope(scope_, ARROW_SCOPE);
2636 typename Traits::Type::StatementList body; 2634 typename Traits::Type::StatementList body;
2637 typename Traits::Type::AstProperties ast_properties; 2635 typename Traits::Type::AstProperties ast_properties;
2638 BailoutReason dont_optimize_reason = kNoReason;
2639 int num_parameters = -1; 2636 int num_parameters = -1;
2640 int materialized_literal_count = -1; 2637 int materialized_literal_count = -1;
2641 int expected_property_count = -1; 2638 int expected_property_count = -1;
2642 int handler_count = 0; 2639 int handler_count = 0;
2643 2640
2644 { 2641 {
2645 typename Traits::Type::Factory function_factory(this->ast_value_factory()); 2642 typename Traits::Type::Factory function_factory(this->ast_value_factory());
2646 FunctionState function_state(&function_state_, &scope_, 2643 FunctionState function_state(&function_state_, &scope_,
2647 Traits::Type::ptr_to_scope(scope), 2644 Traits::Type::ptr_to_scope(scope),
2648 &function_factory); 2645 &function_factory);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 2709
2713 // Validate strict mode. 2710 // Validate strict mode.
2714 if (strict_mode() == STRICT) { 2711 if (strict_mode() == STRICT) {
2715 CheckOctalLiteral(start_pos, scanner()->location().end_pos, CHECK_OK); 2712 CheckOctalLiteral(start_pos, scanner()->location().end_pos, CHECK_OK);
2716 } 2713 }
2717 2714
2718 if (allow_harmony_scoping() && strict_mode() == STRICT) 2715 if (allow_harmony_scoping() && strict_mode() == STRICT)
2719 this->CheckConflictingVarDeclarations(scope, CHECK_OK); 2716 this->CheckConflictingVarDeclarations(scope, CHECK_OK);
2720 2717
2721 ast_properties = *factory()->visitor()->ast_properties(); 2718 ast_properties = *factory()->visitor()->ast_properties();
2722 dont_optimize_reason = factory()->visitor()->dont_optimize_reason();
2723 } 2719 }
2724 2720
2725 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( 2721 FunctionLiteralT function_literal = factory()->NewFunctionLiteral(
2726 this->EmptyIdentifierString(), this->ast_value_factory(), scope, body, 2722 this->EmptyIdentifierString(), this->ast_value_factory(), scope, body,
2727 materialized_literal_count, expected_property_count, handler_count, 2723 materialized_literal_count, expected_property_count, handler_count,
2728 num_parameters, FunctionLiteral::kNoDuplicateParameters, 2724 num_parameters, FunctionLiteral::kNoDuplicateParameters,
2729 FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kIsFunction, 2725 FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kIsFunction,
2730 FunctionLiteral::kNotParenthesized, FunctionKind::kArrowFunction, 2726 FunctionLiteral::kNotParenthesized, FunctionKind::kArrowFunction,
2731 start_pos); 2727 start_pos);
2732 2728
2733 function_literal->set_function_token_position(start_pos); 2729 function_literal->set_function_token_position(start_pos);
2734 function_literal->set_ast_properties(&ast_properties); 2730 function_literal->set_ast_properties(&ast_properties);
2735 function_literal->set_dont_optimize_reason(dont_optimize_reason);
2736 2731
2737 if (fni_ != NULL) this->InferFunctionName(fni_, function_literal); 2732 if (fni_ != NULL) this->InferFunctionName(fni_, function_literal);
2738 2733
2739 return function_literal; 2734 return function_literal;
2740 } 2735 }
2741 2736
2742 2737
2743 template <class Traits> 2738 template <class Traits>
2744 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseClassLiteral( 2739 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseClassLiteral(
2745 IdentifierT name, Scanner::Location class_name_location, 2740 IdentifierT name, Scanner::Location class_name_location,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2864 DCHECK(IsAccessorAccessorConflict(old_type, type)); 2859 DCHECK(IsAccessorAccessorConflict(old_type, type));
2865 // Both accessors of the same type. 2860 // Both accessors of the same type.
2866 parser()->ReportMessage("accessor_get_set"); 2861 parser()->ReportMessage("accessor_get_set");
2867 } 2862 }
2868 *ok = false; 2863 *ok = false;
2869 } 2864 }
2870 } 2865 }
2871 } } // v8::internal 2866 } } // v8::internal
2872 2867
2873 #endif // V8_PREPARSER_H 2868 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698