OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 bool IsStartBlock() const { return block_id() == 0; } | 101 bool IsStartBlock() const { return block_id() == 0; } |
102 void PostProcessLoopHeader(IterationStatement* stmt); | 102 void PostProcessLoopHeader(IterationStatement* stmt); |
103 | 103 |
104 bool IsFinished() const { return end_ != NULL; } | 104 bool IsFinished() const { return end_ != NULL; } |
105 void AddPhi(HPhi* phi); | 105 void AddPhi(HPhi* phi); |
106 void RemovePhi(HPhi* phi); | 106 void RemovePhi(HPhi* phi); |
107 void AddInstruction(HInstruction* instr); | 107 void AddInstruction(HInstruction* instr); |
108 bool Dominates(HBasicBlock* other) const; | 108 bool Dominates(HBasicBlock* other) const; |
109 int LoopNestingDepth() const; | 109 int LoopNestingDepth() const; |
110 | 110 |
111 void SetInitialEnvironment(HEnvironment* env, BailoutId previous_id); | 111 void SetInitialEnvironment(HEnvironment* env); |
112 void ClearEnvironment() { last_environment_ = NULL; } | 112 void ClearEnvironment() { last_environment_ = NULL; } |
113 bool HasEnvironment() const { return last_environment_ != NULL; } | 113 bool HasEnvironment() const { return last_environment_ != NULL; } |
114 void UpdateEnvironment(HEnvironment* env) { last_environment_ = env; } | 114 void UpdateEnvironment(HEnvironment* env) { last_environment_ = env; } |
115 HBasicBlock* parent_loop_header() const { return parent_loop_header_; } | 115 HBasicBlock* parent_loop_header() const { return parent_loop_header_; } |
116 | 116 |
117 void set_parent_loop_header(HBasicBlock* block) { | 117 void set_parent_loop_header(HBasicBlock* block) { |
118 ASSERT(parent_loop_header_ == NULL); | 118 ASSERT(parent_loop_header_ == NULL); |
119 parent_loop_header_ = block; | 119 parent_loop_header_ = block; |
120 } | 120 } |
121 | 121 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 FrameType frame_type() const { return frame_type_; } | 477 FrameType frame_type() const { return frame_type_; } |
478 int parameter_count() const { return parameter_count_; } | 478 int parameter_count() const { return parameter_count_; } |
479 int specials_count() const { return specials_count_; } | 479 int specials_count() const { return specials_count_; } |
480 int local_count() const { return local_count_; } | 480 int local_count() const { return local_count_; } |
481 HEnvironment* outer() const { return outer_; } | 481 HEnvironment* outer() const { return outer_; } |
482 int pop_count() const { return pop_count_; } | 482 int pop_count() const { return pop_count_; } |
483 int push_count() const { return push_count_; } | 483 int push_count() const { return push_count_; } |
484 | 484 |
485 BailoutId ast_id() const { return ast_id_; } | 485 BailoutId ast_id() const { return ast_id_; } |
486 void set_ast_id(BailoutId id) { ast_id_ = id; } | 486 void set_ast_id(BailoutId id) { ast_id_ = id; } |
487 BailoutId previous_ast_id() const { return previous_ast_id_; } | |
488 void set_previous_ast_id(BailoutId id) { previous_ast_id_ = id; } | |
489 | 487 |
490 HEnterInlined* entry() const { return entry_; } | 488 HEnterInlined* entry() const { return entry_; } |
491 void set_entry(HEnterInlined* entry) { entry_ = entry; } | 489 void set_entry(HEnterInlined* entry) { entry_ = entry; } |
492 | 490 |
493 int length() const { return values_.length(); } | 491 int length() const { return values_.length(); } |
494 bool is_special_index(int i) const { | 492 bool is_special_index(int i) const { |
495 return i >= parameter_count() && i < parameter_count() + specials_count(); | 493 return i >= parameter_count() && i < parameter_count() + specials_count(); |
496 } | 494 } |
497 | 495 |
498 int first_expression_index() const { | 496 int first_expression_index() const { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 GrowableBitVector assigned_variables_; | 638 GrowableBitVector assigned_variables_; |
641 FrameType frame_type_; | 639 FrameType frame_type_; |
642 int parameter_count_; | 640 int parameter_count_; |
643 int specials_count_; | 641 int specials_count_; |
644 int local_count_; | 642 int local_count_; |
645 HEnvironment* outer_; | 643 HEnvironment* outer_; |
646 HEnterInlined* entry_; | 644 HEnterInlined* entry_; |
647 int pop_count_; | 645 int pop_count_; |
648 int push_count_; | 646 int push_count_; |
649 BailoutId ast_id_; | 647 BailoutId ast_id_; |
650 BailoutId previous_ast_id_; | |
651 Zone* zone_; | 648 Zone* zone_; |
652 }; | 649 }; |
653 | 650 |
654 | 651 |
655 class HInferRepresentation BASE_EMBEDDED { | 652 class HInferRepresentation BASE_EMBEDDED { |
656 public: | 653 public: |
657 explicit HInferRepresentation(HGraph* graph) | 654 explicit HInferRepresentation(HGraph* graph) |
658 : graph_(graph), | 655 : graph_(graph), |
659 worklist_(8, graph->zone()), | 656 worklist_(8, graph->zone()), |
660 in_worklist_(graph->GetMaximumValueID(), graph->zone()) { } | 657 in_worklist_(graph->GetMaximumValueID(), graph->zone()) { } |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 no_side_effects_scope_count_++; | 896 no_side_effects_scope_count_++; |
900 } | 897 } |
901 | 898 |
902 void DecrementInNoSideEffectsScope() { | 899 void DecrementInNoSideEffectsScope() { |
903 no_side_effects_scope_count_--; | 900 no_side_effects_scope_count_--; |
904 } | 901 } |
905 | 902 |
906 protected: | 903 protected: |
907 virtual bool BuildGraph() = 0; | 904 virtual bool BuildGraph() = 0; |
908 | 905 |
909 HBasicBlock* CreateBasicBlock(HEnvironment* envy, | 906 HBasicBlock* CreateBasicBlock(HEnvironment* envy); |
910 BailoutId previous_ast_id); | 907 HBasicBlock* CreateLoopHeaderBlock(); |
911 HBasicBlock* CreateLoopHeaderBlock(BailoutId previous_ast_id); | |
912 | 908 |
913 // Building common constructs | 909 // Building common constructs |
914 HInstruction* BuildExternalArrayElementAccess( | 910 HInstruction* BuildExternalArrayElementAccess( |
915 HValue* external_elements, | 911 HValue* external_elements, |
916 HValue* checked_key, | 912 HValue* checked_key, |
917 HValue* val, | 913 HValue* val, |
918 HValue* dependency, | 914 HValue* dependency, |
919 ElementsKind elements_kind, | 915 ElementsKind elements_kind, |
920 bool is_store); | 916 bool is_store); |
921 | 917 |
(...skipping 27 matching lines...) Expand all Loading... |
949 ElementsKind elements_kind, | 945 ElementsKind elements_kind, |
950 bool is_store, | 946 bool is_store, |
951 KeyedAccessStoreMode store_mode, | 947 KeyedAccessStoreMode store_mode, |
952 Representation checked_index_representation = Representation::None()); | 948 Representation checked_index_representation = Representation::None()); |
953 | 949 |
954 HInstruction* BuildStoreMap(HValue* object, HValue* map); | 950 HInstruction* BuildStoreMap(HValue* object, HValue* map); |
955 HInstruction* BuildStoreMap(HValue* object, Handle<Map> map); | 951 HInstruction* BuildStoreMap(HValue* object, Handle<Map> map); |
956 | 952 |
957 class CheckBuilder { | 953 class CheckBuilder { |
958 public: | 954 public: |
959 explicit CheckBuilder(HGraphBuilder* builder); | 955 explicit CheckBuilder(HGraphBuilder* builder, BailoutId id); |
960 ~CheckBuilder() { | 956 ~CheckBuilder() { |
961 if (!finished_) End(); | 957 if (!finished_) End(); |
962 } | 958 } |
963 | 959 |
964 HValue* CheckNotUndefined(HValue* value); | 960 HValue* CheckNotUndefined(HValue* value); |
965 HValue* CheckIntegerCompare(HValue* left, HValue* right, Token::Value op); | 961 HValue* CheckIntegerCompare(HValue* left, HValue* right, Token::Value op); |
966 HValue* CheckIntegerEq(HValue* left, HValue* right); | 962 HValue* CheckIntegerEq(HValue* left, HValue* right); |
967 void End(); | 963 void End(); |
968 | 964 |
969 private: | 965 private: |
970 Zone* zone() { return builder_->zone(); } | 966 Zone* zone() { return builder_->zone(); } |
971 | 967 |
972 HGraphBuilder* builder_; | 968 HGraphBuilder* builder_; |
973 bool finished_; | 969 bool finished_; |
974 HBasicBlock* failure_block_; | 970 HBasicBlock* failure_block_; |
975 HBasicBlock* merge_block_; | 971 HBasicBlock* merge_block_; |
976 BailoutId id_; | 972 BailoutId id_; |
977 }; | 973 }; |
978 | 974 |
979 class IfBuilder { | 975 class IfBuilder { |
980 public: | 976 public: |
981 explicit IfBuilder(HGraphBuilder* builder); | 977 explicit IfBuilder(HGraphBuilder* builder, BailoutId id); |
982 ~IfBuilder() { | 978 ~IfBuilder() { |
983 if (!finished_) End(); | 979 if (!finished_) End(); |
984 } | 980 } |
985 | 981 |
986 HInstruction* BeginIf( | 982 HInstruction* BeginIf( |
987 HValue* left, | 983 HValue* left, |
988 HValue* right, | 984 HValue* right, |
989 Token::Value token, | 985 Token::Value token, |
990 Representation input_representation = Representation::Integer32()); | 986 Representation input_representation = Representation::Integer32()); |
991 HInstruction* BeginIfObjectsEqual(HValue* left, HValue* right); | 987 HInstruction* BeginIfObjectsEqual(HValue* left, HValue* right); |
(...skipping 18 matching lines...) Expand all Loading... |
1010 public: | 1006 public: |
1011 enum Direction { | 1007 enum Direction { |
1012 kPreIncrement, | 1008 kPreIncrement, |
1013 kPostIncrement, | 1009 kPostIncrement, |
1014 kPreDecrement, | 1010 kPreDecrement, |
1015 kPostDecrement | 1011 kPostDecrement |
1016 }; | 1012 }; |
1017 | 1013 |
1018 LoopBuilder(HGraphBuilder* builder, | 1014 LoopBuilder(HGraphBuilder* builder, |
1019 HValue* context, | 1015 HValue* context, |
1020 Direction direction); | 1016 Direction direction, |
| 1017 BailoutId id); |
1021 ~LoopBuilder() { | 1018 ~LoopBuilder() { |
1022 ASSERT(finished_); | 1019 ASSERT(finished_); |
1023 } | 1020 } |
1024 | 1021 |
1025 HValue* BeginBody( | 1022 HValue* BeginBody( |
1026 HValue* initial, | 1023 HValue* initial, |
1027 HValue* terminating, | 1024 HValue* terminating, |
1028 Token::Value token, | 1025 Token::Value token, |
1029 Representation input_representation = Representation::Integer32()); | 1026 Representation input_representation = Representation::Integer32()); |
1030 void EndBody(); | 1027 void EndBody(); |
(...skipping 28 matching lines...) Expand all Loading... |
1059 }; | 1056 }; |
1060 | 1057 |
1061 HValue* BuildNewElementsCapacity(HValue* context, | 1058 HValue* BuildNewElementsCapacity(HValue* context, |
1062 HValue* old_capacity); | 1059 HValue* old_capacity); |
1063 | 1060 |
1064 void BuildNewSpaceArrayCheck(HValue* length, | 1061 void BuildNewSpaceArrayCheck(HValue* length, |
1065 ElementsKind kind); | 1062 ElementsKind kind); |
1066 | 1063 |
1067 HValue* BuildAllocateElements(HValue* context, | 1064 HValue* BuildAllocateElements(HValue* context, |
1068 ElementsKind kind, | 1065 ElementsKind kind, |
1069 HValue* capacity); | 1066 HValue* capacity, |
| 1067 BailoutId ast_id); |
1070 | 1068 |
1071 void BuildInitializeElements(HValue* elements, | 1069 void BuildInitializeElements(HValue* elements, |
1072 ElementsKind kind, | 1070 ElementsKind kind, |
1073 HValue* capacity); | 1071 HValue* capacity); |
1074 | 1072 |
1075 HValue* BuildAllocateAndInitializeElements(HValue* context, | 1073 HValue* BuildAllocateAndInitializeElements(HValue* context, |
1076 ElementsKind kind, | 1074 ElementsKind kind, |
1077 HValue* capacity); | 1075 HValue* capacity); |
1078 | 1076 |
1079 HValue* BuildGrowElementsCapacity(HValue* object, | 1077 HValue* BuildGrowElementsCapacity(HValue* object, |
1080 HValue* elements, | 1078 HValue* elements, |
1081 ElementsKind kind, | 1079 ElementsKind kind, |
1082 HValue* length, | 1080 HValue* length, |
1083 HValue* new_capacity); | 1081 HValue* new_capacity, |
| 1082 BailoutId ast_id); |
1084 | 1083 |
1085 void BuildFillElementsWithHole(HValue* context, | 1084 void BuildFillElementsWithHole(HValue* context, |
1086 HValue* elements, | 1085 HValue* elements, |
1087 ElementsKind elements_kind, | 1086 ElementsKind elements_kind, |
1088 HValue* from, | 1087 HValue* from, |
1089 HValue* to); | 1088 HValue* to, |
| 1089 BailoutId ast_id); |
1090 | 1090 |
1091 void BuildCopyElements(HValue* context, | 1091 void BuildCopyElements(HValue* context, |
1092 HValue* from_elements, | 1092 HValue* from_elements, |
1093 ElementsKind from_elements_kind, | 1093 ElementsKind from_elements_kind, |
1094 HValue* to_elements, | 1094 HValue* to_elements, |
1095 ElementsKind to_elements_kind, | 1095 ElementsKind to_elements_kind, |
1096 HValue* length, | 1096 HValue* length, |
1097 HValue* capacity); | 1097 HValue* capacity, |
| 1098 BailoutId ast_id); |
1098 | 1099 |
1099 HValue* BuildCloneShallowArray(HContext* context, | 1100 HValue* BuildCloneShallowArray(HContext* context, |
1100 HValue* boilerplate, | 1101 HValue* boilerplate, |
1101 AllocationSiteMode mode, | 1102 AllocationSiteMode mode, |
1102 ElementsKind kind, | 1103 ElementsKind kind, |
1103 int length); | 1104 int length); |
1104 | 1105 |
1105 private: | 1106 private: |
1106 HGraphBuilder(); | 1107 HGraphBuilder(); |
1107 CompilationInfo* info_; | 1108 CompilationInfo* info_; |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 EmbeddedVector<char, 64> filename_; | 1794 EmbeddedVector<char, 64> filename_; |
1794 HeapStringAllocator string_allocator_; | 1795 HeapStringAllocator string_allocator_; |
1795 StringStream trace_; | 1796 StringStream trace_; |
1796 int indent_; | 1797 int indent_; |
1797 }; | 1798 }; |
1798 | 1799 |
1799 | 1800 |
1800 } } // namespace v8::internal | 1801 } } // namespace v8::internal |
1801 | 1802 |
1802 #endif // V8_HYDROGEN_H_ | 1803 #endif // V8_HYDROGEN_H_ |
OLD | NEW |