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

Side by Side Diff: src/ast.h

Issue 265623002: Small cleanup: AstConstructionVisitor no longer needs a Zone pointer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months 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 | « no previous file | 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_AST_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "v8.h" 8 #include "v8.h"
9 9
10 #include "assembler.h" 10 #include "assembler.h"
(...skipping 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2878 \ 2878 \
2879 Zone* zone_; \ 2879 Zone* zone_; \
2880 bool stack_overflow_ 2880 bool stack_overflow_
2881 2881
2882 2882
2883 // ---------------------------------------------------------------------------- 2883 // ----------------------------------------------------------------------------
2884 // Construction time visitor. 2884 // Construction time visitor.
2885 2885
2886 class AstConstructionVisitor BASE_EMBEDDED { 2886 class AstConstructionVisitor BASE_EMBEDDED {
2887 public: 2887 public:
2888 explicit AstConstructionVisitor(Zone* zone) 2888 AstConstructionVisitor() : dont_optimize_reason_(kNoReason) { }
2889 : dont_optimize_reason_(kNoReason),
2890 zone_(zone) { }
2891 2889
2892 AstProperties* ast_properties() { return &properties_; } 2890 AstProperties* ast_properties() { return &properties_; }
2893 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } 2891 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; }
2894 2892
2895 private: 2893 private:
2896 template<class> friend class AstNodeFactory; 2894 template<class> friend class AstNodeFactory;
2897 2895
2898 // Node visitors. 2896 // Node visitors.
2899 #define DEF_VISIT(type) \ 2897 #define DEF_VISIT(type) \
2900 void Visit##type(type* node); 2898 void Visit##type(type* node);
2901 AST_NODE_LIST(DEF_VISIT) 2899 AST_NODE_LIST(DEF_VISIT)
2902 #undef DEF_VISIT 2900 #undef DEF_VISIT
2903 2901
2904 void increase_node_count() { properties_.add_node_count(1); } 2902 void increase_node_count() { properties_.add_node_count(1); }
2905 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); } 2903 void add_flag(AstPropertiesFlag flag) { properties_.flags()->Add(flag); }
2906 void set_dont_optimize_reason(BailoutReason reason) { 2904 void set_dont_optimize_reason(BailoutReason reason) {
2907 dont_optimize_reason_ = reason; 2905 dont_optimize_reason_ = reason;
2908 } 2906 }
2909 2907
2910 void add_slot_node(FeedbackSlotInterface* slot_node) { 2908 void add_slot_node(FeedbackSlotInterface* slot_node) {
2911 int count = slot_node->ComputeFeedbackSlotCount(); 2909 int count = slot_node->ComputeFeedbackSlotCount();
2912 if (count > 0) { 2910 if (count > 0) {
2913 slot_node->SetFirstFeedbackSlot(properties_.feedback_slots()); 2911 slot_node->SetFirstFeedbackSlot(properties_.feedback_slots());
2914 properties_.increase_feedback_slots(count); 2912 properties_.increase_feedback_slots(count);
2915 } 2913 }
2916 } 2914 }
2917 2915
2918 AstProperties properties_; 2916 AstProperties properties_;
2919 BailoutReason dont_optimize_reason_; 2917 BailoutReason dont_optimize_reason_;
2920 Zone* zone_;
2921 }; 2918 };
2922 2919
2923 2920
2924 class AstNullVisitor BASE_EMBEDDED { 2921 class AstNullVisitor BASE_EMBEDDED {
2925 public: 2922 public:
2926 explicit AstNullVisitor(Zone* zone) {}
2927
2928 // Node visitors. 2923 // Node visitors.
2929 #define DEF_VISIT(type) \ 2924 #define DEF_VISIT(type) \
2930 void Visit##type(type* node) {} 2925 void Visit##type(type* node) {}
2931 AST_NODE_LIST(DEF_VISIT) 2926 AST_NODE_LIST(DEF_VISIT)
2932 #undef DEF_VISIT 2927 #undef DEF_VISIT
2933 }; 2928 };
2934 2929
2935 2930
2936 2931
2937 // ---------------------------------------------------------------------------- 2932 // ----------------------------------------------------------------------------
2938 // AstNode factory 2933 // AstNode factory
2939 2934
2940 template<class Visitor> 2935 template<class Visitor>
2941 class AstNodeFactory V8_FINAL BASE_EMBEDDED { 2936 class AstNodeFactory V8_FINAL BASE_EMBEDDED {
2942 public: 2937 public:
2943 explicit AstNodeFactory(Zone* zone) 2938 explicit AstNodeFactory(Zone* zone) : zone_(zone) { }
2944 : zone_(zone),
2945 visitor_(zone) { }
2946 2939
2947 Visitor* visitor() { return &visitor_; } 2940 Visitor* visitor() { return &visitor_; }
2948 2941
2949 #define VISIT_AND_RETURN(NodeType, node) \ 2942 #define VISIT_AND_RETURN(NodeType, node) \
2950 visitor_.Visit##NodeType((node)); \ 2943 visitor_.Visit##NodeType((node)); \
2951 return node; 2944 return node;
2952 2945
2953 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, 2946 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy,
2954 VariableMode mode, 2947 VariableMode mode,
2955 Scope* scope, 2948 Scope* scope,
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
3340 3333
3341 private: 3334 private:
3342 Zone* zone_; 3335 Zone* zone_;
3343 Visitor visitor_; 3336 Visitor visitor_;
3344 }; 3337 };
3345 3338
3346 3339
3347 } } // namespace v8::internal 3340 } } // namespace v8::internal
3348 3341
3349 #endif // V8_AST_H_ 3342 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698