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); | 111 void SetInitialEnvironment(HEnvironment* env, BailoutId previous_id); |
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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 FrameType frame_type() const { return frame_type_; } | 476 FrameType frame_type() const { return frame_type_; } |
477 int parameter_count() const { return parameter_count_; } | 477 int parameter_count() const { return parameter_count_; } |
478 int specials_count() const { return specials_count_; } | 478 int specials_count() const { return specials_count_; } |
479 int local_count() const { return local_count_; } | 479 int local_count() const { return local_count_; } |
480 HEnvironment* outer() const { return outer_; } | 480 HEnvironment* outer() const { return outer_; } |
481 int pop_count() const { return pop_count_; } | 481 int pop_count() const { return pop_count_; } |
482 int push_count() const { return push_count_; } | 482 int push_count() const { return push_count_; } |
483 | 483 |
484 BailoutId ast_id() const { return ast_id_; } | 484 BailoutId ast_id() const { return ast_id_; } |
485 void set_ast_id(BailoutId id) { ast_id_ = id; } | 485 void set_ast_id(BailoutId id) { ast_id_ = id; } |
| 486 BailoutId previous_ast_id() const { return previous_ast_id_; } |
| 487 void set_previous_ast_id(BailoutId id) { previous_ast_id_ = id; } |
486 | 488 |
487 HEnterInlined* entry() const { return entry_; } | 489 HEnterInlined* entry() const { return entry_; } |
488 void set_entry(HEnterInlined* entry) { entry_ = entry; } | 490 void set_entry(HEnterInlined* entry) { entry_ = entry; } |
489 | 491 |
490 int length() const { return values_.length(); } | 492 int length() const { return values_.length(); } |
491 bool is_special_index(int i) const { | 493 bool is_special_index(int i) const { |
492 return i >= parameter_count() && i < parameter_count() + specials_count(); | 494 return i >= parameter_count() && i < parameter_count() + specials_count(); |
493 } | 495 } |
494 | 496 |
495 int first_expression_index() const { | 497 int first_expression_index() const { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 GrowableBitVector assigned_variables_; | 639 GrowableBitVector assigned_variables_; |
638 FrameType frame_type_; | 640 FrameType frame_type_; |
639 int parameter_count_; | 641 int parameter_count_; |
640 int specials_count_; | 642 int specials_count_; |
641 int local_count_; | 643 int local_count_; |
642 HEnvironment* outer_; | 644 HEnvironment* outer_; |
643 HEnterInlined* entry_; | 645 HEnterInlined* entry_; |
644 int pop_count_; | 646 int pop_count_; |
645 int push_count_; | 647 int push_count_; |
646 BailoutId ast_id_; | 648 BailoutId ast_id_; |
| 649 BailoutId previous_ast_id_; |
647 Zone* zone_; | 650 Zone* zone_; |
648 }; | 651 }; |
649 | 652 |
650 | 653 |
651 class HInferRepresentation BASE_EMBEDDED { | 654 class HInferRepresentation BASE_EMBEDDED { |
652 public: | 655 public: |
653 explicit HInferRepresentation(HGraph* graph) | 656 explicit HInferRepresentation(HGraph* graph) |
654 : graph_(graph), | 657 : graph_(graph), |
655 worklist_(8, graph->zone()), | 658 worklist_(8, graph->zone()), |
656 in_worklist_(graph->GetMaximumValueID(), graph->zone()) { } | 659 in_worklist_(graph->GetMaximumValueID(), graph->zone()) { } |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 HValue* index, | 887 HValue* index, |
885 HValue* length, | 888 HValue* length, |
886 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY, | 889 BoundsCheckKeyMode key_mode = DONT_ALLOW_SMI_KEY, |
887 Representation r = Representation::None()); | 890 Representation r = Representation::None()); |
888 | 891 |
889 HReturn* AddReturn(HValue* value); | 892 HReturn* AddReturn(HValue* value); |
890 | 893 |
891 protected: | 894 protected: |
892 virtual bool BuildGraph() = 0; | 895 virtual bool BuildGraph() = 0; |
893 | 896 |
894 HBasicBlock* CreateBasicBlock(HEnvironment* env); | 897 HBasicBlock* CreateBasicBlock(HEnvironment* envy, |
895 HBasicBlock* CreateLoopHeaderBlock(); | 898 BailoutId previous_ast_id); |
| 899 HBasicBlock* CreateLoopHeaderBlock(BailoutId previous_ast_id); |
896 | 900 |
897 // Building common constructs | 901 // Building common constructs |
898 HInstruction* BuildExternalArrayElementAccess( | 902 HInstruction* BuildExternalArrayElementAccess( |
899 HValue* external_elements, | 903 HValue* external_elements, |
900 HValue* checked_key, | 904 HValue* checked_key, |
901 HValue* val, | 905 HValue* val, |
902 HValue* dependency, | 906 HValue* dependency, |
903 ElementsKind elements_kind, | 907 ElementsKind elements_kind, |
904 bool is_store); | 908 bool is_store); |
905 | 909 |
(...skipping 27 matching lines...) Expand all Loading... |
933 ElementsKind elements_kind, | 937 ElementsKind elements_kind, |
934 bool is_store, | 938 bool is_store, |
935 KeyedAccessStoreMode store_mode, | 939 KeyedAccessStoreMode store_mode, |
936 Representation checked_index_representation = Representation::None()); | 940 Representation checked_index_representation = Representation::None()); |
937 | 941 |
938 HInstruction* BuildStoreMap(HValue* object, HValue* map, BailoutId id); | 942 HInstruction* BuildStoreMap(HValue* object, HValue* map, BailoutId id); |
939 HInstruction* BuildStoreMap(HValue* object, Handle<Map> map, BailoutId id); | 943 HInstruction* BuildStoreMap(HValue* object, Handle<Map> map, BailoutId id); |
940 | 944 |
941 class CheckBuilder { | 945 class CheckBuilder { |
942 public: | 946 public: |
943 CheckBuilder(HGraphBuilder* builder, BailoutId id); | 947 explicit CheckBuilder(HGraphBuilder* builder); |
944 ~CheckBuilder() { | 948 ~CheckBuilder() { |
945 if (!finished_) End(); | 949 if (!finished_) End(); |
946 } | 950 } |
947 | 951 |
948 HValue* CheckNotUndefined(HValue* value); | 952 HValue* CheckNotUndefined(HValue* value); |
949 HValue* CheckIntegerCompare(HValue* left, HValue* right, Token::Value op); | 953 HValue* CheckIntegerCompare(HValue* left, HValue* right, Token::Value op); |
950 HValue* CheckIntegerEq(HValue* left, HValue* right); | 954 HValue* CheckIntegerEq(HValue* left, HValue* right); |
951 void End(); | 955 void End(); |
952 | 956 |
953 private: | 957 private: |
954 Zone* zone() { return builder_->zone(); } | 958 Zone* zone() { return builder_->zone(); } |
955 | 959 |
956 HGraphBuilder* builder_; | 960 HGraphBuilder* builder_; |
957 bool finished_; | 961 bool finished_; |
958 HBasicBlock* failure_block_; | 962 HBasicBlock* failure_block_; |
959 HBasicBlock* merge_block_; | 963 HBasicBlock* merge_block_; |
960 BailoutId id_; | 964 BailoutId id_; |
961 }; | 965 }; |
962 | 966 |
963 class IfBuilder { | 967 class IfBuilder { |
964 public: | 968 public: |
965 IfBuilder(HGraphBuilder* builder, BailoutId id); | 969 explicit IfBuilder(HGraphBuilder* builder); |
966 ~IfBuilder() { | 970 ~IfBuilder() { |
967 if (!finished_) End(); | 971 if (!finished_) End(); |
968 } | 972 } |
969 | 973 |
970 HInstruction* BeginIf( | 974 HInstruction* BeginIf( |
971 HValue* left, | 975 HValue* left, |
972 HValue* right, | 976 HValue* right, |
973 Token::Value token, | 977 Token::Value token, |
974 Representation input_representation = Representation::Integer32()); | 978 Representation input_representation = Representation::Integer32()); |
975 HInstruction* BeginIfObjectsEqual(HValue* left, HValue* right); | 979 HInstruction* BeginIfObjectsEqual(HValue* left, HValue* right); |
(...skipping 18 matching lines...) Expand all Loading... |
994 public: | 998 public: |
995 enum Direction { | 999 enum Direction { |
996 kPreIncrement, | 1000 kPreIncrement, |
997 kPostIncrement, | 1001 kPostIncrement, |
998 kPreDecrement, | 1002 kPreDecrement, |
999 kPostDecrement | 1003 kPostDecrement |
1000 }; | 1004 }; |
1001 | 1005 |
1002 LoopBuilder(HGraphBuilder* builder, | 1006 LoopBuilder(HGraphBuilder* builder, |
1003 HValue* context, | 1007 HValue* context, |
1004 Direction direction, | 1008 Direction direction); |
1005 BailoutId id); | |
1006 ~LoopBuilder() { | 1009 ~LoopBuilder() { |
1007 ASSERT(finished_); | 1010 ASSERT(finished_); |
1008 } | 1011 } |
1009 | 1012 |
1010 HValue* BeginBody( | 1013 HValue* BeginBody( |
1011 HValue* initial, | 1014 HValue* initial, |
1012 HValue* terminating, | 1015 HValue* terminating, |
1013 Token::Value token, | 1016 Token::Value token, |
1014 Representation input_representation = Representation::Integer32()); | 1017 Representation input_representation = Representation::Integer32()); |
1015 void EndBody(); | 1018 void EndBody(); |
(...skipping 14 matching lines...) Expand all Loading... |
1030 }; | 1033 }; |
1031 | 1034 |
1032 HValue* BuildNewElementsCapacity(HValue* context, | 1035 HValue* BuildNewElementsCapacity(HValue* context, |
1033 HValue* old_capacity); | 1036 HValue* old_capacity); |
1034 | 1037 |
1035 void BuildNewSpaceArrayCheck(HValue* length, | 1038 void BuildNewSpaceArrayCheck(HValue* length, |
1036 ElementsKind kind); | 1039 ElementsKind kind); |
1037 | 1040 |
1038 HValue* BuildAllocateElements(HValue* context, | 1041 HValue* BuildAllocateElements(HValue* context, |
1039 ElementsKind kind, | 1042 ElementsKind kind, |
1040 HValue* capacity, | 1043 HValue* capacity); |
1041 BailoutId ast_id); | |
1042 | 1044 |
1043 HValue* BuildGrowElementsCapacity(HValue* object, | 1045 HValue* BuildGrowElementsCapacity(HValue* object, |
1044 HValue* elements, | 1046 HValue* elements, |
1045 ElementsKind kind, | 1047 ElementsKind kind, |
1046 HValue* length, | 1048 HValue* length, |
1047 HValue* new_capacity, | 1049 HValue* new_capacity); |
1048 BailoutId ast_id); | |
1049 | 1050 |
1050 void BuildFillElementsWithHole(HValue* context, | 1051 void BuildFillElementsWithHole(HValue* context, |
1051 HValue* elements, | 1052 HValue* elements, |
1052 ElementsKind elements_kind, | 1053 ElementsKind elements_kind, |
1053 HValue* from, | 1054 HValue* from, |
1054 HValue* to, | 1055 HValue* to); |
1055 BailoutId ast_id); | |
1056 | 1056 |
1057 void BuildCopyElements(HValue* context, | 1057 void BuildCopyElements(HValue* context, |
1058 HValue* from_elements, | 1058 HValue* from_elements, |
1059 ElementsKind from_elements_kind, | 1059 ElementsKind from_elements_kind, |
1060 HValue* to_elements, | 1060 HValue* to_elements, |
1061 ElementsKind to_elements_kind, | 1061 ElementsKind to_elements_kind, |
1062 HValue* length, | 1062 HValue* length, |
1063 HValue* capacity, | 1063 HValue* capacity); |
1064 BailoutId ast_id); | |
1065 | 1064 |
1066 private: | 1065 private: |
1067 HGraphBuilder(); | 1066 HGraphBuilder(); |
1068 CompilationInfo* info_; | 1067 CompilationInfo* info_; |
1069 HGraph* graph_; | 1068 HGraph* graph_; |
1070 HBasicBlock* current_block_; | 1069 HBasicBlock* current_block_; |
1071 }; | 1070 }; |
1072 | 1071 |
1073 | 1072 |
1074 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { | 1073 class HOptimizedGraphBuilder: public HGraphBuilder, public AstVisitor { |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1722 EmbeddedVector<char, 64> filename_; | 1721 EmbeddedVector<char, 64> filename_; |
1723 HeapStringAllocator string_allocator_; | 1722 HeapStringAllocator string_allocator_; |
1724 StringStream trace_; | 1723 StringStream trace_; |
1725 int indent_; | 1724 int indent_; |
1726 }; | 1725 }; |
1727 | 1726 |
1728 | 1727 |
1729 } } // namespace v8::internal | 1728 } } // namespace v8::internal |
1730 | 1729 |
1731 #endif // V8_HYDROGEN_H_ | 1730 #endif // V8_HYDROGEN_H_ |
OLD | NEW |