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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 253 |
254 private: | 254 private: |
255 void AddBlock(HBasicBlock* block); | 255 void AddBlock(HBasicBlock* block); |
256 | 256 |
257 ZoneList<HBasicBlock*> back_edges_; | 257 ZoneList<HBasicBlock*> back_edges_; |
258 HBasicBlock* loop_header_; | 258 HBasicBlock* loop_header_; |
259 ZoneList<HBasicBlock*> blocks_; | 259 ZoneList<HBasicBlock*> blocks_; |
260 HStackCheck* stack_check_; | 260 HStackCheck* stack_check_; |
261 }; | 261 }; |
262 | 262 |
263 | |
264 class BoundsCheckTable; | 263 class BoundsCheckTable; |
265 class HGraph: public ZoneObject { | 264 class HGraph: public ZoneObject { |
266 public: | 265 public: |
267 explicit HGraph(CompilationInfo* info); | 266 explicit HGraph(CompilationInfo* info); |
268 | 267 |
269 Isolate* isolate() const { return isolate_; } | 268 Isolate* isolate() const { return isolate_; } |
270 Zone* zone() const { return zone_; } | 269 Zone* zone() const { return zone_; } |
271 CompilationInfo* info() const { return info_; } | 270 CompilationInfo* info() const { return info_; } |
272 | 271 |
273 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 272 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 void MarkDependsOnEmptyArrayProtoElements() { | 404 void MarkDependsOnEmptyArrayProtoElements() { |
406 // Add map dependency if not already added. | 405 // Add map dependency if not already added. |
407 if (depends_on_empty_array_proto_elements_) return; | 406 if (depends_on_empty_array_proto_elements_) return; |
408 isolate()->initial_object_prototype()->map()->AddDependentCompilationInfo( | 407 isolate()->initial_object_prototype()->map()->AddDependentCompilationInfo( |
409 DependentCode::kElementsCantBeAddedGroup, info()); | 408 DependentCode::kElementsCantBeAddedGroup, info()); |
410 isolate()->initial_array_prototype()->map()->AddDependentCompilationInfo( | 409 isolate()->initial_array_prototype()->map()->AddDependentCompilationInfo( |
411 DependentCode::kElementsCantBeAddedGroup, info()); | 410 DependentCode::kElementsCantBeAddedGroup, info()); |
412 depends_on_empty_array_proto_elements_ = true; | 411 depends_on_empty_array_proto_elements_ = true; |
413 } | 412 } |
414 | 413 |
415 bool depends_on_empty_array_proto_elements() { | |
416 return depends_on_empty_array_proto_elements_; | |
417 } | |
418 | |
419 void RecordUint32Instruction(HInstruction* instr) { | 414 void RecordUint32Instruction(HInstruction* instr) { |
420 if (uint32_instructions_ == NULL) { | 415 if (uint32_instructions_ == NULL) { |
421 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); | 416 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); |
422 } | 417 } |
423 uint32_instructions_->Add(instr, zone()); | 418 uint32_instructions_->Add(instr, zone()); |
424 } | 419 } |
425 | 420 |
426 private: | 421 private: |
427 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, | 422 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, |
428 int32_t integer_value); | 423 int32_t integer_value); |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 void ClearInlinedTestContext() { | 869 void ClearInlinedTestContext() { |
875 delete test_context_; | 870 delete test_context_; |
876 test_context_ = NULL; | 871 test_context_ = NULL; |
877 } | 872 } |
878 | 873 |
879 FunctionState* outer() { return outer_; } | 874 FunctionState* outer() { return outer_; } |
880 | 875 |
881 HEnterInlined* entry() { return entry_; } | 876 HEnterInlined* entry() { return entry_; } |
882 void set_entry(HEnterInlined* entry) { entry_ = entry; } | 877 void set_entry(HEnterInlined* entry) { entry_ = entry; } |
883 | 878 |
884 HArgumentsObject* arguments_object() { return arguments_object_; } | |
885 void set_arguments_object(HArgumentsObject* arguments_object) { | |
886 arguments_object_ = arguments_object; | |
887 } | |
888 | |
889 HArgumentsElements* arguments_elements() { return arguments_elements_; } | 879 HArgumentsElements* arguments_elements() { return arguments_elements_; } |
890 void set_arguments_elements(HArgumentsElements* arguments_elements) { | 880 void set_arguments_elements(HArgumentsElements* arguments_elements) { |
891 arguments_elements_ = arguments_elements; | 881 arguments_elements_ = arguments_elements; |
892 } | 882 } |
893 | 883 |
894 bool arguments_pushed() { return arguments_elements() != NULL; } | 884 bool arguments_pushed() { return arguments_elements() != NULL; } |
895 | 885 |
896 private: | 886 private: |
897 HOptimizedGraphBuilder* owner_; | 887 HOptimizedGraphBuilder* owner_; |
898 | 888 |
(...skipping 13 matching lines...) Expand all Loading... |
912 HBasicBlock* function_return_; | 902 HBasicBlock* function_return_; |
913 | 903 |
914 // When inlining a call in a test context, a context containing a pair of | 904 // When inlining a call in a test context, a context containing a pair of |
915 // return blocks. NULL in all other cases. | 905 // return blocks. NULL in all other cases. |
916 TestContext* test_context_; | 906 TestContext* test_context_; |
917 | 907 |
918 // When inlining HEnterInlined instruction corresponding to the function | 908 // When inlining HEnterInlined instruction corresponding to the function |
919 // entry. | 909 // entry. |
920 HEnterInlined* entry_; | 910 HEnterInlined* entry_; |
921 | 911 |
922 HArgumentsObject* arguments_object_; | |
923 HArgumentsElements* arguments_elements_; | 912 HArgumentsElements* arguments_elements_; |
924 | 913 |
925 FunctionState* outer_; | 914 FunctionState* outer_; |
926 }; | 915 }; |
927 | 916 |
928 | 917 |
929 class HIfContinuation { | 918 class HIfContinuation { |
930 public: | 919 public: |
931 HIfContinuation() { continuation_captured_ = false; } | 920 HIfContinuation() { continuation_captured_ = false; } |
932 ~HIfContinuation() { ASSERT(!continuation_captured_); } | 921 ~HIfContinuation() { ASSERT(!continuation_captured_); } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 IfBuilder(HGraphBuilder* builder, | 1073 IfBuilder(HGraphBuilder* builder, |
1085 HIfContinuation* continuation); | 1074 HIfContinuation* continuation); |
1086 | 1075 |
1087 ~IfBuilder() { | 1076 ~IfBuilder() { |
1088 if (!finished_) End(); | 1077 if (!finished_) End(); |
1089 } | 1078 } |
1090 | 1079 |
1091 HInstruction* IfCompare( | 1080 HInstruction* IfCompare( |
1092 HValue* left, | 1081 HValue* left, |
1093 HValue* right, | 1082 HValue* right, |
1094 Token::Value token); | 1083 Token::Value token, |
| 1084 Representation input_representation = Representation::Integer32()); |
1095 | 1085 |
1096 HInstruction* IfCompareMap(HValue* left, Handle<Map> map); | 1086 HInstruction* IfCompareMap(HValue* left, Handle<Map> map); |
1097 | 1087 |
1098 template<class Condition> | 1088 template<class Condition> |
1099 HInstruction* If(HValue *p) { | 1089 HInstruction* If(HValue *p) { |
1100 HControlInstruction* compare = new(zone()) Condition(p); | 1090 HControlInstruction* compare = new(zone()) Condition(p); |
1101 AddCompare(compare); | 1091 AddCompare(compare); |
1102 return compare; | 1092 return compare; |
1103 } | 1093 } |
1104 | 1094 |
(...skipping 11 matching lines...) Expand all Loading... |
1116 HBasicBlock* block0 = compare->SuccessorAt(0); | 1106 HBasicBlock* block0 = compare->SuccessorAt(0); |
1117 HBasicBlock* block1 = compare->SuccessorAt(1); | 1107 HBasicBlock* block1 = compare->SuccessorAt(1); |
1118 compare->SetSuccessorAt(0, block1); | 1108 compare->SetSuccessorAt(0, block1); |
1119 compare->SetSuccessorAt(1, block0); | 1109 compare->SetSuccessorAt(1, block0); |
1120 return compare; | 1110 return compare; |
1121 } | 1111 } |
1122 | 1112 |
1123 HInstruction* OrIfCompare( | 1113 HInstruction* OrIfCompare( |
1124 HValue* p1, | 1114 HValue* p1, |
1125 HValue* p2, | 1115 HValue* p2, |
1126 Token::Value token) { | 1116 Token::Value token, |
| 1117 Representation input_representation = Representation::Integer32()) { |
1127 Or(); | 1118 Or(); |
1128 return IfCompare(p1, p2, token); | 1119 return IfCompare(p1, p2, token, input_representation); |
1129 } | 1120 } |
1130 | 1121 |
1131 HInstruction* OrIfCompareMap(HValue* left, Handle<Map> map) { | 1122 HInstruction* OrIfCompareMap(HValue* left, Handle<Map> map) { |
1132 Or(); | 1123 Or(); |
1133 return IfCompareMap(left, map); | 1124 return IfCompareMap(left, map); |
1134 } | 1125 } |
1135 | 1126 |
1136 template<class Condition> | 1127 template<class Condition> |
1137 HInstruction* OrIf(HValue *p) { | 1128 HInstruction* OrIf(HValue *p) { |
1138 Or(); | 1129 Or(); |
1139 return If<Condition>(p); | 1130 return If<Condition>(p); |
1140 } | 1131 } |
1141 | 1132 |
1142 template<class Condition, class P2> | 1133 template<class Condition, class P2> |
1143 HInstruction* OrIf(HValue* p1, P2 p2) { | 1134 HInstruction* OrIf(HValue* p1, P2 p2) { |
1144 Or(); | 1135 Or(); |
1145 return If<Condition>(p1, p2); | 1136 return If<Condition>(p1, p2); |
1146 } | 1137 } |
1147 | 1138 |
1148 HInstruction* AndIfCompare( | 1139 HInstruction* AndIfCompare( |
1149 HValue* p1, | 1140 HValue* p1, |
1150 HValue* p2, | 1141 HValue* p2, |
1151 Token::Value token) { | 1142 Token::Value token, |
| 1143 Representation input_representation = Representation::Integer32()) { |
1152 And(); | 1144 And(); |
1153 return IfCompare(p1, p2, token); | 1145 return IfCompare(p1, p2, token, input_representation); |
1154 } | 1146 } |
1155 | 1147 |
1156 HInstruction* AndIfCompareMap(HValue* left, Handle<Map> map) { | 1148 HInstruction* AndIfCompareMap(HValue* left, Handle<Map> map) { |
1157 And(); | 1149 And(); |
1158 return IfCompareMap(left, map); | 1150 return IfCompareMap(left, map); |
1159 } | 1151 } |
1160 | 1152 |
1161 template<class Condition> | 1153 template<class Condition> |
1162 HInstruction* AndIf(HValue *p) { | 1154 HInstruction* AndIf(HValue *p) { |
1163 And(); | 1155 And(); |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 HValue* value, | 1683 HValue* value, |
1692 int position, | 1684 int position, |
1693 BailoutId ast_id); | 1685 BailoutId ast_id); |
1694 | 1686 |
1695 void HandlePropertyAssignment(Assignment* expr); | 1687 void HandlePropertyAssignment(Assignment* expr); |
1696 void HandleCompoundAssignment(Assignment* expr); | 1688 void HandleCompoundAssignment(Assignment* expr); |
1697 void HandlePolymorphicLoadNamedField(Property* expr, | 1689 void HandlePolymorphicLoadNamedField(Property* expr, |
1698 HValue* object, | 1690 HValue* object, |
1699 SmallMapList* types, | 1691 SmallMapList* types, |
1700 Handle<String> name); | 1692 Handle<String> name); |
1701 HInstruction* TryLoadPolymorphicAsMonomorphic(Property* expr, | 1693 bool HandlePolymorphicArrayLengthLoad(Property* expr, |
1702 HValue* object, | 1694 HValue* object, |
1703 SmallMapList* types, | 1695 SmallMapList* types, |
1704 Handle<String> name); | 1696 Handle<String> name); |
1705 void HandlePolymorphicStoreNamedField(Assignment* expr, | 1697 void HandlePolymorphicStoreNamedField(Assignment* expr, |
1706 HValue* object, | 1698 HValue* object, |
1707 HValue* value, | 1699 HValue* value, |
1708 SmallMapList* types, | 1700 SmallMapList* types, |
1709 Handle<String> name); | 1701 Handle<String> name); |
1710 void HandlePolymorphicCallNamed(Call* expr, | 1702 void HandlePolymorphicCallNamed(Call* expr, |
1711 HValue* receiver, | 1703 HValue* receiver, |
1712 SmallMapList* types, | 1704 SmallMapList* types, |
1713 Handle<String> name); | 1705 Handle<String> name); |
1714 void HandleLiteralCompareTypeof(CompareOperation* expr, | 1706 void HandleLiteralCompareTypeof(CompareOperation* expr, |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2031 EmbeddedVector<char, 64> filename_; | 2023 EmbeddedVector<char, 64> filename_; |
2032 HeapStringAllocator string_allocator_; | 2024 HeapStringAllocator string_allocator_; |
2033 StringStream trace_; | 2025 StringStream trace_; |
2034 int indent_; | 2026 int indent_; |
2035 }; | 2027 }; |
2036 | 2028 |
2037 | 2029 |
2038 } } // namespace v8::internal | 2030 } } // namespace v8::internal |
2039 | 2031 |
2040 #endif // V8_HYDROGEN_H_ | 2032 #endif // V8_HYDROGEN_H_ |
OLD | NEW |