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

Side by Side Diff: src/hydrogen.h

Issue 1088993003: Replace OVERRIDE->override and FINAL->final since we now require C++11. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/hydrogen-gvn.h » ('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_HYDROGEN_H_ 5 #ifndef V8_HYDROGEN_H_
6 #define V8_HYDROGEN_H_ 6 #define V8_HYDROGEN_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 14 matching lines...) Expand all
25 class HEnvironment; 25 class HEnvironment;
26 class HGraph; 26 class HGraph;
27 class HLoopInformation; 27 class HLoopInformation;
28 class HOsrBuilder; 28 class HOsrBuilder;
29 class HTracer; 29 class HTracer;
30 class LAllocator; 30 class LAllocator;
31 class LChunk; 31 class LChunk;
32 class LiveRange; 32 class LiveRange;
33 33
34 34
35 class HBasicBlock FINAL : public ZoneObject { 35 class HBasicBlock final : public ZoneObject {
36 public: 36 public:
37 explicit HBasicBlock(HGraph* graph); 37 explicit HBasicBlock(HGraph* graph);
38 ~HBasicBlock() { } 38 ~HBasicBlock() { }
39 39
40 // Simple accessors. 40 // Simple accessors.
41 int block_id() const { return block_id_; } 41 int block_id() const { return block_id_; }
42 void set_block_id(int id) { block_id_ = id; } 42 void set_block_id(int id) { block_id_ = id; }
43 HGraph* graph() const { return graph_; } 43 HGraph* graph() const { return graph_; }
44 Isolate* isolate() const; 44 Isolate* isolate() const;
45 const ZoneList<HPhi*>* phis() const { return &phis_; } 45 const ZoneList<HPhi*>* phis() const { return &phis_; }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 bool is_reachable_ : 1; 207 bool is_reachable_ : 1;
208 bool dominates_loop_successors_ : 1; 208 bool dominates_loop_successors_ : 1;
209 bool is_osr_entry_ : 1; 209 bool is_osr_entry_ : 1;
210 bool is_ordered_ : 1; 210 bool is_ordered_ : 1;
211 }; 211 };
212 212
213 213
214 std::ostream& operator<<(std::ostream& os, const HBasicBlock& b); 214 std::ostream& operator<<(std::ostream& os, const HBasicBlock& b);
215 215
216 216
217 class HPredecessorIterator FINAL BASE_EMBEDDED { 217 class HPredecessorIterator final BASE_EMBEDDED {
218 public: 218 public:
219 explicit HPredecessorIterator(HBasicBlock* block) 219 explicit HPredecessorIterator(HBasicBlock* block)
220 : predecessor_list_(block->predecessors()), current_(0) { } 220 : predecessor_list_(block->predecessors()), current_(0) { }
221 221
222 bool Done() { return current_ >= predecessor_list_->length(); } 222 bool Done() { return current_ >= predecessor_list_->length(); }
223 HBasicBlock* Current() { return predecessor_list_->at(current_); } 223 HBasicBlock* Current() { return predecessor_list_->at(current_); }
224 void Advance() { current_++; } 224 void Advance() { current_++; }
225 225
226 private: 226 private:
227 const ZoneList<HBasicBlock*>* predecessor_list_; 227 const ZoneList<HBasicBlock*>* predecessor_list_;
228 int current_; 228 int current_;
229 }; 229 };
230 230
231 231
232 class HInstructionIterator FINAL BASE_EMBEDDED { 232 class HInstructionIterator final BASE_EMBEDDED {
233 public: 233 public:
234 explicit HInstructionIterator(HBasicBlock* block) 234 explicit HInstructionIterator(HBasicBlock* block)
235 : instr_(block->first()) { 235 : instr_(block->first()) {
236 next_ = Done() ? NULL : instr_->next(); 236 next_ = Done() ? NULL : instr_->next();
237 } 237 }
238 238
239 inline bool Done() const { return instr_ == NULL; } 239 inline bool Done() const { return instr_ == NULL; }
240 inline HInstruction* Current() { return instr_; } 240 inline HInstruction* Current() { return instr_; }
241 inline void Advance() { 241 inline void Advance() {
242 instr_ = next_; 242 instr_ = next_;
243 next_ = Done() ? NULL : instr_->next(); 243 next_ = Done() ? NULL : instr_->next();
244 } 244 }
245 245
246 private: 246 private:
247 HInstruction* instr_; 247 HInstruction* instr_;
248 HInstruction* next_; 248 HInstruction* next_;
249 }; 249 };
250 250
251 251
252 class HLoopInformation FINAL : public ZoneObject { 252 class HLoopInformation final : public ZoneObject {
253 public: 253 public:
254 HLoopInformation(HBasicBlock* loop_header, Zone* zone) 254 HLoopInformation(HBasicBlock* loop_header, Zone* zone)
255 : back_edges_(4, zone), 255 : back_edges_(4, zone),
256 loop_header_(loop_header), 256 loop_header_(loop_header),
257 blocks_(8, zone), 257 blocks_(8, zone),
258 stack_check_(NULL) { 258 stack_check_(NULL) {
259 blocks_.Add(loop_header, zone); 259 blocks_.Add(loop_header, zone);
260 } 260 }
261 ~HLoopInformation() {} 261 ~HLoopInformation() {}
262 262
(...skipping 27 matching lines...) Expand all
290 290
291 ZoneList<HBasicBlock*> back_edges_; 291 ZoneList<HBasicBlock*> back_edges_;
292 HBasicBlock* loop_header_; 292 HBasicBlock* loop_header_;
293 ZoneList<HBasicBlock*> blocks_; 293 ZoneList<HBasicBlock*> blocks_;
294 HStackCheck* stack_check_; 294 HStackCheck* stack_check_;
295 }; 295 };
296 296
297 297
298 class BoundsCheckTable; 298 class BoundsCheckTable;
299 class InductionVariableBlocksTable; 299 class InductionVariableBlocksTable;
300 class HGraph FINAL : public ZoneObject { 300 class HGraph final : public ZoneObject {
301 public: 301 public:
302 explicit HGraph(CompilationInfo* info); 302 explicit HGraph(CompilationInfo* info);
303 303
304 Isolate* isolate() const { return isolate_; } 304 Isolate* isolate() const { return isolate_; }
305 Zone* zone() const { return zone_; } 305 Zone* zone() const { return zone_; }
306 CompilationInfo* info() const { return info_; } 306 CompilationInfo* info() const { return info_; }
307 307
308 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } 308 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
309 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } 309 const ZoneList<HPhi*>* phi_list() const { return phi_list_; }
310 HBasicBlock* entry_block() const { return entry_block_; } 310 HBasicBlock* entry_block() const { return entry_block_; }
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 enum FrameType { 516 enum FrameType {
517 JS_FUNCTION, 517 JS_FUNCTION,
518 JS_CONSTRUCT, 518 JS_CONSTRUCT,
519 JS_GETTER, 519 JS_GETTER,
520 JS_SETTER, 520 JS_SETTER,
521 ARGUMENTS_ADAPTOR, 521 ARGUMENTS_ADAPTOR,
522 STUB 522 STUB
523 }; 523 };
524 524
525 525
526 class HEnvironment FINAL : public ZoneObject { 526 class HEnvironment final : public ZoneObject {
527 public: 527 public:
528 HEnvironment(HEnvironment* outer, 528 HEnvironment(HEnvironment* outer,
529 Scope* scope, 529 Scope* scope,
530 Handle<JSFunction> closure, 530 Handle<JSFunction> closure,
531 Zone* zone); 531 Zone* zone);
532 532
533 HEnvironment(Zone* zone, int parameter_count); 533 HEnvironment(Zone* zone, int parameter_count);
534 534
535 HEnvironment* arguments_environment() { 535 HEnvironment* arguments_environment() {
536 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this; 536 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this;
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 #endif 783 #endif
784 784
785 private: 785 private:
786 HOptimizedGraphBuilder* owner_; 786 HOptimizedGraphBuilder* owner_;
787 Expression::Context kind_; 787 Expression::Context kind_;
788 AstContext* outer_; 788 AstContext* outer_;
789 bool for_typeof_; 789 bool for_typeof_;
790 }; 790 };
791 791
792 792
793 class EffectContext FINAL : public AstContext { 793 class EffectContext final : public AstContext {
794 public: 794 public:
795 explicit EffectContext(HOptimizedGraphBuilder* owner) 795 explicit EffectContext(HOptimizedGraphBuilder* owner)
796 : AstContext(owner, Expression::kEffect) { 796 : AstContext(owner, Expression::kEffect) {
797 } 797 }
798 virtual ~EffectContext(); 798 virtual ~EffectContext();
799 799
800 void ReturnValue(HValue* value) OVERRIDE; 800 void ReturnValue(HValue* value) override;
801 virtual void ReturnInstruction(HInstruction* instr, 801 virtual void ReturnInstruction(HInstruction* instr,
802 BailoutId ast_id) OVERRIDE; 802 BailoutId ast_id) override;
803 virtual void ReturnControl(HControlInstruction* instr, 803 virtual void ReturnControl(HControlInstruction* instr,
804 BailoutId ast_id) OVERRIDE; 804 BailoutId ast_id) override;
805 virtual void ReturnContinuation(HIfContinuation* continuation, 805 virtual void ReturnContinuation(HIfContinuation* continuation,
806 BailoutId ast_id) OVERRIDE; 806 BailoutId ast_id) override;
807 }; 807 };
808 808
809 809
810 class ValueContext FINAL : public AstContext { 810 class ValueContext final : public AstContext {
811 public: 811 public:
812 ValueContext(HOptimizedGraphBuilder* owner, ArgumentsAllowedFlag flag) 812 ValueContext(HOptimizedGraphBuilder* owner, ArgumentsAllowedFlag flag)
813 : AstContext(owner, Expression::kValue), flag_(flag) { 813 : AstContext(owner, Expression::kValue), flag_(flag) {
814 } 814 }
815 virtual ~ValueContext(); 815 virtual ~ValueContext();
816 816
817 void ReturnValue(HValue* value) OVERRIDE; 817 void ReturnValue(HValue* value) override;
818 virtual void ReturnInstruction(HInstruction* instr, 818 virtual void ReturnInstruction(HInstruction* instr,
819 BailoutId ast_id) OVERRIDE; 819 BailoutId ast_id) override;
820 virtual void ReturnControl(HControlInstruction* instr, 820 virtual void ReturnControl(HControlInstruction* instr,
821 BailoutId ast_id) OVERRIDE; 821 BailoutId ast_id) override;
822 virtual void ReturnContinuation(HIfContinuation* continuation, 822 virtual void ReturnContinuation(HIfContinuation* continuation,
823 BailoutId ast_id) OVERRIDE; 823 BailoutId ast_id) override;
824 824
825 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; } 825 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; }
826 826
827 private: 827 private:
828 ArgumentsAllowedFlag flag_; 828 ArgumentsAllowedFlag flag_;
829 }; 829 };
830 830
831 831
832 class TestContext FINAL : public AstContext { 832 class TestContext final : public AstContext {
833 public: 833 public:
834 TestContext(HOptimizedGraphBuilder* owner, 834 TestContext(HOptimizedGraphBuilder* owner,
835 Expression* condition, 835 Expression* condition,
836 HBasicBlock* if_true, 836 HBasicBlock* if_true,
837 HBasicBlock* if_false) 837 HBasicBlock* if_false)
838 : AstContext(owner, Expression::kTest), 838 : AstContext(owner, Expression::kTest),
839 condition_(condition), 839 condition_(condition),
840 if_true_(if_true), 840 if_true_(if_true),
841 if_false_(if_false) { 841 if_false_(if_false) {
842 } 842 }
843 843
844 void ReturnValue(HValue* value) OVERRIDE; 844 void ReturnValue(HValue* value) override;
845 virtual void ReturnInstruction(HInstruction* instr, 845 virtual void ReturnInstruction(HInstruction* instr,
846 BailoutId ast_id) OVERRIDE; 846 BailoutId ast_id) override;
847 virtual void ReturnControl(HControlInstruction* instr, 847 virtual void ReturnControl(HControlInstruction* instr,
848 BailoutId ast_id) OVERRIDE; 848 BailoutId ast_id) override;
849 virtual void ReturnContinuation(HIfContinuation* continuation, 849 virtual void ReturnContinuation(HIfContinuation* continuation,
850 BailoutId ast_id) OVERRIDE; 850 BailoutId ast_id) override;
851 851
852 static TestContext* cast(AstContext* context) { 852 static TestContext* cast(AstContext* context) {
853 DCHECK(context->IsTest()); 853 DCHECK(context->IsTest());
854 return reinterpret_cast<TestContext*>(context); 854 return reinterpret_cast<TestContext*>(context);
855 } 855 }
856 856
857 Expression* condition() const { return condition_; } 857 Expression* condition() const { return condition_; }
858 HBasicBlock* if_true() const { return if_true_; } 858 HBasicBlock* if_true() const { return if_true_; }
859 HBasicBlock* if_false() const { return if_false_; } 859 HBasicBlock* if_false() const { return if_false_; }
860 860
861 private: 861 private:
862 // Build the shared core part of the translation unpacking a value into 862 // Build the shared core part of the translation unpacking a value into
863 // control flow. 863 // control flow.
864 void BuildBranch(HValue* value); 864 void BuildBranch(HValue* value);
865 865
866 Expression* condition_; 866 Expression* condition_;
867 HBasicBlock* if_true_; 867 HBasicBlock* if_true_;
868 HBasicBlock* if_false_; 868 HBasicBlock* if_false_;
869 }; 869 };
870 870
871 871
872 class FunctionState FINAL { 872 class FunctionState final {
873 public: 873 public:
874 FunctionState(HOptimizedGraphBuilder* owner, 874 FunctionState(HOptimizedGraphBuilder* owner,
875 CompilationInfo* info, 875 CompilationInfo* info,
876 InliningKind inlining_kind, 876 InliningKind inlining_kind,
877 int inlining_id); 877 int inlining_id);
878 ~FunctionState(); 878 ~FunctionState();
879 879
880 CompilationInfo* compilation_info() { return compilation_info_; } 880 CompilationInfo* compilation_info() { return compilation_info_; }
881 AstContext* call_context() { return call_context_; } 881 AstContext* call_context() { return call_context_; }
882 InliningKind inlining_kind() const { return inlining_kind_; } 882 InliningKind inlining_kind() const { return inlining_kind_; }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 HArgumentsObject* arguments_object_; 935 HArgumentsObject* arguments_object_;
936 HArgumentsElements* arguments_elements_; 936 HArgumentsElements* arguments_elements_;
937 937
938 int inlining_id_; 938 int inlining_id_;
939 SourcePosition outer_source_position_; 939 SourcePosition outer_source_position_;
940 940
941 FunctionState* outer_; 941 FunctionState* outer_;
942 }; 942 };
943 943
944 944
945 class HIfContinuation FINAL { 945 class HIfContinuation final {
946 public: 946 public:
947 HIfContinuation() 947 HIfContinuation()
948 : continuation_captured_(false), 948 : continuation_captured_(false),
949 true_branch_(NULL), 949 true_branch_(NULL),
950 false_branch_(NULL) {} 950 false_branch_(NULL) {}
951 HIfContinuation(HBasicBlock* true_branch, 951 HIfContinuation(HBasicBlock* true_branch,
952 HBasicBlock* false_branch) 952 HBasicBlock* false_branch)
953 : continuation_captured_(true), true_branch_(true_branch), 953 : continuation_captured_(true), true_branch_(true_branch),
954 false_branch_(false_branch) {} 954 false_branch_(false_branch) {}
955 ~HIfContinuation() { DCHECK(!continuation_captured_); } 955 ~HIfContinuation() { DCHECK(!continuation_captured_); }
(...skipping 23 matching lines...) Expand all
979 HBasicBlock* true_branch() const { return true_branch_; } 979 HBasicBlock* true_branch() const { return true_branch_; }
980 HBasicBlock* false_branch() const { return false_branch_; } 980 HBasicBlock* false_branch() const { return false_branch_; }
981 981
982 private: 982 private:
983 bool continuation_captured_; 983 bool continuation_captured_;
984 HBasicBlock* true_branch_; 984 HBasicBlock* true_branch_;
985 HBasicBlock* false_branch_; 985 HBasicBlock* false_branch_;
986 }; 986 };
987 987
988 988
989 class HAllocationMode FINAL BASE_EMBEDDED { 989 class HAllocationMode final BASE_EMBEDDED {
990 public: 990 public:
991 explicit HAllocationMode(Handle<AllocationSite> feedback_site) 991 explicit HAllocationMode(Handle<AllocationSite> feedback_site)
992 : current_site_(NULL), feedback_site_(feedback_site), 992 : current_site_(NULL), feedback_site_(feedback_site),
993 pretenure_flag_(NOT_TENURED) {} 993 pretenure_flag_(NOT_TENURED) {}
994 explicit HAllocationMode(HValue* current_site) 994 explicit HAllocationMode(HValue* current_site)
995 : current_site_(current_site), pretenure_flag_(NOT_TENURED) {} 995 : current_site_(current_site), pretenure_flag_(NOT_TENURED) {}
996 explicit HAllocationMode(PretenureFlag pretenure_flag) 996 explicit HAllocationMode(PretenureFlag pretenure_flag)
997 : current_site_(NULL), pretenure_flag_(pretenure_flag) {} 997 : current_site_(NULL), pretenure_flag_(pretenure_flag) {}
998 HAllocationMode() 998 HAllocationMode()
999 : current_site_(NULL), pretenure_flag_(NOT_TENURED) {} 999 : current_site_(NULL), pretenure_flag_(NOT_TENURED) {}
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 1451
1452 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); 1452 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin);
1453 1453
1454 HValue* EnforceNumberType(HValue* number, Type* expected); 1454 HValue* EnforceNumberType(HValue* number, Type* expected);
1455 HValue* TruncateToNumber(HValue* value, Type** expected); 1455 HValue* TruncateToNumber(HValue* value, Type** expected);
1456 1456
1457 void FinishExitWithHardDeoptimization(Deoptimizer::DeoptReason reason); 1457 void FinishExitWithHardDeoptimization(Deoptimizer::DeoptReason reason);
1458 1458
1459 void AddIncrementCounter(StatsCounter* counter); 1459 void AddIncrementCounter(StatsCounter* counter);
1460 1460
1461 class IfBuilder FINAL { 1461 class IfBuilder final {
1462 public: 1462 public:
1463 // If using this constructor, Initialize() must be called explicitly! 1463 // If using this constructor, Initialize() must be called explicitly!
1464 IfBuilder(); 1464 IfBuilder();
1465 1465
1466 explicit IfBuilder(HGraphBuilder* builder); 1466 explicit IfBuilder(HGraphBuilder* builder);
1467 IfBuilder(HGraphBuilder* builder, 1467 IfBuilder(HGraphBuilder* builder,
1468 HIfContinuation* continuation); 1468 HIfContinuation* continuation);
1469 1469
1470 ~IfBuilder() { 1470 ~IfBuilder() {
1471 if (!finished_) End(); 1471 if (!finished_) End();
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 bool needs_compare_ : 1; 1654 bool needs_compare_ : 1;
1655 bool pending_merge_block_ : 1; 1655 bool pending_merge_block_ : 1;
1656 HBasicBlock* first_true_block_; 1656 HBasicBlock* first_true_block_;
1657 HBasicBlock* first_false_block_; 1657 HBasicBlock* first_false_block_;
1658 HBasicBlock* split_edge_merge_block_; 1658 HBasicBlock* split_edge_merge_block_;
1659 MergeAtJoinBlock* merge_at_join_blocks_; 1659 MergeAtJoinBlock* merge_at_join_blocks_;
1660 int normal_merge_at_join_block_count_; 1660 int normal_merge_at_join_block_count_;
1661 int deopt_merge_at_join_block_count_; 1661 int deopt_merge_at_join_block_count_;
1662 }; 1662 };
1663 1663
1664 class LoopBuilder FINAL { 1664 class LoopBuilder final {
1665 public: 1665 public:
1666 enum Direction { 1666 enum Direction {
1667 kPreIncrement, 1667 kPreIncrement,
1668 kPostIncrement, 1668 kPostIncrement,
1669 kPreDecrement, 1669 kPreDecrement,
1670 kPostDecrement, 1670 kPostDecrement,
1671 kWhileTrue 1671 kWhileTrue
1672 }; 1672 };
1673 1673
1674 explicit LoopBuilder(HGraphBuilder* builder); // while (true) {...} 1674 explicit LoopBuilder(HGraphBuilder* builder); // while (true) {...}
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 HBasicBlock* header_block_; 1708 HBasicBlock* header_block_;
1709 HBasicBlock* body_block_; 1709 HBasicBlock* body_block_;
1710 HBasicBlock* exit_block_; 1710 HBasicBlock* exit_block_;
1711 HBasicBlock* exit_trampoline_block_; 1711 HBasicBlock* exit_trampoline_block_;
1712 Direction direction_; 1712 Direction direction_;
1713 bool finished_; 1713 bool finished_;
1714 }; 1714 };
1715 1715
1716 HValue* BuildNewElementsCapacity(HValue* old_capacity); 1716 HValue* BuildNewElementsCapacity(HValue* old_capacity);
1717 1717
1718 class JSArrayBuilder FINAL { 1718 class JSArrayBuilder final {
1719 public: 1719 public:
1720 JSArrayBuilder(HGraphBuilder* builder, 1720 JSArrayBuilder(HGraphBuilder* builder,
1721 ElementsKind kind, 1721 ElementsKind kind,
1722 HValue* allocation_site_payload, 1722 HValue* allocation_site_payload,
1723 HValue* constructor_function, 1723 HValue* constructor_function,
1724 AllocationSiteOverrideMode override_mode); 1724 AllocationSiteOverrideMode override_mode);
1725 1725
1726 JSArrayBuilder(HGraphBuilder* builder, 1726 JSArrayBuilder(HGraphBuilder* builder,
1727 ElementsKind kind, 1727 ElementsKind kind,
1728 HValue* constructor_function = NULL); 1728 HValue* constructor_function = NULL);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 template<> 2029 template<>
2030 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() { 2030 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() {
2031 return New<HContext>(); 2031 return New<HContext>();
2032 } 2032 }
2033 2033
2034 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { 2034 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
2035 public: 2035 public:
2036 // A class encapsulating (lazily-allocated) break and continue blocks for 2036 // A class encapsulating (lazily-allocated) break and continue blocks for
2037 // a breakable statement. Separated from BreakAndContinueScope so that it 2037 // a breakable statement. Separated from BreakAndContinueScope so that it
2038 // can have a separate lifetime. 2038 // can have a separate lifetime.
2039 class BreakAndContinueInfo FINAL BASE_EMBEDDED { 2039 class BreakAndContinueInfo final BASE_EMBEDDED {
2040 public: 2040 public:
2041 explicit BreakAndContinueInfo(BreakableStatement* target, 2041 explicit BreakAndContinueInfo(BreakableStatement* target,
2042 Scope* scope, 2042 Scope* scope,
2043 int drop_extra = 0) 2043 int drop_extra = 0)
2044 : target_(target), 2044 : target_(target),
2045 break_block_(NULL), 2045 break_block_(NULL),
2046 continue_block_(NULL), 2046 continue_block_(NULL),
2047 scope_(scope), 2047 scope_(scope),
2048 drop_extra_(drop_extra) { 2048 drop_extra_(drop_extra) {
2049 } 2049 }
2050 2050
2051 BreakableStatement* target() { return target_; } 2051 BreakableStatement* target() { return target_; }
2052 HBasicBlock* break_block() { return break_block_; } 2052 HBasicBlock* break_block() { return break_block_; }
2053 void set_break_block(HBasicBlock* block) { break_block_ = block; } 2053 void set_break_block(HBasicBlock* block) { break_block_ = block; }
2054 HBasicBlock* continue_block() { return continue_block_; } 2054 HBasicBlock* continue_block() { return continue_block_; }
2055 void set_continue_block(HBasicBlock* block) { continue_block_ = block; } 2055 void set_continue_block(HBasicBlock* block) { continue_block_ = block; }
2056 Scope* scope() { return scope_; } 2056 Scope* scope() { return scope_; }
2057 int drop_extra() { return drop_extra_; } 2057 int drop_extra() { return drop_extra_; }
2058 2058
2059 private: 2059 private:
2060 BreakableStatement* target_; 2060 BreakableStatement* target_;
2061 HBasicBlock* break_block_; 2061 HBasicBlock* break_block_;
2062 HBasicBlock* continue_block_; 2062 HBasicBlock* continue_block_;
2063 Scope* scope_; 2063 Scope* scope_;
2064 int drop_extra_; 2064 int drop_extra_;
2065 }; 2065 };
2066 2066
2067 // A helper class to maintain a stack of current BreakAndContinueInfo 2067 // A helper class to maintain a stack of current BreakAndContinueInfo
2068 // structures mirroring BreakableStatement nesting. 2068 // structures mirroring BreakableStatement nesting.
2069 class BreakAndContinueScope FINAL BASE_EMBEDDED { 2069 class BreakAndContinueScope final BASE_EMBEDDED {
2070 public: 2070 public:
2071 BreakAndContinueScope(BreakAndContinueInfo* info, 2071 BreakAndContinueScope(BreakAndContinueInfo* info,
2072 HOptimizedGraphBuilder* owner) 2072 HOptimizedGraphBuilder* owner)
2073 : info_(info), owner_(owner), next_(owner->break_scope()) { 2073 : info_(info), owner_(owner), next_(owner->break_scope()) {
2074 owner->set_break_scope(this); 2074 owner->set_break_scope(this);
2075 } 2075 }
2076 2076
2077 ~BreakAndContinueScope() { owner_->set_break_scope(next_); } 2077 ~BreakAndContinueScope() { owner_->set_break_scope(next_); }
2078 2078
2079 BreakAndContinueInfo* info() { return info_; } 2079 BreakAndContinueInfo* info() { return info_; }
2080 HOptimizedGraphBuilder* owner() { return owner_; } 2080 HOptimizedGraphBuilder* owner() { return owner_; }
2081 BreakAndContinueScope* next() { return next_; } 2081 BreakAndContinueScope* next() { return next_; }
2082 2082
2083 // Search the break stack for a break or continue target. 2083 // Search the break stack for a break or continue target.
2084 enum BreakType { BREAK, CONTINUE }; 2084 enum BreakType { BREAK, CONTINUE };
2085 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, 2085 HBasicBlock* Get(BreakableStatement* stmt, BreakType type,
2086 Scope** scope, int* drop_extra); 2086 Scope** scope, int* drop_extra);
2087 2087
2088 private: 2088 private:
2089 BreakAndContinueInfo* info_; 2089 BreakAndContinueInfo* info_;
2090 HOptimizedGraphBuilder* owner_; 2090 HOptimizedGraphBuilder* owner_;
2091 BreakAndContinueScope* next_; 2091 BreakAndContinueScope* next_;
2092 }; 2092 };
2093 2093
2094 explicit HOptimizedGraphBuilder(CompilationInfo* info); 2094 explicit HOptimizedGraphBuilder(CompilationInfo* info);
2095 2095
2096 bool BuildGraph() OVERRIDE; 2096 bool BuildGraph() override;
2097 2097
2098 // Simple accessors. 2098 // Simple accessors.
2099 BreakAndContinueScope* break_scope() const { return break_scope_; } 2099 BreakAndContinueScope* break_scope() const { return break_scope_; }
2100 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } 2100 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; }
2101 2101
2102 HValue* context() OVERRIDE { return environment()->context(); } 2102 HValue* context() override { return environment()->context(); }
2103 2103
2104 HOsrBuilder* osr() const { return osr_; } 2104 HOsrBuilder* osr() const { return osr_; }
2105 2105
2106 void Bailout(BailoutReason reason); 2106 void Bailout(BailoutReason reason);
2107 2107
2108 HBasicBlock* CreateJoin(HBasicBlock* first, 2108 HBasicBlock* CreateJoin(HBasicBlock* first,
2109 HBasicBlock* second, 2109 HBasicBlock* second,
2110 BailoutId join_id); 2110 BailoutId join_id);
2111 2111
2112 FunctionState* function_state() const { return function_state_; } 2112 FunctionState* function_state() const { return function_state_; }
2113 2113
2114 void VisitDeclarations(ZoneList<Declaration*>* declarations) OVERRIDE; 2114 void VisitDeclarations(ZoneList<Declaration*>* declarations) override;
2115 2115
2116 void* operator new(size_t size, Zone* zone) { return zone->New(size); } 2116 void* operator new(size_t size, Zone* zone) { return zone->New(size); }
2117 void operator delete(void* pointer, Zone* zone) { } 2117 void operator delete(void* pointer, Zone* zone) { }
2118 void operator delete(void* pointer) { } 2118 void operator delete(void* pointer) { }
2119 2119
2120 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 2120 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
2121 2121
2122 protected: 2122 protected:
2123 // Forward declarations for inner scope classes. 2123 // Forward declarations for inner scope classes.
2124 class SubgraphScope; 2124 class SubgraphScope;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 // test contexts.) 2334 // test contexts.)
2335 void VisitForValue(Expression* expr, 2335 void VisitForValue(Expression* expr,
2336 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED); 2336 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED);
2337 void VisitForTypeOf(Expression* expr); 2337 void VisitForTypeOf(Expression* expr);
2338 void VisitForEffect(Expression* expr); 2338 void VisitForEffect(Expression* expr);
2339 void VisitForControl(Expression* expr, 2339 void VisitForControl(Expression* expr,
2340 HBasicBlock* true_block, 2340 HBasicBlock* true_block,
2341 HBasicBlock* false_block); 2341 HBasicBlock* false_block);
2342 2342
2343 // Visit a list of expressions from left to right, each in a value context. 2343 // Visit a list of expressions from left to right, each in a value context.
2344 void VisitExpressions(ZoneList<Expression*>* exprs) OVERRIDE; 2344 void VisitExpressions(ZoneList<Expression*>* exprs) override;
2345 void VisitExpressions(ZoneList<Expression*>* exprs, 2345 void VisitExpressions(ZoneList<Expression*>* exprs,
2346 ArgumentsAllowedFlag flag); 2346 ArgumentsAllowedFlag flag);
2347 2347
2348 // Remove the arguments from the bailout environment and emit instructions 2348 // Remove the arguments from the bailout environment and emit instructions
2349 // to push them as outgoing parameters. 2349 // to push them as outgoing parameters.
2350 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); 2350 template <class Instruction> HInstruction* PreProcessCall(Instruction* call);
2351 void PushArgumentsFromEnvironment(int count); 2351 void PushArgumentsFromEnvironment(int count);
2352 2352
2353 void SetUpScope(Scope* scope); 2353 void SetUpScope(Scope* scope);
2354 void VisitStatements(ZoneList<Statement*>* statements) OVERRIDE; 2354 void VisitStatements(ZoneList<Statement*>* statements) override;
2355 2355
2356 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE; 2356 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override;
2357 AST_NODE_LIST(DECLARE_VISIT) 2357 AST_NODE_LIST(DECLARE_VISIT)
2358 #undef DECLARE_VISIT 2358 #undef DECLARE_VISIT
2359 2359
2360 private: 2360 private:
2361 // Helpers for flow graph construction. 2361 // Helpers for flow graph construction.
2362 enum GlobalPropertyAccess { 2362 enum GlobalPropertyAccess {
2363 kUseCell, 2363 kUseCell,
2364 kUseGeneric 2364 kUseGeneric
2365 }; 2365 };
2366 GlobalPropertyAccess LookupGlobalProperty(Variable* var, LookupIterator* it, 2366 GlobalPropertyAccess LookupGlobalProperty(Variable* var, LookupIterator* it,
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
2873 friend class KeyedLoadFastElementStub; 2873 friend class KeyedLoadFastElementStub;
2874 friend class HOsrBuilder; 2874 friend class HOsrBuilder;
2875 2875
2876 DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder); 2876 DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder);
2877 }; 2877 };
2878 2878
2879 2879
2880 Zone* AstContext::zone() const { return owner_->zone(); } 2880 Zone* AstContext::zone() const { return owner_->zone(); }
2881 2881
2882 2882
2883 class HStatistics FINAL: public Malloced { 2883 class HStatistics final : public Malloced {
2884 public: 2884 public:
2885 HStatistics() 2885 HStatistics()
2886 : times_(5), 2886 : times_(5),
2887 names_(5), 2887 names_(5),
2888 sizes_(5), 2888 sizes_(5),
2889 total_size_(0), 2889 total_size_(0),
2890 source_size_(0) { } 2890 source_size_(0) { }
2891 2891
2892 void Initialize(CompilationInfo* info); 2892 void Initialize(CompilationInfo* info);
2893 void Print(); 2893 void Print();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2936 protected: 2936 protected:
2937 HGraph* graph() const { return graph_; } 2937 HGraph* graph() const { return graph_; }
2938 2938
2939 private: 2939 private:
2940 HGraph* graph_; 2940 HGraph* graph_;
2941 2941
2942 DISALLOW_COPY_AND_ASSIGN(HPhase); 2942 DISALLOW_COPY_AND_ASSIGN(HPhase);
2943 }; 2943 };
2944 2944
2945 2945
2946 class HTracer FINAL : public Malloced { 2946 class HTracer final : public Malloced {
2947 public: 2947 public:
2948 explicit HTracer(int isolate_id) 2948 explicit HTracer(int isolate_id)
2949 : trace_(&string_allocator_), indent_(0) { 2949 : trace_(&string_allocator_), indent_(0) {
2950 if (FLAG_trace_hydrogen_file == NULL) { 2950 if (FLAG_trace_hydrogen_file == NULL) {
2951 SNPrintF(filename_, 2951 SNPrintF(filename_,
2952 "hydrogen-%d-%d.cfg", 2952 "hydrogen-%d-%d.cfg",
2953 base::OS::GetCurrentProcessId(), 2953 base::OS::GetCurrentProcessId(),
2954 isolate_id); 2954 isolate_id);
2955 } else { 2955 } else {
2956 StrNCpy(filename_, FLAG_trace_hydrogen_file, filename_.length()); 2956 StrNCpy(filename_, FLAG_trace_hydrogen_file, filename_.length());
2957 } 2957 }
2958 WriteChars(filename_.start(), "", 0, false); 2958 WriteChars(filename_.start(), "", 0, false);
2959 } 2959 }
2960 2960
2961 void TraceCompilation(CompilationInfo* info); 2961 void TraceCompilation(CompilationInfo* info);
2962 void TraceHydrogen(const char* name, HGraph* graph); 2962 void TraceHydrogen(const char* name, HGraph* graph);
2963 void TraceLithium(const char* name, LChunk* chunk); 2963 void TraceLithium(const char* name, LChunk* chunk);
2964 void TraceLiveRanges(const char* name, LAllocator* allocator); 2964 void TraceLiveRanges(const char* name, LAllocator* allocator);
2965 2965
2966 private: 2966 private:
2967 class Tag FINAL BASE_EMBEDDED { 2967 class Tag final BASE_EMBEDDED {
2968 public: 2968 public:
2969 Tag(HTracer* tracer, const char* name) { 2969 Tag(HTracer* tracer, const char* name) {
2970 name_ = name; 2970 name_ = name;
2971 tracer_ = tracer; 2971 tracer_ = tracer;
2972 tracer->PrintIndent(); 2972 tracer->PrintIndent();
2973 tracer->trace_.Add("begin_%s\n", name); 2973 tracer->trace_.Add("begin_%s\n", name);
2974 tracer->indent_++; 2974 tracer->indent_++;
2975 } 2975 }
2976 2976
2977 ~Tag() { 2977 ~Tag() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3022 } 3022 }
3023 } 3023 }
3024 3024
3025 EmbeddedVector<char, 64> filename_; 3025 EmbeddedVector<char, 64> filename_;
3026 HeapStringAllocator string_allocator_; 3026 HeapStringAllocator string_allocator_;
3027 StringStream trace_; 3027 StringStream trace_;
3028 int indent_; 3028 int indent_;
3029 }; 3029 };
3030 3030
3031 3031
3032 class NoObservableSideEffectsScope FINAL { 3032 class NoObservableSideEffectsScope final {
3033 public: 3033 public:
3034 explicit NoObservableSideEffectsScope(HGraphBuilder* builder) : 3034 explicit NoObservableSideEffectsScope(HGraphBuilder* builder) :
3035 builder_(builder) { 3035 builder_(builder) {
3036 builder_->graph()->IncrementInNoSideEffectsScope(); 3036 builder_->graph()->IncrementInNoSideEffectsScope();
3037 } 3037 }
3038 ~NoObservableSideEffectsScope() { 3038 ~NoObservableSideEffectsScope() {
3039 builder_->graph()->DecrementInNoSideEffectsScope(); 3039 builder_->graph()->DecrementInNoSideEffectsScope();
3040 } 3040 }
3041 3041
3042 private: 3042 private:
3043 HGraphBuilder* builder_; 3043 HGraphBuilder* builder_;
3044 }; 3044 };
3045 3045
3046 3046
3047 } } // namespace v8::internal 3047 } } // namespace v8::internal
3048 3048
3049 #endif // V8_HYDROGEN_H_ 3049 #endif // V8_HYDROGEN_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/hydrogen-gvn.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698