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

Side by Side Diff: src/ast.h

Issue 1412223018: [presubmit] Enabling readability/inheritance linter checking. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments Created 5 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
« no previous file with comments | « no previous file | src/ast.cc » ('j') | 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_AST_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/ast-value-factory.h" 9 #include "src/ast-value-factory.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 1317
1318 const AstValue* value_; 1318 const AstValue* value_;
1319 }; 1319 };
1320 1320
1321 1321
1322 class AstLiteralReindexer; 1322 class AstLiteralReindexer;
1323 1323
1324 // Base class for literals that needs space in the corresponding JSFunction. 1324 // Base class for literals that needs space in the corresponding JSFunction.
1325 class MaterializedLiteral : public Expression { 1325 class MaterializedLiteral : public Expression {
1326 public: 1326 public:
1327 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } 1327 MaterializedLiteral* AsMaterializedLiteral() final { return this; }
1328 1328
1329 int literal_index() { return literal_index_; } 1329 int literal_index() { return literal_index_; }
1330 1330
1331 int depth() const { 1331 int depth() const {
1332 // only callable after initialization. 1332 // only callable after initialization.
1333 DCHECK(depth_ >= 1); 1333 DCHECK(depth_ >= 1);
1334 return depth_; 1334 return depth_;
1335 } 1335 }
1336 1336
1337 bool is_strong() const { return is_strong_; } 1337 bool is_strong() const { return is_strong_; }
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 2074
2075 Token::Value op() const { return op_; } 2075 Token::Value op() const { return op_; }
2076 Expression* expression() const { return expression_; } 2076 Expression* expression() const { return expression_; }
2077 2077
2078 // For unary not (Token::NOT), the AST ids where true and false will 2078 // For unary not (Token::NOT), the AST ids where true and false will
2079 // actually be materialized, respectively. 2079 // actually be materialized, respectively.
2080 static int num_ids() { return parent_num_ids() + 2; } 2080 static int num_ids() { return parent_num_ids() + 2; }
2081 BailoutId MaterializeTrueId() const { return BailoutId(local_id(0)); } 2081 BailoutId MaterializeTrueId() const { return BailoutId(local_id(0)); }
2082 BailoutId MaterializeFalseId() const { return BailoutId(local_id(1)); } 2082 BailoutId MaterializeFalseId() const { return BailoutId(local_id(1)); }
2083 2083
2084 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) override; 2084 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) override;
2085 2085
2086 protected: 2086 protected:
2087 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos) 2087 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos)
2088 : Expression(zone, pos), op_(op), expression_(expression) { 2088 : Expression(zone, pos), op_(op), expression_(expression) {
2089 DCHECK(Token::IsUnaryOp(op)); 2089 DCHECK(Token::IsUnaryOp(op));
2090 } 2090 }
2091 static int parent_num_ids() { return Expression::num_ids(); } 2091 static int parent_num_ids() { return Expression::num_ids(); }
2092 2092
2093 private: 2093 private:
2094 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 2094 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
(...skipping 24 matching lines...) Expand all
2119 return TypeFeedbackId(local_id(1)); 2119 return TypeFeedbackId(local_id(1));
2120 } 2120 }
2121 Maybe<int> fixed_right_arg() const { 2121 Maybe<int> fixed_right_arg() const {
2122 return has_fixed_right_arg_ ? Just(fixed_right_arg_value_) : Nothing<int>(); 2122 return has_fixed_right_arg_ ? Just(fixed_right_arg_value_) : Nothing<int>();
2123 } 2123 }
2124 void set_fixed_right_arg(Maybe<int> arg) { 2124 void set_fixed_right_arg(Maybe<int> arg) {
2125 has_fixed_right_arg_ = arg.IsJust(); 2125 has_fixed_right_arg_ = arg.IsJust();
2126 if (arg.IsJust()) fixed_right_arg_value_ = arg.FromJust(); 2126 if (arg.IsJust()) fixed_right_arg_value_ = arg.FromJust();
2127 } 2127 }
2128 2128
2129 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) override; 2129 void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) override;
2130 2130
2131 protected: 2131 protected:
2132 BinaryOperation(Zone* zone, Token::Value op, Expression* left, 2132 BinaryOperation(Zone* zone, Token::Value op, Expression* left,
2133 Expression* right, int pos) 2133 Expression* right, int pos)
2134 : Expression(zone, pos), 2134 : Expression(zone, pos),
2135 op_(static_cast<byte>(op)), 2135 op_(static_cast<byte>(op)),
2136 has_fixed_right_arg_(false), 2136 has_fixed_right_arg_(false),
2137 fixed_right_arg_value_(0), 2137 fixed_right_arg_value_(0),
2138 left_(left), 2138 left_(left),
2139 right_(right) { 2139 right_(right) {
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2852 virtual bool Is##Name(); 2852 virtual bool Is##Name();
2853 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) 2853 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE)
2854 #undef MAKE_ASTYPE 2854 #undef MAKE_ASTYPE
2855 }; 2855 };
2856 2856
2857 2857
2858 class RegExpDisjunction final : public RegExpTree { 2858 class RegExpDisjunction final : public RegExpTree {
2859 public: 2859 public:
2860 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives); 2860 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives);
2861 void* Accept(RegExpVisitor* visitor, void* data) override; 2861 void* Accept(RegExpVisitor* visitor, void* data) override;
2862 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2862 RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
2863 RegExpNode* on_success) override;
2864 RegExpDisjunction* AsDisjunction() override; 2863 RegExpDisjunction* AsDisjunction() override;
2865 Interval CaptureRegisters() override; 2864 Interval CaptureRegisters() override;
2866 bool IsDisjunction() override; 2865 bool IsDisjunction() override;
2867 bool IsAnchoredAtStart() override; 2866 bool IsAnchoredAtStart() override;
2868 bool IsAnchoredAtEnd() override; 2867 bool IsAnchoredAtEnd() override;
2869 int min_match() override { return min_match_; } 2868 int min_match() override { return min_match_; }
2870 int max_match() override { return max_match_; } 2869 int max_match() override { return max_match_; }
2871 ZoneList<RegExpTree*>* alternatives() { return alternatives_; } 2870 ZoneList<RegExpTree*>* alternatives() { return alternatives_; }
2872 private: 2871 private:
2873 bool SortConsecutiveAtoms(RegExpCompiler* compiler); 2872 bool SortConsecutiveAtoms(RegExpCompiler* compiler);
2874 void RationalizeConsecutiveAtoms(RegExpCompiler* compiler); 2873 void RationalizeConsecutiveAtoms(RegExpCompiler* compiler);
2875 void FixSingleCharacterDisjunctions(RegExpCompiler* compiler); 2874 void FixSingleCharacterDisjunctions(RegExpCompiler* compiler);
2876 ZoneList<RegExpTree*>* alternatives_; 2875 ZoneList<RegExpTree*>* alternatives_;
2877 int min_match_; 2876 int min_match_;
2878 int max_match_; 2877 int max_match_;
2879 }; 2878 };
2880 2879
2881 2880
2882 class RegExpAlternative final : public RegExpTree { 2881 class RegExpAlternative final : public RegExpTree {
2883 public: 2882 public:
2884 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes); 2883 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes);
2885 void* Accept(RegExpVisitor* visitor, void* data) override; 2884 void* Accept(RegExpVisitor* visitor, void* data) override;
2886 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2885 RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
2887 RegExpNode* on_success) override;
2888 RegExpAlternative* AsAlternative() override; 2886 RegExpAlternative* AsAlternative() override;
2889 Interval CaptureRegisters() override; 2887 Interval CaptureRegisters() override;
2890 bool IsAlternative() override; 2888 bool IsAlternative() override;
2891 bool IsAnchoredAtStart() override; 2889 bool IsAnchoredAtStart() override;
2892 bool IsAnchoredAtEnd() override; 2890 bool IsAnchoredAtEnd() override;
2893 int min_match() override { return min_match_; } 2891 int min_match() override { return min_match_; }
2894 int max_match() override { return max_match_; } 2892 int max_match() override { return max_match_; }
2895 ZoneList<RegExpTree*>* nodes() { return nodes_; } 2893 ZoneList<RegExpTree*>* nodes() { return nodes_; }
2896 private: 2894 private:
2897 ZoneList<RegExpTree*>* nodes_; 2895 ZoneList<RegExpTree*>* nodes_;
2898 int min_match_; 2896 int min_match_;
2899 int max_match_; 2897 int max_match_;
2900 }; 2898 };
2901 2899
2902 2900
2903 class RegExpAssertion final : public RegExpTree { 2901 class RegExpAssertion final : public RegExpTree {
2904 public: 2902 public:
2905 enum AssertionType { 2903 enum AssertionType {
2906 START_OF_LINE, 2904 START_OF_LINE,
2907 START_OF_INPUT, 2905 START_OF_INPUT,
2908 END_OF_LINE, 2906 END_OF_LINE,
2909 END_OF_INPUT, 2907 END_OF_INPUT,
2910 BOUNDARY, 2908 BOUNDARY,
2911 NON_BOUNDARY 2909 NON_BOUNDARY
2912 }; 2910 };
2913 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { } 2911 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { }
2914 void* Accept(RegExpVisitor* visitor, void* data) override; 2912 void* Accept(RegExpVisitor* visitor, void* data) override;
2915 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2913 RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
2916 RegExpNode* on_success) override;
2917 RegExpAssertion* AsAssertion() override; 2914 RegExpAssertion* AsAssertion() override;
2918 bool IsAssertion() override; 2915 bool IsAssertion() override;
2919 bool IsAnchoredAtStart() override; 2916 bool IsAnchoredAtStart() override;
2920 bool IsAnchoredAtEnd() override; 2917 bool IsAnchoredAtEnd() override;
2921 int min_match() override { return 0; } 2918 int min_match() override { return 0; }
2922 int max_match() override { return 0; } 2919 int max_match() override { return 0; }
2923 AssertionType assertion_type() { return assertion_type_; } 2920 AssertionType assertion_type() { return assertion_type_; }
2924 private: 2921 private:
2925 AssertionType assertion_type_; 2922 AssertionType assertion_type_;
2926 }; 2923 };
(...skipping 24 matching lines...) Expand all
2951 2948
2952 class RegExpCharacterClass final : public RegExpTree { 2949 class RegExpCharacterClass final : public RegExpTree {
2953 public: 2950 public:
2954 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) 2951 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated)
2955 : set_(ranges), 2952 : set_(ranges),
2956 is_negated_(is_negated) { } 2953 is_negated_(is_negated) { }
2957 explicit RegExpCharacterClass(uc16 type) 2954 explicit RegExpCharacterClass(uc16 type)
2958 : set_(type), 2955 : set_(type),
2959 is_negated_(false) { } 2956 is_negated_(false) { }
2960 void* Accept(RegExpVisitor* visitor, void* data) override; 2957 void* Accept(RegExpVisitor* visitor, void* data) override;
2961 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2958 RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
2962 RegExpNode* on_success) override;
2963 RegExpCharacterClass* AsCharacterClass() override; 2959 RegExpCharacterClass* AsCharacterClass() override;
2964 bool IsCharacterClass() override; 2960 bool IsCharacterClass() override;
2965 bool IsTextElement() override { return true; } 2961 bool IsTextElement() override { return true; }
2966 int min_match() override { return 1; } 2962 int min_match() override { return 1; }
2967 int max_match() override { return 1; } 2963 int max_match() override { return 1; }
2968 void AppendToText(RegExpText* text, Zone* zone) override; 2964 void AppendToText(RegExpText* text, Zone* zone) override;
2969 CharacterSet character_set() { return set_; } 2965 CharacterSet character_set() { return set_; }
2970 // TODO(lrn): Remove need for complex version if is_standard that 2966 // TODO(lrn): Remove need for complex version if is_standard that
2971 // recognizes a mangled standard set and just do { return set_.is_special(); } 2967 // recognizes a mangled standard set and just do { return set_.is_special(); }
2972 bool is_standard(Zone* zone); 2968 bool is_standard(Zone* zone);
(...skipping 15 matching lines...) Expand all
2988 private: 2984 private:
2989 CharacterSet set_; 2985 CharacterSet set_;
2990 bool is_negated_; 2986 bool is_negated_;
2991 }; 2987 };
2992 2988
2993 2989
2994 class RegExpAtom final : public RegExpTree { 2990 class RegExpAtom final : public RegExpTree {
2995 public: 2991 public:
2996 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } 2992 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { }
2997 void* Accept(RegExpVisitor* visitor, void* data) override; 2993 void* Accept(RegExpVisitor* visitor, void* data) override;
2998 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2994 RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
2999 RegExpNode* on_success) override;
3000 RegExpAtom* AsAtom() override; 2995 RegExpAtom* AsAtom() override;
3001 bool IsAtom() override; 2996 bool IsAtom() override;
3002 bool IsTextElement() override { return true; } 2997 bool IsTextElement() override { return true; }
3003 int min_match() override { return data_.length(); } 2998 int min_match() override { return data_.length(); }
3004 int max_match() override { return data_.length(); } 2999 int max_match() override { return data_.length(); }
3005 void AppendToText(RegExpText* text, Zone* zone) override; 3000 void AppendToText(RegExpText* text, Zone* zone) override;
3006 Vector<const uc16> data() { return data_; } 3001 Vector<const uc16> data() { return data_; }
3007 int length() { return data_.length(); } 3002 int length() { return data_.length(); }
3008 private: 3003 private:
3009 Vector<const uc16> data_; 3004 Vector<const uc16> data_;
3010 }; 3005 };
3011 3006
3012 3007
3013 class RegExpText final : public RegExpTree { 3008 class RegExpText final : public RegExpTree {
3014 public: 3009 public:
3015 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {} 3010 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {}
3016 void* Accept(RegExpVisitor* visitor, void* data) override; 3011 void* Accept(RegExpVisitor* visitor, void* data) override;
3017 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3012 RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
3018 RegExpNode* on_success) override;
3019 RegExpText* AsText() override; 3013 RegExpText* AsText() override;
3020 bool IsText() override; 3014 bool IsText() override;
3021 bool IsTextElement() override { return true; } 3015 bool IsTextElement() override { return true; }
3022 int min_match() override { return length_; } 3016 int min_match() override { return length_; }
3023 int max_match() override { return length_; } 3017 int max_match() override { return length_; }
3024 void AppendToText(RegExpText* text, Zone* zone) override; 3018 void AppendToText(RegExpText* text, Zone* zone) override;
3025 void AddElement(TextElement elm, Zone* zone) { 3019 void AddElement(TextElement elm, Zone* zone) {
3026 elements_.Add(elm, zone); 3020 elements_.Add(elm, zone);
3027 length_ += elm.length(); 3021 length_ += elm.length();
3028 } 3022 }
(...skipping 13 matching lines...) Expand all
3042 max_(max), 3036 max_(max),
3043 min_match_(min * body->min_match()), 3037 min_match_(min * body->min_match()),
3044 quantifier_type_(type) { 3038 quantifier_type_(type) {
3045 if (max > 0 && body->max_match() > kInfinity / max) { 3039 if (max > 0 && body->max_match() > kInfinity / max) {
3046 max_match_ = kInfinity; 3040 max_match_ = kInfinity;
3047 } else { 3041 } else {
3048 max_match_ = max * body->max_match(); 3042 max_match_ = max * body->max_match();
3049 } 3043 }
3050 } 3044 }
3051 void* Accept(RegExpVisitor* visitor, void* data) override; 3045 void* Accept(RegExpVisitor* visitor, void* data) override;
3052 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3046 RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
3053 RegExpNode* on_success) override;
3054 static RegExpNode* ToNode(int min, 3047 static RegExpNode* ToNode(int min,
3055 int max, 3048 int max,
3056 bool is_greedy, 3049 bool is_greedy,
3057 RegExpTree* body, 3050 RegExpTree* body,
3058 RegExpCompiler* compiler, 3051 RegExpCompiler* compiler,
3059 RegExpNode* on_success, 3052 RegExpNode* on_success,
3060 bool not_at_start = false); 3053 bool not_at_start = false);
3061 RegExpQuantifier* AsQuantifier() override; 3054 RegExpQuantifier* AsQuantifier() override;
3062 Interval CaptureRegisters() override; 3055 Interval CaptureRegisters() override;
3063 bool IsQuantifier() override; 3056 bool IsQuantifier() override;
(...skipping 14 matching lines...) Expand all
3078 int max_match_; 3071 int max_match_;
3079 QuantifierType quantifier_type_; 3072 QuantifierType quantifier_type_;
3080 }; 3073 };
3081 3074
3082 3075
3083 class RegExpCapture final : public RegExpTree { 3076 class RegExpCapture final : public RegExpTree {
3084 public: 3077 public:
3085 explicit RegExpCapture(RegExpTree* body, int index) 3078 explicit RegExpCapture(RegExpTree* body, int index)
3086 : body_(body), index_(index) { } 3079 : body_(body), index_(index) { }
3087 void* Accept(RegExpVisitor* visitor, void* data) override; 3080 void* Accept(RegExpVisitor* visitor, void* data) override;
3088 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3081 RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
3089 RegExpNode* on_success) override;
3090 static RegExpNode* ToNode(RegExpTree* body, 3082 static RegExpNode* ToNode(RegExpTree* body,
3091 int index, 3083 int index,
3092 RegExpCompiler* compiler, 3084 RegExpCompiler* compiler,
3093 RegExpNode* on_success); 3085 RegExpNode* on_success);
3094 RegExpCapture* AsCapture() override; 3086 RegExpCapture* AsCapture() override;
3095 bool IsAnchoredAtStart() override; 3087 bool IsAnchoredAtStart() override;
3096 bool IsAnchoredAtEnd() override; 3088 bool IsAnchoredAtEnd() override;
3097 Interval CaptureRegisters() override; 3089 Interval CaptureRegisters() override;
3098 bool IsCapture() override; 3090 bool IsCapture() override;
3099 int min_match() override { return body_->min_match(); } 3091 int min_match() override { return body_->min_match(); }
(...skipping 14 matching lines...) Expand all
3114 RegExpLookahead(RegExpTree* body, 3106 RegExpLookahead(RegExpTree* body,
3115 bool is_positive, 3107 bool is_positive,
3116 int capture_count, 3108 int capture_count,
3117 int capture_from) 3109 int capture_from)
3118 : body_(body), 3110 : body_(body),
3119 is_positive_(is_positive), 3111 is_positive_(is_positive),
3120 capture_count_(capture_count), 3112 capture_count_(capture_count),
3121 capture_from_(capture_from) { } 3113 capture_from_(capture_from) { }
3122 3114
3123 void* Accept(RegExpVisitor* visitor, void* data) override; 3115 void* Accept(RegExpVisitor* visitor, void* data) override;
3124 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3116 RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
3125 RegExpNode* on_success) override;
3126 RegExpLookahead* AsLookahead() override; 3117 RegExpLookahead* AsLookahead() override;
3127 Interval CaptureRegisters() override; 3118 Interval CaptureRegisters() override;
3128 bool IsLookahead() override; 3119 bool IsLookahead() override;
3129 bool IsAnchoredAtStart() override; 3120 bool IsAnchoredAtStart() override;
3130 int min_match() override { return 0; } 3121 int min_match() override { return 0; }
3131 int max_match() override { return 0; } 3122 int max_match() override { return 0; }
3132 RegExpTree* body() { return body_; } 3123 RegExpTree* body() { return body_; }
3133 bool is_positive() { return is_positive_; } 3124 bool is_positive() { return is_positive_; }
3134 int capture_count() { return capture_count_; } 3125 int capture_count() { return capture_count_; }
3135 int capture_from() { return capture_from_; } 3126 int capture_from() { return capture_from_; }
3136 3127
3137 private: 3128 private:
3138 RegExpTree* body_; 3129 RegExpTree* body_;
3139 bool is_positive_; 3130 bool is_positive_;
3140 int capture_count_; 3131 int capture_count_;
3141 int capture_from_; 3132 int capture_from_;
3142 }; 3133 };
3143 3134
3144 3135
3145 class RegExpBackReference final : public RegExpTree { 3136 class RegExpBackReference final : public RegExpTree {
3146 public: 3137 public:
3147 explicit RegExpBackReference(RegExpCapture* capture) 3138 explicit RegExpBackReference(RegExpCapture* capture)
3148 : capture_(capture) { } 3139 : capture_(capture) { }
3149 void* Accept(RegExpVisitor* visitor, void* data) override; 3140 void* Accept(RegExpVisitor* visitor, void* data) override;
3150 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3141 RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
3151 RegExpNode* on_success) override;
3152 RegExpBackReference* AsBackReference() override; 3142 RegExpBackReference* AsBackReference() override;
3153 bool IsBackReference() override; 3143 bool IsBackReference() override;
3154 int min_match() override { return 0; } 3144 int min_match() override { return 0; }
3155 int max_match() override { return capture_->max_match(); } 3145 int max_match() override { return capture_->max_match(); }
3156 int index() { return capture_->index(); } 3146 int index() { return capture_->index(); }
3157 RegExpCapture* capture() { return capture_; } 3147 RegExpCapture* capture() { return capture_; }
3158 private: 3148 private:
3159 RegExpCapture* capture_; 3149 RegExpCapture* capture_;
3160 }; 3150 };
3161 3151
3162 3152
3163 class RegExpEmpty final : public RegExpTree { 3153 class RegExpEmpty final : public RegExpTree {
3164 public: 3154 public:
3165 RegExpEmpty() { } 3155 RegExpEmpty() { }
3166 void* Accept(RegExpVisitor* visitor, void* data) override; 3156 void* Accept(RegExpVisitor* visitor, void* data) override;
3167 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3157 RegExpNode* ToNode(RegExpCompiler* compiler, RegExpNode* on_success) override;
3168 RegExpNode* on_success) override;
3169 RegExpEmpty* AsEmpty() override; 3158 RegExpEmpty* AsEmpty() override;
3170 bool IsEmpty() override; 3159 bool IsEmpty() override;
3171 int min_match() override { return 0; } 3160 int min_match() override { return 0; }
3172 int max_match() override { return 0; } 3161 int max_match() override { return 0; }
3173 }; 3162 };
3174 3163
3175 3164
3176 // ---------------------------------------------------------------------------- 3165 // ----------------------------------------------------------------------------
3177 // Basic visitor 3166 // Basic visitor
3178 // - leaf node visitors are abstract. 3167 // - leaf node visitors are abstract.
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
3671 // the parser-level zone. 3660 // the parser-level zone.
3672 Zone* parser_zone_; 3661 Zone* parser_zone_;
3673 AstValueFactory* ast_value_factory_; 3662 AstValueFactory* ast_value_factory_;
3674 }; 3663 };
3675 3664
3676 3665
3677 } // namespace internal 3666 } // namespace internal
3678 } // namespace v8 3667 } // namespace v8
3679 3668
3680 #endif // V8_AST_H_ 3669 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698