| 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 |
| 263 class BoundsCheckTable; | 264 class BoundsCheckTable; |
| 264 class HGraph: public ZoneObject { | 265 class HGraph: public ZoneObject { |
| 265 public: | 266 public: |
| 266 explicit HGraph(CompilationInfo* info); | 267 explicit HGraph(CompilationInfo* info); |
| 267 | 268 |
| 268 Isolate* isolate() const { return isolate_; } | 269 Isolate* isolate() const { return isolate_; } |
| 269 Zone* zone() const { return zone_; } | 270 Zone* zone() const { return zone_; } |
| 270 CompilationInfo* info() const { return info_; } | 271 CompilationInfo* info() const { return info_; } |
| 271 | 272 |
| 272 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } | 273 const ZoneList<HBasicBlock*>* blocks() const { return &blocks_; } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 void MarkDependsOnEmptyArrayProtoElements() { | 405 void MarkDependsOnEmptyArrayProtoElements() { |
| 405 // Add map dependency if not already added. | 406 // Add map dependency if not already added. |
| 406 if (depends_on_empty_array_proto_elements_) return; | 407 if (depends_on_empty_array_proto_elements_) return; |
| 407 isolate()->initial_object_prototype()->map()->AddDependentCompilationInfo( | 408 isolate()->initial_object_prototype()->map()->AddDependentCompilationInfo( |
| 408 DependentCode::kElementsCantBeAddedGroup, info()); | 409 DependentCode::kElementsCantBeAddedGroup, info()); |
| 409 isolate()->initial_array_prototype()->map()->AddDependentCompilationInfo( | 410 isolate()->initial_array_prototype()->map()->AddDependentCompilationInfo( |
| 410 DependentCode::kElementsCantBeAddedGroup, info()); | 411 DependentCode::kElementsCantBeAddedGroup, info()); |
| 411 depends_on_empty_array_proto_elements_ = true; | 412 depends_on_empty_array_proto_elements_ = true; |
| 412 } | 413 } |
| 413 | 414 |
| 415 bool depends_on_empty_array_proto_elements() { |
| 416 return depends_on_empty_array_proto_elements_; |
| 417 } |
| 418 |
| 414 void RecordUint32Instruction(HInstruction* instr) { | 419 void RecordUint32Instruction(HInstruction* instr) { |
| 415 if (uint32_instructions_ == NULL) { | 420 if (uint32_instructions_ == NULL) { |
| 416 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); | 421 uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone()); |
| 417 } | 422 } |
| 418 uint32_instructions_->Add(instr, zone()); | 423 uint32_instructions_->Add(instr, zone()); |
| 419 } | 424 } |
| 420 | 425 |
| 421 private: | 426 private: |
| 422 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, | 427 HConstant* GetConstant(SetOncePointer<HConstant>* pointer, |
| 423 int32_t integer_value); | 428 int32_t integer_value); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 void ClearInlinedTestContext() { | 874 void ClearInlinedTestContext() { |
| 870 delete test_context_; | 875 delete test_context_; |
| 871 test_context_ = NULL; | 876 test_context_ = NULL; |
| 872 } | 877 } |
| 873 | 878 |
| 874 FunctionState* outer() { return outer_; } | 879 FunctionState* outer() { return outer_; } |
| 875 | 880 |
| 876 HEnterInlined* entry() { return entry_; } | 881 HEnterInlined* entry() { return entry_; } |
| 877 void set_entry(HEnterInlined* entry) { entry_ = entry; } | 882 void set_entry(HEnterInlined* entry) { entry_ = entry; } |
| 878 | 883 |
| 884 HArgumentsObject* arguments_object() { return arguments_object_; } |
| 885 void set_arguments_object(HArgumentsObject* arguments_object) { |
| 886 arguments_object_ = arguments_object; |
| 887 } |
| 888 |
| 879 HArgumentsElements* arguments_elements() { return arguments_elements_; } | 889 HArgumentsElements* arguments_elements() { return arguments_elements_; } |
| 880 void set_arguments_elements(HArgumentsElements* arguments_elements) { | 890 void set_arguments_elements(HArgumentsElements* arguments_elements) { |
| 881 arguments_elements_ = arguments_elements; | 891 arguments_elements_ = arguments_elements; |
| 882 } | 892 } |
| 883 | 893 |
| 884 bool arguments_pushed() { return arguments_elements() != NULL; } | 894 bool arguments_pushed() { return arguments_elements() != NULL; } |
| 885 | 895 |
| 886 private: | 896 private: |
| 887 HOptimizedGraphBuilder* owner_; | 897 HOptimizedGraphBuilder* owner_; |
| 888 | 898 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 902 HBasicBlock* function_return_; | 912 HBasicBlock* function_return_; |
| 903 | 913 |
| 904 // When inlining a call in a test context, a context containing a pair of | 914 // When inlining a call in a test context, a context containing a pair of |
| 905 // return blocks. NULL in all other cases. | 915 // return blocks. NULL in all other cases. |
| 906 TestContext* test_context_; | 916 TestContext* test_context_; |
| 907 | 917 |
| 908 // When inlining HEnterInlined instruction corresponding to the function | 918 // When inlining HEnterInlined instruction corresponding to the function |
| 909 // entry. | 919 // entry. |
| 910 HEnterInlined* entry_; | 920 HEnterInlined* entry_; |
| 911 | 921 |
| 922 HArgumentsObject* arguments_object_; |
| 912 HArgumentsElements* arguments_elements_; | 923 HArgumentsElements* arguments_elements_; |
| 913 | 924 |
| 914 FunctionState* outer_; | 925 FunctionState* outer_; |
| 915 }; | 926 }; |
| 916 | 927 |
| 917 | 928 |
| 918 class HIfContinuation { | 929 class HIfContinuation { |
| 919 public: | 930 public: |
| 920 HIfContinuation() { continuation_captured_ = false; } | 931 HIfContinuation() { continuation_captured_ = false; } |
| 921 ~HIfContinuation() { ASSERT(!continuation_captured_); } | 932 ~HIfContinuation() { ASSERT(!continuation_captured_); } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 IfBuilder(HGraphBuilder* builder, | 1084 IfBuilder(HGraphBuilder* builder, |
| 1074 HIfContinuation* continuation); | 1085 HIfContinuation* continuation); |
| 1075 | 1086 |
| 1076 ~IfBuilder() { | 1087 ~IfBuilder() { |
| 1077 if (!finished_) End(); | 1088 if (!finished_) End(); |
| 1078 } | 1089 } |
| 1079 | 1090 |
| 1080 HInstruction* IfCompare( | 1091 HInstruction* IfCompare( |
| 1081 HValue* left, | 1092 HValue* left, |
| 1082 HValue* right, | 1093 HValue* right, |
| 1083 Token::Value token, | 1094 Token::Value token); |
| 1084 Representation input_representation = Representation::Integer32()); | |
| 1085 | 1095 |
| 1086 HInstruction* IfCompareMap(HValue* left, Handle<Map> map); | 1096 HInstruction* IfCompareMap(HValue* left, Handle<Map> map); |
| 1087 | 1097 |
| 1088 template<class Condition> | 1098 template<class Condition> |
| 1089 HInstruction* If(HValue *p) { | 1099 HInstruction* If(HValue *p) { |
| 1090 HControlInstruction* compare = new(zone()) Condition(p); | 1100 HControlInstruction* compare = new(zone()) Condition(p); |
| 1091 AddCompare(compare); | 1101 AddCompare(compare); |
| 1092 return compare; | 1102 return compare; |
| 1093 } | 1103 } |
| 1094 | 1104 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1106 HBasicBlock* block0 = compare->SuccessorAt(0); | 1116 HBasicBlock* block0 = compare->SuccessorAt(0); |
| 1107 HBasicBlock* block1 = compare->SuccessorAt(1); | 1117 HBasicBlock* block1 = compare->SuccessorAt(1); |
| 1108 compare->SetSuccessorAt(0, block1); | 1118 compare->SetSuccessorAt(0, block1); |
| 1109 compare->SetSuccessorAt(1, block0); | 1119 compare->SetSuccessorAt(1, block0); |
| 1110 return compare; | 1120 return compare; |
| 1111 } | 1121 } |
| 1112 | 1122 |
| 1113 HInstruction* OrIfCompare( | 1123 HInstruction* OrIfCompare( |
| 1114 HValue* p1, | 1124 HValue* p1, |
| 1115 HValue* p2, | 1125 HValue* p2, |
| 1116 Token::Value token, | 1126 Token::Value token) { |
| 1117 Representation input_representation = Representation::Integer32()) { | |
| 1118 Or(); | 1127 Or(); |
| 1119 return IfCompare(p1, p2, token, input_representation); | 1128 return IfCompare(p1, p2, token); |
| 1120 } | 1129 } |
| 1121 | 1130 |
| 1122 HInstruction* OrIfCompareMap(HValue* left, Handle<Map> map) { | 1131 HInstruction* OrIfCompareMap(HValue* left, Handle<Map> map) { |
| 1123 Or(); | 1132 Or(); |
| 1124 return IfCompareMap(left, map); | 1133 return IfCompareMap(left, map); |
| 1125 } | 1134 } |
| 1126 | 1135 |
| 1127 template<class Condition> | 1136 template<class Condition> |
| 1128 HInstruction* OrIf(HValue *p) { | 1137 HInstruction* OrIf(HValue *p) { |
| 1129 Or(); | 1138 Or(); |
| 1130 return If<Condition>(p); | 1139 return If<Condition>(p); |
| 1131 } | 1140 } |
| 1132 | 1141 |
| 1133 template<class Condition, class P2> | 1142 template<class Condition, class P2> |
| 1134 HInstruction* OrIf(HValue* p1, P2 p2) { | 1143 HInstruction* OrIf(HValue* p1, P2 p2) { |
| 1135 Or(); | 1144 Or(); |
| 1136 return If<Condition>(p1, p2); | 1145 return If<Condition>(p1, p2); |
| 1137 } | 1146 } |
| 1138 | 1147 |
| 1139 HInstruction* AndIfCompare( | 1148 HInstruction* AndIfCompare( |
| 1140 HValue* p1, | 1149 HValue* p1, |
| 1141 HValue* p2, | 1150 HValue* p2, |
| 1142 Token::Value token, | 1151 Token::Value token) { |
| 1143 Representation input_representation = Representation::Integer32()) { | |
| 1144 And(); | 1152 And(); |
| 1145 return IfCompare(p1, p2, token, input_representation); | 1153 return IfCompare(p1, p2, token); |
| 1146 } | 1154 } |
| 1147 | 1155 |
| 1148 HInstruction* AndIfCompareMap(HValue* left, Handle<Map> map) { | 1156 HInstruction* AndIfCompareMap(HValue* left, Handle<Map> map) { |
| 1149 And(); | 1157 And(); |
| 1150 return IfCompareMap(left, map); | 1158 return IfCompareMap(left, map); |
| 1151 } | 1159 } |
| 1152 | 1160 |
| 1153 template<class Condition> | 1161 template<class Condition> |
| 1154 HInstruction* AndIf(HValue *p) { | 1162 HInstruction* AndIf(HValue *p) { |
| 1155 And(); | 1163 And(); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 HValue* capacity); | 1354 HValue* capacity); |
| 1347 | 1355 |
| 1348 HValue* BuildCloneShallowArray(HContext* context, | 1356 HValue* BuildCloneShallowArray(HContext* context, |
| 1349 HValue* boilerplate, | 1357 HValue* boilerplate, |
| 1350 AllocationSiteMode mode, | 1358 AllocationSiteMode mode, |
| 1351 ElementsKind kind, | 1359 ElementsKind kind, |
| 1352 int length); | 1360 int length); |
| 1353 | 1361 |
| 1354 void BuildCompareNil( | 1362 void BuildCompareNil( |
| 1355 HValue* value, | 1363 HValue* value, |
| 1356 CompareNilICStub::Types types, | 1364 Handle<Type> type, |
| 1357 Handle<Map> map, | |
| 1358 int position, | 1365 int position, |
| 1359 HIfContinuation* continuation); | 1366 HIfContinuation* continuation); |
| 1360 | 1367 |
| 1361 HValue* BuildCreateAllocationSiteInfo(HValue* previous_object, | 1368 HValue* BuildCreateAllocationSiteInfo(HValue* previous_object, |
| 1362 int previous_object_size, | 1369 int previous_object_size, |
| 1363 HValue* payload); | 1370 HValue* payload); |
| 1364 | 1371 |
| 1365 HInstruction* BuildGetNativeContext(HValue* context); | 1372 HInstruction* BuildGetNativeContext(HValue* context); |
| 1366 HInstruction* BuildGetArrayFunction(HValue* context); | 1373 HInstruction* BuildGetArrayFunction(HValue* context); |
| 1367 | 1374 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 | 1625 |
| 1619 void AddPhi(HPhi* phi); | 1626 void AddPhi(HPhi* phi); |
| 1620 | 1627 |
| 1621 void PushAndAdd(HInstruction* instr); | 1628 void PushAndAdd(HInstruction* instr); |
| 1622 | 1629 |
| 1623 // Remove the arguments from the bailout environment and emit instructions | 1630 // Remove the arguments from the bailout environment and emit instructions |
| 1624 // to push them as outgoing parameters. | 1631 // to push them as outgoing parameters. |
| 1625 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); | 1632 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); |
| 1626 | 1633 |
| 1627 static Representation ToRepresentation(TypeInfo info); | 1634 static Representation ToRepresentation(TypeInfo info); |
| 1635 static Representation ToRepresentation(Handle<Type> type); |
| 1628 | 1636 |
| 1629 void SetUpScope(Scope* scope); | 1637 void SetUpScope(Scope* scope); |
| 1630 virtual void VisitStatements(ZoneList<Statement*>* statements); | 1638 virtual void VisitStatements(ZoneList<Statement*>* statements); |
| 1631 | 1639 |
| 1632 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 1640 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| 1633 AST_NODE_LIST(DECLARE_VISIT) | 1641 AST_NODE_LIST(DECLARE_VISIT) |
| 1634 #undef DECLARE_VISIT | 1642 #undef DECLARE_VISIT |
| 1635 | 1643 |
| 1636 // Helpers for flow graph construction. | 1644 // Helpers for flow graph construction. |
| 1637 enum GlobalPropertyAccess { | 1645 enum GlobalPropertyAccess { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 HValue* value, | 1691 HValue* value, |
| 1684 int position, | 1692 int position, |
| 1685 BailoutId ast_id); | 1693 BailoutId ast_id); |
| 1686 | 1694 |
| 1687 void HandlePropertyAssignment(Assignment* expr); | 1695 void HandlePropertyAssignment(Assignment* expr); |
| 1688 void HandleCompoundAssignment(Assignment* expr); | 1696 void HandleCompoundAssignment(Assignment* expr); |
| 1689 void HandlePolymorphicLoadNamedField(Property* expr, | 1697 void HandlePolymorphicLoadNamedField(Property* expr, |
| 1690 HValue* object, | 1698 HValue* object, |
| 1691 SmallMapList* types, | 1699 SmallMapList* types, |
| 1692 Handle<String> name); | 1700 Handle<String> name); |
| 1693 bool HandlePolymorphicArrayLengthLoad(Property* expr, | 1701 HInstruction* TryLoadPolymorphicAsMonomorphic(Property* expr, |
| 1694 HValue* object, | 1702 HValue* object, |
| 1695 SmallMapList* types, | 1703 SmallMapList* types, |
| 1696 Handle<String> name); | 1704 Handle<String> name); |
| 1697 void HandlePolymorphicStoreNamedField(Assignment* expr, | 1705 void HandlePolymorphicStoreNamedField(Assignment* expr, |
| 1698 HValue* object, | 1706 HValue* object, |
| 1699 HValue* value, | 1707 HValue* value, |
| 1700 SmallMapList* types, | 1708 SmallMapList* types, |
| 1709 Handle<String> name); |
| 1710 bool TryStorePolymorphicAsMonomorphic(Assignment* expr, |
| 1711 HValue* object, |
| 1712 HValue* value, |
| 1713 SmallMapList* types, |
| 1701 Handle<String> name); | 1714 Handle<String> name); |
| 1702 void HandlePolymorphicCallNamed(Call* expr, | 1715 void HandlePolymorphicCallNamed(Call* expr, |
| 1703 HValue* receiver, | 1716 HValue* receiver, |
| 1704 SmallMapList* types, | 1717 SmallMapList* types, |
| 1705 Handle<String> name); | 1718 Handle<String> name); |
| 1706 void HandleLiteralCompareTypeof(CompareOperation* expr, | 1719 void HandleLiteralCompareTypeof(CompareOperation* expr, |
| 1707 HTypeof* typeof_expr, | 1720 HTypeof* typeof_expr, |
| 1708 Handle<String> check); | 1721 Handle<String> check); |
| 1709 void HandleLiteralCompareNil(CompareOperation* expr, | 1722 void HandleLiteralCompareNil(CompareOperation* expr, |
| 1710 HValue* value, | 1723 HValue* value, |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1915 unsigned total_size_; | 1928 unsigned total_size_; |
| 1916 int64_t full_code_gen_; | 1929 int64_t full_code_gen_; |
| 1917 double source_size_; | 1930 double source_size_; |
| 1918 }; | 1931 }; |
| 1919 | 1932 |
| 1920 | 1933 |
| 1921 class HPhase BASE_EMBEDDED { | 1934 class HPhase BASE_EMBEDDED { |
| 1922 public: | 1935 public: |
| 1923 static const char* const kFullCodeGen; | 1936 static const char* const kFullCodeGen; |
| 1924 | 1937 |
| 1925 HPhase(const char* name, Isolate* isolate); | 1938 HPhase(const char* name, Isolate* isolate, Zone* zone); |
| 1926 HPhase(const char* name, HGraph* graph); | 1939 HPhase(const char* name, HGraph* graph); |
| 1927 HPhase(const char* name, LChunk* chunk); | 1940 HPhase(const char* name, LChunk* chunk); |
| 1928 HPhase(const char* name, LAllocator* allocator); | 1941 HPhase(const char* name, LAllocator* allocator); |
| 1929 ~HPhase(); | 1942 ~HPhase(); |
| 1930 | 1943 |
| 1931 private: | 1944 private: |
| 1932 void Init(Isolate* isolate, | 1945 void Init(Isolate* isolate, |
| 1933 const char* name, | 1946 const char* name, |
| 1947 Zone* zone, |
| 1934 HGraph* graph, | 1948 HGraph* graph, |
| 1935 LChunk* chunk, | 1949 LChunk* chunk, |
| 1936 LAllocator* allocator); | 1950 LAllocator* allocator); |
| 1937 | 1951 |
| 1938 Isolate* isolate_; | 1952 Isolate* isolate_; |
| 1939 const char* name_; | 1953 const char* name_; |
| 1954 Zone* zone_; |
| 1940 HGraph* graph_; | 1955 HGraph* graph_; |
| 1941 LChunk* chunk_; | 1956 LChunk* chunk_; |
| 1942 LAllocator* allocator_; | 1957 LAllocator* allocator_; |
| 1943 int64_t start_ticks_; | 1958 int64_t start_ticks_; |
| 1944 unsigned start_allocation_size_; | 1959 unsigned start_allocation_size_; |
| 1945 }; | 1960 }; |
| 1946 | 1961 |
| 1947 | 1962 |
| 1948 class HTracer: public Malloced { | 1963 class HTracer: public Malloced { |
| 1949 public: | 1964 public: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 EmbeddedVector<char, 64> filename_; | 2038 EmbeddedVector<char, 64> filename_; |
| 2024 HeapStringAllocator string_allocator_; | 2039 HeapStringAllocator string_allocator_; |
| 2025 StringStream trace_; | 2040 StringStream trace_; |
| 2026 int indent_; | 2041 int indent_; |
| 2027 }; | 2042 }; |
| 2028 | 2043 |
| 2029 | 2044 |
| 2030 } } // namespace v8::internal | 2045 } } // namespace v8::internal |
| 2031 | 2046 |
| 2032 #endif // V8_HYDROGEN_H_ | 2047 #endif // V8_HYDROGEN_H_ |
| OLD | NEW |