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

Side by Side Diff: src/hydrogen.h

Issue 526223002: Use Chrome compatible naming for compiler specifics. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: mips Created 6 years, 3 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 | « 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 13 matching lines...) Expand all
24 class HEnvironment; 24 class HEnvironment;
25 class HGraph; 25 class HGraph;
26 class HLoopInformation; 26 class HLoopInformation;
27 class HOsrBuilder; 27 class HOsrBuilder;
28 class HTracer; 28 class HTracer;
29 class LAllocator; 29 class LAllocator;
30 class LChunk; 30 class LChunk;
31 class LiveRange; 31 class LiveRange;
32 32
33 33
34 class HBasicBlock V8_FINAL : public ZoneObject { 34 class HBasicBlock FINAL : public ZoneObject {
35 public: 35 public:
36 explicit HBasicBlock(HGraph* graph); 36 explicit HBasicBlock(HGraph* graph);
37 ~HBasicBlock() { } 37 ~HBasicBlock() { }
38 38
39 // Simple accessors. 39 // Simple accessors.
40 int block_id() const { return block_id_; } 40 int block_id() const { return block_id_; }
41 void set_block_id(int id) { block_id_ = id; } 41 void set_block_id(int id) { block_id_ = id; }
42 HGraph* graph() const { return graph_; } 42 HGraph* graph() const { return graph_; }
43 Isolate* isolate() const; 43 Isolate* isolate() const;
44 const ZoneList<HPhi*>* phis() const { return &phis_; } 44 const ZoneList<HPhi*>* phis() const { return &phis_; }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 bool is_reachable_ : 1; 210 bool is_reachable_ : 1;
211 bool dominates_loop_successors_ : 1; 211 bool dominates_loop_successors_ : 1;
212 bool is_osr_entry_ : 1; 212 bool is_osr_entry_ : 1;
213 bool is_ordered_ : 1; 213 bool is_ordered_ : 1;
214 }; 214 };
215 215
216 216
217 OStream& operator<<(OStream& os, const HBasicBlock& b); 217 OStream& operator<<(OStream& os, const HBasicBlock& b);
218 218
219 219
220 class HPredecessorIterator V8_FINAL BASE_EMBEDDED { 220 class HPredecessorIterator FINAL BASE_EMBEDDED {
221 public: 221 public:
222 explicit HPredecessorIterator(HBasicBlock* block) 222 explicit HPredecessorIterator(HBasicBlock* block)
223 : predecessor_list_(block->predecessors()), current_(0) { } 223 : predecessor_list_(block->predecessors()), current_(0) { }
224 224
225 bool Done() { return current_ >= predecessor_list_->length(); } 225 bool Done() { return current_ >= predecessor_list_->length(); }
226 HBasicBlock* Current() { return predecessor_list_->at(current_); } 226 HBasicBlock* Current() { return predecessor_list_->at(current_); }
227 void Advance() { current_++; } 227 void Advance() { current_++; }
228 228
229 private: 229 private:
230 const ZoneList<HBasicBlock*>* predecessor_list_; 230 const ZoneList<HBasicBlock*>* predecessor_list_;
231 int current_; 231 int current_;
232 }; 232 };
233 233
234 234
235 class HInstructionIterator V8_FINAL BASE_EMBEDDED { 235 class HInstructionIterator FINAL BASE_EMBEDDED {
236 public: 236 public:
237 explicit HInstructionIterator(HBasicBlock* block) 237 explicit HInstructionIterator(HBasicBlock* block)
238 : instr_(block->first()) { 238 : instr_(block->first()) {
239 next_ = Done() ? NULL : instr_->next(); 239 next_ = Done() ? NULL : instr_->next();
240 } 240 }
241 241
242 inline bool Done() const { return instr_ == NULL; } 242 inline bool Done() const { return instr_ == NULL; }
243 inline HInstruction* Current() { return instr_; } 243 inline HInstruction* Current() { return instr_; }
244 inline void Advance() { 244 inline void Advance() {
245 instr_ = next_; 245 instr_ = next_;
246 next_ = Done() ? NULL : instr_->next(); 246 next_ = Done() ? NULL : instr_->next();
247 } 247 }
248 248
249 private: 249 private:
250 HInstruction* instr_; 250 HInstruction* instr_;
251 HInstruction* next_; 251 HInstruction* next_;
252 }; 252 };
253 253
254 254
255 class HLoopInformation V8_FINAL : public ZoneObject { 255 class HLoopInformation FINAL : public ZoneObject {
256 public: 256 public:
257 HLoopInformation(HBasicBlock* loop_header, Zone* zone) 257 HLoopInformation(HBasicBlock* loop_header, Zone* zone)
258 : back_edges_(4, zone), 258 : back_edges_(4, zone),
259 loop_header_(loop_header), 259 loop_header_(loop_header),
260 blocks_(8, zone), 260 blocks_(8, zone),
261 stack_check_(NULL) { 261 stack_check_(NULL) {
262 blocks_.Add(loop_header, zone); 262 blocks_.Add(loop_header, zone);
263 } 263 }
264 ~HLoopInformation() {} 264 ~HLoopInformation() {}
265 265
(...skipping 27 matching lines...) Expand all
293 293
294 ZoneList<HBasicBlock*> back_edges_; 294 ZoneList<HBasicBlock*> back_edges_;
295 HBasicBlock* loop_header_; 295 HBasicBlock* loop_header_;
296 ZoneList<HBasicBlock*> blocks_; 296 ZoneList<HBasicBlock*> blocks_;
297 HStackCheck* stack_check_; 297 HStackCheck* stack_check_;
298 }; 298 };
299 299
300 300
301 class BoundsCheckTable; 301 class BoundsCheckTable;
302 class InductionVariableBlocksTable; 302 class InductionVariableBlocksTable;
303 class HGraph V8_FINAL : public ZoneObject { 303 class HGraph FINAL : public ZoneObject {
304 public: 304 public:
305 explicit HGraph(CompilationInfo* info); 305 explicit HGraph(CompilationInfo* info);
306 306
307 Isolate* isolate() const { return isolate_; } 307 Isolate* isolate() const { return isolate_; }
308 Zone* zone() const { return zone_; } 308 Zone* zone() const { return zone_; }
309 CompilationInfo* info() const { return info_; } 309 CompilationInfo* info() const { return info_; }
310 310
311 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } 311 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; }
312 const ZoneList<HPhi*>* phi_list() const { return phi_list_; } 312 const ZoneList<HPhi*>* phi_list() const { return phi_list_; }
313 HBasicBlock* entry_block() const { return entry_block_; } 313 HBasicBlock* entry_block() const { return entry_block_; }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 enum FrameType { 540 enum FrameType {
541 JS_FUNCTION, 541 JS_FUNCTION,
542 JS_CONSTRUCT, 542 JS_CONSTRUCT,
543 JS_GETTER, 543 JS_GETTER,
544 JS_SETTER, 544 JS_SETTER,
545 ARGUMENTS_ADAPTOR, 545 ARGUMENTS_ADAPTOR,
546 STUB 546 STUB
547 }; 547 };
548 548
549 549
550 class HEnvironment V8_FINAL : public ZoneObject { 550 class HEnvironment FINAL : public ZoneObject {
551 public: 551 public:
552 HEnvironment(HEnvironment* outer, 552 HEnvironment(HEnvironment* outer,
553 Scope* scope, 553 Scope* scope,
554 Handle<JSFunction> closure, 554 Handle<JSFunction> closure,
555 Zone* zone); 555 Zone* zone);
556 556
557 HEnvironment(Zone* zone, int parameter_count); 557 HEnvironment(Zone* zone, int parameter_count);
558 558
559 HEnvironment* arguments_environment() { 559 HEnvironment* arguments_environment() {
560 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this; 560 return outer()->frame_type() == ARGUMENTS_ADAPTOR ? outer() : this;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 #endif 805 #endif
806 806
807 private: 807 private:
808 HOptimizedGraphBuilder* owner_; 808 HOptimizedGraphBuilder* owner_;
809 Expression::Context kind_; 809 Expression::Context kind_;
810 AstContext* outer_; 810 AstContext* outer_;
811 bool for_typeof_; 811 bool for_typeof_;
812 }; 812 };
813 813
814 814
815 class EffectContext V8_FINAL : public AstContext { 815 class EffectContext FINAL : public AstContext {
816 public: 816 public:
817 explicit EffectContext(HOptimizedGraphBuilder* owner) 817 explicit EffectContext(HOptimizedGraphBuilder* owner)
818 : AstContext(owner, Expression::kEffect) { 818 : AstContext(owner, Expression::kEffect) {
819 } 819 }
820 virtual ~EffectContext(); 820 virtual ~EffectContext();
821 821
822 virtual void ReturnValue(HValue* value) V8_OVERRIDE; 822 virtual void ReturnValue(HValue* value) OVERRIDE;
823 virtual void ReturnInstruction(HInstruction* instr, 823 virtual void ReturnInstruction(HInstruction* instr,
824 BailoutId ast_id) V8_OVERRIDE; 824 BailoutId ast_id) OVERRIDE;
825 virtual void ReturnControl(HControlInstruction* instr, 825 virtual void ReturnControl(HControlInstruction* instr,
826 BailoutId ast_id) V8_OVERRIDE; 826 BailoutId ast_id) OVERRIDE;
827 virtual void ReturnContinuation(HIfContinuation* continuation, 827 virtual void ReturnContinuation(HIfContinuation* continuation,
828 BailoutId ast_id) V8_OVERRIDE; 828 BailoutId ast_id) OVERRIDE;
829 }; 829 };
830 830
831 831
832 class ValueContext V8_FINAL : public AstContext { 832 class ValueContext FINAL : public AstContext {
833 public: 833 public:
834 ValueContext(HOptimizedGraphBuilder* owner, ArgumentsAllowedFlag flag) 834 ValueContext(HOptimizedGraphBuilder* owner, ArgumentsAllowedFlag flag)
835 : AstContext(owner, Expression::kValue), flag_(flag) { 835 : AstContext(owner, Expression::kValue), flag_(flag) {
836 } 836 }
837 virtual ~ValueContext(); 837 virtual ~ValueContext();
838 838
839 virtual void ReturnValue(HValue* value) V8_OVERRIDE; 839 virtual void ReturnValue(HValue* value) OVERRIDE;
840 virtual void ReturnInstruction(HInstruction* instr, 840 virtual void ReturnInstruction(HInstruction* instr,
841 BailoutId ast_id) V8_OVERRIDE; 841 BailoutId ast_id) OVERRIDE;
842 virtual void ReturnControl(HControlInstruction* instr, 842 virtual void ReturnControl(HControlInstruction* instr,
843 BailoutId ast_id) V8_OVERRIDE; 843 BailoutId ast_id) OVERRIDE;
844 virtual void ReturnContinuation(HIfContinuation* continuation, 844 virtual void ReturnContinuation(HIfContinuation* continuation,
845 BailoutId ast_id) V8_OVERRIDE; 845 BailoutId ast_id) OVERRIDE;
846 846
847 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; } 847 bool arguments_allowed() { return flag_ == ARGUMENTS_ALLOWED; }
848 848
849 private: 849 private:
850 ArgumentsAllowedFlag flag_; 850 ArgumentsAllowedFlag flag_;
851 }; 851 };
852 852
853 853
854 class TestContext V8_FINAL : public AstContext { 854 class TestContext FINAL : public AstContext {
855 public: 855 public:
856 TestContext(HOptimizedGraphBuilder* owner, 856 TestContext(HOptimizedGraphBuilder* owner,
857 Expression* condition, 857 Expression* condition,
858 HBasicBlock* if_true, 858 HBasicBlock* if_true,
859 HBasicBlock* if_false) 859 HBasicBlock* if_false)
860 : AstContext(owner, Expression::kTest), 860 : AstContext(owner, Expression::kTest),
861 condition_(condition), 861 condition_(condition),
862 if_true_(if_true), 862 if_true_(if_true),
863 if_false_(if_false) { 863 if_false_(if_false) {
864 } 864 }
865 865
866 virtual void ReturnValue(HValue* value) V8_OVERRIDE; 866 virtual void ReturnValue(HValue* value) OVERRIDE;
867 virtual void ReturnInstruction(HInstruction* instr, 867 virtual void ReturnInstruction(HInstruction* instr,
868 BailoutId ast_id) V8_OVERRIDE; 868 BailoutId ast_id) OVERRIDE;
869 virtual void ReturnControl(HControlInstruction* instr, 869 virtual void ReturnControl(HControlInstruction* instr,
870 BailoutId ast_id) V8_OVERRIDE; 870 BailoutId ast_id) OVERRIDE;
871 virtual void ReturnContinuation(HIfContinuation* continuation, 871 virtual void ReturnContinuation(HIfContinuation* continuation,
872 BailoutId ast_id) V8_OVERRIDE; 872 BailoutId ast_id) OVERRIDE;
873 873
874 static TestContext* cast(AstContext* context) { 874 static TestContext* cast(AstContext* context) {
875 DCHECK(context->IsTest()); 875 DCHECK(context->IsTest());
876 return reinterpret_cast<TestContext*>(context); 876 return reinterpret_cast<TestContext*>(context);
877 } 877 }
878 878
879 Expression* condition() const { return condition_; } 879 Expression* condition() const { return condition_; }
880 HBasicBlock* if_true() const { return if_true_; } 880 HBasicBlock* if_true() const { return if_true_; }
881 HBasicBlock* if_false() const { return if_false_; } 881 HBasicBlock* if_false() const { return if_false_; }
882 882
883 private: 883 private:
884 // Build the shared core part of the translation unpacking a value into 884 // Build the shared core part of the translation unpacking a value into
885 // control flow. 885 // control flow.
886 void BuildBranch(HValue* value); 886 void BuildBranch(HValue* value);
887 887
888 Expression* condition_; 888 Expression* condition_;
889 HBasicBlock* if_true_; 889 HBasicBlock* if_true_;
890 HBasicBlock* if_false_; 890 HBasicBlock* if_false_;
891 }; 891 };
892 892
893 893
894 class FunctionState V8_FINAL { 894 class FunctionState FINAL {
895 public: 895 public:
896 FunctionState(HOptimizedGraphBuilder* owner, 896 FunctionState(HOptimizedGraphBuilder* owner,
897 CompilationInfo* info, 897 CompilationInfo* info,
898 InliningKind inlining_kind, 898 InliningKind inlining_kind,
899 int inlining_id); 899 int inlining_id);
900 ~FunctionState(); 900 ~FunctionState();
901 901
902 CompilationInfo* compilation_info() { return compilation_info_; } 902 CompilationInfo* compilation_info() { return compilation_info_; }
903 AstContext* call_context() { return call_context_; } 903 AstContext* call_context() { return call_context_; }
904 InliningKind inlining_kind() const { return inlining_kind_; } 904 InliningKind inlining_kind() const { return inlining_kind_; }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 HArgumentsObject* arguments_object_; 957 HArgumentsObject* arguments_object_;
958 HArgumentsElements* arguments_elements_; 958 HArgumentsElements* arguments_elements_;
959 959
960 int inlining_id_; 960 int inlining_id_;
961 HSourcePosition outer_source_position_; 961 HSourcePosition outer_source_position_;
962 962
963 FunctionState* outer_; 963 FunctionState* outer_;
964 }; 964 };
965 965
966 966
967 class HIfContinuation V8_FINAL { 967 class HIfContinuation FINAL {
968 public: 968 public:
969 HIfContinuation() 969 HIfContinuation()
970 : continuation_captured_(false), 970 : continuation_captured_(false),
971 true_branch_(NULL), 971 true_branch_(NULL),
972 false_branch_(NULL) {} 972 false_branch_(NULL) {}
973 HIfContinuation(HBasicBlock* true_branch, 973 HIfContinuation(HBasicBlock* true_branch,
974 HBasicBlock* false_branch) 974 HBasicBlock* false_branch)
975 : continuation_captured_(true), true_branch_(true_branch), 975 : continuation_captured_(true), true_branch_(true_branch),
976 false_branch_(false_branch) {} 976 false_branch_(false_branch) {}
977 ~HIfContinuation() { DCHECK(!continuation_captured_); } 977 ~HIfContinuation() { DCHECK(!continuation_captured_); }
(...skipping 23 matching lines...) Expand all
1001 HBasicBlock* true_branch() const { return true_branch_; } 1001 HBasicBlock* true_branch() const { return true_branch_; }
1002 HBasicBlock* false_branch() const { return false_branch_; } 1002 HBasicBlock* false_branch() const { return false_branch_; }
1003 1003
1004 private: 1004 private:
1005 bool continuation_captured_; 1005 bool continuation_captured_;
1006 HBasicBlock* true_branch_; 1006 HBasicBlock* true_branch_;
1007 HBasicBlock* false_branch_; 1007 HBasicBlock* false_branch_;
1008 }; 1008 };
1009 1009
1010 1010
1011 class HAllocationMode V8_FINAL BASE_EMBEDDED { 1011 class HAllocationMode FINAL BASE_EMBEDDED {
1012 public: 1012 public:
1013 explicit HAllocationMode(Handle<AllocationSite> feedback_site) 1013 explicit HAllocationMode(Handle<AllocationSite> feedback_site)
1014 : current_site_(NULL), feedback_site_(feedback_site), 1014 : current_site_(NULL), feedback_site_(feedback_site),
1015 pretenure_flag_(NOT_TENURED) {} 1015 pretenure_flag_(NOT_TENURED) {}
1016 explicit HAllocationMode(HValue* current_site) 1016 explicit HAllocationMode(HValue* current_site)
1017 : current_site_(current_site), pretenure_flag_(NOT_TENURED) {} 1017 : current_site_(current_site), pretenure_flag_(NOT_TENURED) {}
1018 explicit HAllocationMode(PretenureFlag pretenure_flag) 1018 explicit HAllocationMode(PretenureFlag pretenure_flag)
1019 : current_site_(NULL), pretenure_flag_(pretenure_flag) {} 1019 : current_site_(NULL), pretenure_flag_(pretenure_flag) {}
1020 HAllocationMode() 1020 HAllocationMode()
1021 : current_site_(NULL), pretenure_flag_(NOT_TENURED) {} 1021 : current_site_(NULL), pretenure_flag_(NOT_TENURED) {}
1022 1022
1023 HValue* current_site() const { return current_site_; } 1023 HValue* current_site() const { return current_site_; }
1024 Handle<AllocationSite> feedback_site() const { return feedback_site_; } 1024 Handle<AllocationSite> feedback_site() const { return feedback_site_; }
1025 1025
1026 bool CreateAllocationMementos() const V8_WARN_UNUSED_RESULT { 1026 bool CreateAllocationMementos() const WARN_UNUSED_RESULT {
1027 return current_site() != NULL; 1027 return current_site() != NULL;
1028 } 1028 }
1029 1029
1030 PretenureFlag GetPretenureMode() const V8_WARN_UNUSED_RESULT { 1030 PretenureFlag GetPretenureMode() const WARN_UNUSED_RESULT {
1031 if (!feedback_site().is_null()) return feedback_site()->GetPretenureMode(); 1031 if (!feedback_site().is_null()) return feedback_site()->GetPretenureMode();
1032 return pretenure_flag_; 1032 return pretenure_flag_;
1033 } 1033 }
1034 1034
1035 private: 1035 private:
1036 HValue* current_site_; 1036 HValue* current_site_;
1037 Handle<AllocationSite> feedback_site_; 1037 Handle<AllocationSite> feedback_site_;
1038 PretenureFlag pretenure_flag_; 1038 PretenureFlag pretenure_flag_;
1039 }; 1039 };
1040 1040
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 1466
1467 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin); 1467 HValue* AddLoadJSBuiltin(Builtins::JavaScript builtin);
1468 1468
1469 HValue* EnforceNumberType(HValue* number, Type* expected); 1469 HValue* EnforceNumberType(HValue* number, Type* expected);
1470 HValue* TruncateToNumber(HValue* value, Type** expected); 1470 HValue* TruncateToNumber(HValue* value, Type** expected);
1471 1471
1472 void FinishExitWithHardDeoptimization(const char* reason); 1472 void FinishExitWithHardDeoptimization(const char* reason);
1473 1473
1474 void AddIncrementCounter(StatsCounter* counter); 1474 void AddIncrementCounter(StatsCounter* counter);
1475 1475
1476 class IfBuilder V8_FINAL { 1476 class IfBuilder FINAL {
1477 public: 1477 public:
1478 // If using this constructor, Initialize() must be called explicitly! 1478 // If using this constructor, Initialize() must be called explicitly!
1479 IfBuilder(); 1479 IfBuilder();
1480 1480
1481 explicit IfBuilder(HGraphBuilder* builder); 1481 explicit IfBuilder(HGraphBuilder* builder);
1482 IfBuilder(HGraphBuilder* builder, 1482 IfBuilder(HGraphBuilder* builder,
1483 HIfContinuation* continuation); 1483 HIfContinuation* continuation);
1484 1484
1485 ~IfBuilder() { 1485 ~IfBuilder() {
1486 if (!finished_) End(); 1486 if (!finished_) End();
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 bool needs_compare_ : 1; 1669 bool needs_compare_ : 1;
1670 bool pending_merge_block_ : 1; 1670 bool pending_merge_block_ : 1;
1671 HBasicBlock* first_true_block_; 1671 HBasicBlock* first_true_block_;
1672 HBasicBlock* first_false_block_; 1672 HBasicBlock* first_false_block_;
1673 HBasicBlock* split_edge_merge_block_; 1673 HBasicBlock* split_edge_merge_block_;
1674 MergeAtJoinBlock* merge_at_join_blocks_; 1674 MergeAtJoinBlock* merge_at_join_blocks_;
1675 int normal_merge_at_join_block_count_; 1675 int normal_merge_at_join_block_count_;
1676 int deopt_merge_at_join_block_count_; 1676 int deopt_merge_at_join_block_count_;
1677 }; 1677 };
1678 1678
1679 class LoopBuilder V8_FINAL { 1679 class LoopBuilder FINAL {
1680 public: 1680 public:
1681 enum Direction { 1681 enum Direction {
1682 kPreIncrement, 1682 kPreIncrement,
1683 kPostIncrement, 1683 kPostIncrement,
1684 kPreDecrement, 1684 kPreDecrement,
1685 kPostDecrement, 1685 kPostDecrement,
1686 kWhileTrue 1686 kWhileTrue
1687 }; 1687 };
1688 1688
1689 explicit LoopBuilder(HGraphBuilder* builder); // while (true) {...} 1689 explicit LoopBuilder(HGraphBuilder* builder); // while (true) {...}
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 1744
1745 template <class A, class P1, class P2, class P3> 1745 template <class A, class P1, class P2, class P3>
1746 void DeoptimizeIf(P1 p1, P2 p2, P3 p3, const char* reason) { 1746 void DeoptimizeIf(P1 p1, P2 p2, P3 p3, const char* reason) {
1747 IfBuilder builder(this); 1747 IfBuilder builder(this);
1748 builder.If<A>(p1, p2, p3); 1748 builder.If<A>(p1, p2, p3);
1749 builder.ThenDeopt(reason); 1749 builder.ThenDeopt(reason);
1750 } 1750 }
1751 1751
1752 HValue* BuildNewElementsCapacity(HValue* old_capacity); 1752 HValue* BuildNewElementsCapacity(HValue* old_capacity);
1753 1753
1754 class JSArrayBuilder V8_FINAL { 1754 class JSArrayBuilder FINAL {
1755 public: 1755 public:
1756 JSArrayBuilder(HGraphBuilder* builder, 1756 JSArrayBuilder(HGraphBuilder* builder,
1757 ElementsKind kind, 1757 ElementsKind kind,
1758 HValue* allocation_site_payload, 1758 HValue* allocation_site_payload,
1759 HValue* constructor_function, 1759 HValue* constructor_function,
1760 AllocationSiteOverrideMode override_mode); 1760 AllocationSiteOverrideMode override_mode);
1761 1761
1762 JSArrayBuilder(HGraphBuilder* builder, 1762 JSArrayBuilder(HGraphBuilder* builder,
1763 ElementsKind kind, 1763 ElementsKind kind,
1764 HValue* constructor_function = NULL); 1764 HValue* constructor_function = NULL);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 template<> 2060 template<>
2061 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() { 2061 inline HInstruction* HGraphBuilder::NewUncasted<HContext>() {
2062 return New<HContext>(); 2062 return New<HContext>();
2063 } 2063 }
2064 2064
2065 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { 2065 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
2066 public: 2066 public:
2067 // A class encapsulating (lazily-allocated) break and continue blocks for 2067 // A class encapsulating (lazily-allocated) break and continue blocks for
2068 // a breakable statement. Separated from BreakAndContinueScope so that it 2068 // a breakable statement. Separated from BreakAndContinueScope so that it
2069 // can have a separate lifetime. 2069 // can have a separate lifetime.
2070 class BreakAndContinueInfo V8_FINAL BASE_EMBEDDED { 2070 class BreakAndContinueInfo FINAL BASE_EMBEDDED {
2071 public: 2071 public:
2072 explicit BreakAndContinueInfo(BreakableStatement* target, 2072 explicit BreakAndContinueInfo(BreakableStatement* target,
2073 Scope* scope, 2073 Scope* scope,
2074 int drop_extra = 0) 2074 int drop_extra = 0)
2075 : target_(target), 2075 : target_(target),
2076 break_block_(NULL), 2076 break_block_(NULL),
2077 continue_block_(NULL), 2077 continue_block_(NULL),
2078 scope_(scope), 2078 scope_(scope),
2079 drop_extra_(drop_extra) { 2079 drop_extra_(drop_extra) {
2080 } 2080 }
2081 2081
2082 BreakableStatement* target() { return target_; } 2082 BreakableStatement* target() { return target_; }
2083 HBasicBlock* break_block() { return break_block_; } 2083 HBasicBlock* break_block() { return break_block_; }
2084 void set_break_block(HBasicBlock* block) { break_block_ = block; } 2084 void set_break_block(HBasicBlock* block) { break_block_ = block; }
2085 HBasicBlock* continue_block() { return continue_block_; } 2085 HBasicBlock* continue_block() { return continue_block_; }
2086 void set_continue_block(HBasicBlock* block) { continue_block_ = block; } 2086 void set_continue_block(HBasicBlock* block) { continue_block_ = block; }
2087 Scope* scope() { return scope_; } 2087 Scope* scope() { return scope_; }
2088 int drop_extra() { return drop_extra_; } 2088 int drop_extra() { return drop_extra_; }
2089 2089
2090 private: 2090 private:
2091 BreakableStatement* target_; 2091 BreakableStatement* target_;
2092 HBasicBlock* break_block_; 2092 HBasicBlock* break_block_;
2093 HBasicBlock* continue_block_; 2093 HBasicBlock* continue_block_;
2094 Scope* scope_; 2094 Scope* scope_;
2095 int drop_extra_; 2095 int drop_extra_;
2096 }; 2096 };
2097 2097
2098 // A helper class to maintain a stack of current BreakAndContinueInfo 2098 // A helper class to maintain a stack of current BreakAndContinueInfo
2099 // structures mirroring BreakableStatement nesting. 2099 // structures mirroring BreakableStatement nesting.
2100 class BreakAndContinueScope V8_FINAL BASE_EMBEDDED { 2100 class BreakAndContinueScope FINAL BASE_EMBEDDED {
2101 public: 2101 public:
2102 BreakAndContinueScope(BreakAndContinueInfo* info, 2102 BreakAndContinueScope(BreakAndContinueInfo* info,
2103 HOptimizedGraphBuilder* owner) 2103 HOptimizedGraphBuilder* owner)
2104 : info_(info), owner_(owner), next_(owner->break_scope()) { 2104 : info_(info), owner_(owner), next_(owner->break_scope()) {
2105 owner->set_break_scope(this); 2105 owner->set_break_scope(this);
2106 } 2106 }
2107 2107
2108 ~BreakAndContinueScope() { owner_->set_break_scope(next_); } 2108 ~BreakAndContinueScope() { owner_->set_break_scope(next_); }
2109 2109
2110 BreakAndContinueInfo* info() { return info_; } 2110 BreakAndContinueInfo* info() { return info_; }
2111 HOptimizedGraphBuilder* owner() { return owner_; } 2111 HOptimizedGraphBuilder* owner() { return owner_; }
2112 BreakAndContinueScope* next() { return next_; } 2112 BreakAndContinueScope* next() { return next_; }
2113 2113
2114 // Search the break stack for a break or continue target. 2114 // Search the break stack for a break or continue target.
2115 enum BreakType { BREAK, CONTINUE }; 2115 enum BreakType { BREAK, CONTINUE };
2116 HBasicBlock* Get(BreakableStatement* stmt, BreakType type, 2116 HBasicBlock* Get(BreakableStatement* stmt, BreakType type,
2117 Scope** scope, int* drop_extra); 2117 Scope** scope, int* drop_extra);
2118 2118
2119 private: 2119 private:
2120 BreakAndContinueInfo* info_; 2120 BreakAndContinueInfo* info_;
2121 HOptimizedGraphBuilder* owner_; 2121 HOptimizedGraphBuilder* owner_;
2122 BreakAndContinueScope* next_; 2122 BreakAndContinueScope* next_;
2123 }; 2123 };
2124 2124
2125 explicit HOptimizedGraphBuilder(CompilationInfo* info); 2125 explicit HOptimizedGraphBuilder(CompilationInfo* info);
2126 2126
2127 virtual bool BuildGraph() V8_OVERRIDE; 2127 virtual bool BuildGraph() OVERRIDE;
2128 2128
2129 // Simple accessors. 2129 // Simple accessors.
2130 BreakAndContinueScope* break_scope() const { return break_scope_; } 2130 BreakAndContinueScope* break_scope() const { return break_scope_; }
2131 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; } 2131 void set_break_scope(BreakAndContinueScope* head) { break_scope_ = head; }
2132 2132
2133 bool inline_bailout() { return inline_bailout_; } 2133 bool inline_bailout() { return inline_bailout_; }
2134 2134
2135 HValue* context() { return environment()->context(); } 2135 HValue* context() { return environment()->context(); }
2136 2136
2137 HOsrBuilder* osr() const { return osr_; } 2137 HOsrBuilder* osr() const { return osr_; }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 2306
2307 // Visit a list of expressions from left to right, each in a value context. 2307 // Visit a list of expressions from left to right, each in a value context.
2308 void VisitExpressions(ZoneList<Expression*>* exprs); 2308 void VisitExpressions(ZoneList<Expression*>* exprs);
2309 2309
2310 // Remove the arguments from the bailout environment and emit instructions 2310 // Remove the arguments from the bailout environment and emit instructions
2311 // to push them as outgoing parameters. 2311 // to push them as outgoing parameters.
2312 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); 2312 template <class Instruction> HInstruction* PreProcessCall(Instruction* call);
2313 void PushArgumentsFromEnvironment(int count); 2313 void PushArgumentsFromEnvironment(int count);
2314 2314
2315 void SetUpScope(Scope* scope); 2315 void SetUpScope(Scope* scope);
2316 virtual void VisitStatements(ZoneList<Statement*>* statements) V8_OVERRIDE; 2316 virtual void VisitStatements(ZoneList<Statement*>* statements) OVERRIDE;
2317 2317
2318 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) V8_OVERRIDE; 2318 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE;
2319 AST_NODE_LIST(DECLARE_VISIT) 2319 AST_NODE_LIST(DECLARE_VISIT)
2320 #undef DECLARE_VISIT 2320 #undef DECLARE_VISIT
2321 2321
2322 Type* ToType(Handle<Map> map) { return IC::MapToType<Type>(map, zone()); } 2322 Type* ToType(Handle<Map> map) { return IC::MapToType<Type>(map, zone()); }
2323 2323
2324 private: 2324 private:
2325 // Helpers for flow graph construction. 2325 // Helpers for flow graph construction.
2326 enum GlobalPropertyAccess { 2326 enum GlobalPropertyAccess {
2327 kUseCell, 2327 kUseCell,
2328 kUseGeneric 2328 kUseGeneric
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
2761 friend class KeyedLoadFastElementStub; 2761 friend class KeyedLoadFastElementStub;
2762 friend class HOsrBuilder; 2762 friend class HOsrBuilder;
2763 2763
2764 DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder); 2764 DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder);
2765 }; 2765 };
2766 2766
2767 2767
2768 Zone* AstContext::zone() const { return owner_->zone(); } 2768 Zone* AstContext::zone() const { return owner_->zone(); }
2769 2769
2770 2770
2771 class HStatistics V8_FINAL: public Malloced { 2771 class HStatistics FINAL: public Malloced {
2772 public: 2772 public:
2773 HStatistics() 2773 HStatistics()
2774 : times_(5), 2774 : times_(5),
2775 names_(5), 2775 names_(5),
2776 sizes_(5), 2776 sizes_(5),
2777 total_size_(0), 2777 total_size_(0),
2778 source_size_(0) { } 2778 source_size_(0) { }
2779 2779
2780 void Initialize(CompilationInfo* info); 2780 void Initialize(CompilationInfo* info);
2781 void Print(const char* stats_name); 2781 void Print(const char* stats_name);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2824 protected: 2824 protected:
2825 HGraph* graph() const { return graph_; } 2825 HGraph* graph() const { return graph_; }
2826 2826
2827 private: 2827 private:
2828 HGraph* graph_; 2828 HGraph* graph_;
2829 2829
2830 DISALLOW_COPY_AND_ASSIGN(HPhase); 2830 DISALLOW_COPY_AND_ASSIGN(HPhase);
2831 }; 2831 };
2832 2832
2833 2833
2834 class HTracer V8_FINAL : public Malloced { 2834 class HTracer FINAL : public Malloced {
2835 public: 2835 public:
2836 explicit HTracer(int isolate_id) 2836 explicit HTracer(int isolate_id)
2837 : trace_(&string_allocator_), indent_(0) { 2837 : trace_(&string_allocator_), indent_(0) {
2838 if (FLAG_trace_hydrogen_file == NULL) { 2838 if (FLAG_trace_hydrogen_file == NULL) {
2839 SNPrintF(filename_, 2839 SNPrintF(filename_,
2840 "hydrogen-%d-%d.cfg", 2840 "hydrogen-%d-%d.cfg",
2841 base::OS::GetCurrentProcessId(), 2841 base::OS::GetCurrentProcessId(),
2842 isolate_id); 2842 isolate_id);
2843 } else { 2843 } else {
2844 StrNCpy(filename_, FLAG_trace_hydrogen_file, filename_.length()); 2844 StrNCpy(filename_, FLAG_trace_hydrogen_file, filename_.length());
2845 } 2845 }
2846 WriteChars(filename_.start(), "", 0, false); 2846 WriteChars(filename_.start(), "", 0, false);
2847 } 2847 }
2848 2848
2849 void TraceCompilation(CompilationInfo* info); 2849 void TraceCompilation(CompilationInfo* info);
2850 void TraceHydrogen(const char* name, HGraph* graph); 2850 void TraceHydrogen(const char* name, HGraph* graph);
2851 void TraceLithium(const char* name, LChunk* chunk); 2851 void TraceLithium(const char* name, LChunk* chunk);
2852 void TraceLiveRanges(const char* name, LAllocator* allocator); 2852 void TraceLiveRanges(const char* name, LAllocator* allocator);
2853 2853
2854 private: 2854 private:
2855 class Tag V8_FINAL BASE_EMBEDDED { 2855 class Tag FINAL BASE_EMBEDDED {
2856 public: 2856 public:
2857 Tag(HTracer* tracer, const char* name) { 2857 Tag(HTracer* tracer, const char* name) {
2858 name_ = name; 2858 name_ = name;
2859 tracer_ = tracer; 2859 tracer_ = tracer;
2860 tracer->PrintIndent(); 2860 tracer->PrintIndent();
2861 tracer->trace_.Add("begin_%s\n", name); 2861 tracer->trace_.Add("begin_%s\n", name);
2862 tracer->indent_++; 2862 tracer->indent_++;
2863 } 2863 }
2864 2864
2865 ~Tag() { 2865 ~Tag() {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2910 } 2910 }
2911 } 2911 }
2912 2912
2913 EmbeddedVector<char, 64> filename_; 2913 EmbeddedVector<char, 64> filename_;
2914 HeapStringAllocator string_allocator_; 2914 HeapStringAllocator string_allocator_;
2915 StringStream trace_; 2915 StringStream trace_;
2916 int indent_; 2916 int indent_;
2917 }; 2917 };
2918 2918
2919 2919
2920 class NoObservableSideEffectsScope V8_FINAL { 2920 class NoObservableSideEffectsScope FINAL {
2921 public: 2921 public:
2922 explicit NoObservableSideEffectsScope(HGraphBuilder* builder) : 2922 explicit NoObservableSideEffectsScope(HGraphBuilder* builder) :
2923 builder_(builder) { 2923 builder_(builder) {
2924 builder_->graph()->IncrementInNoSideEffectsScope(); 2924 builder_->graph()->IncrementInNoSideEffectsScope();
2925 } 2925 }
2926 ~NoObservableSideEffectsScope() { 2926 ~NoObservableSideEffectsScope() {
2927 builder_->graph()->DecrementInNoSideEffectsScope(); 2927 builder_->graph()->DecrementInNoSideEffectsScope();
2928 } 2928 }
2929 2929
2930 private: 2930 private:
2931 HGraphBuilder* builder_; 2931 HGraphBuilder* builder_;
2932 }; 2932 };
2933 2933
2934 2934
2935 } } // namespace v8::internal 2935 } } // namespace v8::internal
2936 2936
2937 #endif // V8_HYDROGEN_H_ 2937 #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