| 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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 static const int kNoRedefinedOperand = -1; | 714 static const int kNoRedefinedOperand = -1; |
| 715 virtual int RedefinedOperandIndex() { return kNoRedefinedOperand; } | 715 virtual int RedefinedOperandIndex() { return kNoRedefinedOperand; } |
| 716 bool IsInformativeDefinition() { | 716 bool IsInformativeDefinition() { |
| 717 return RedefinedOperandIndex() != kNoRedefinedOperand; | 717 return RedefinedOperandIndex() != kNoRedefinedOperand; |
| 718 } | 718 } |
| 719 HValue* RedefinedOperand() { | 719 HValue* RedefinedOperand() { |
| 720 int index = RedefinedOperandIndex(); | 720 int index = RedefinedOperandIndex(); |
| 721 return index == kNoRedefinedOperand ? NULL : OperandAt(index); | 721 return index == kNoRedefinedOperand ? NULL : OperandAt(index); |
| 722 } | 722 } |
| 723 | 723 |
| 724 bool CanReplaceWithDummyUses(); |
| 725 |
| 726 virtual int argument_delta() const { return 0; } |
| 727 |
| 724 // A purely informative definition is an idef that will not emit code and | 728 // A purely informative definition is an idef that will not emit code and |
| 725 // should therefore be removed from the graph in the RestoreActualValues | 729 // should therefore be removed from the graph in the RestoreActualValues |
| 726 // phase (so that live ranges will be shorter). | 730 // phase (so that live ranges will be shorter). |
| 727 virtual bool IsPurelyInformativeDefinition() { return false; } | 731 virtual bool IsPurelyInformativeDefinition() { return false; } |
| 728 | 732 |
| 729 // This method must always return the original HValue SSA definition, | 733 // This method must always return the original HValue SSA definition, |
| 730 // regardless of any chain of iDefs of this value. | 734 // regardless of any chain of iDefs of this value. |
| 731 HValue* ActualValue() { | 735 HValue* ActualValue() { |
| 732 HValue* value = this; | 736 HValue* value = this; |
| 733 int index; | 737 int index; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 756 } | 760 } |
| 757 int UseCount() const; | 761 int UseCount() const; |
| 758 | 762 |
| 759 // Mark this HValue as dead and to be removed from other HValues' use lists. | 763 // Mark this HValue as dead and to be removed from other HValues' use lists. |
| 760 void Kill(); | 764 void Kill(); |
| 761 | 765 |
| 762 int flags() const { return flags_; } | 766 int flags() const { return flags_; } |
| 763 void SetFlag(Flag f) { flags_ |= (1 << f); } | 767 void SetFlag(Flag f) { flags_ |= (1 << f); } |
| 764 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } | 768 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } |
| 765 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } | 769 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } |
| 770 void CopyFlag(Flag f, HValue* other) { |
| 771 if (other->CheckFlag(f)) SetFlag(f); |
| 772 } |
| 766 | 773 |
| 767 // Returns true if the flag specified is set for all uses, false otherwise. | 774 // Returns true if the flag specified is set for all uses, false otherwise. |
| 768 bool CheckUsesForFlag(Flag f) const; | 775 bool CheckUsesForFlag(Flag f) const; |
| 769 // Same as before and the first one without the flag is returned in value. | 776 // Same as before and the first one without the flag is returned in value. |
| 770 bool CheckUsesForFlag(Flag f, HValue** value) const; | 777 bool CheckUsesForFlag(Flag f, HValue** value) const; |
| 771 // Returns true if the flag specified is set for all uses, and this set | 778 // Returns true if the flag specified is set for all uses, and this set |
| 772 // of uses is non-empty. | 779 // of uses is non-empty. |
| 773 bool HasAtLeastOneUseWithFlagAndNoneWithout(Flag f) const; | 780 bool HasAtLeastOneUseWithFlagAndNoneWithout(Flag f) const; |
| 774 | 781 |
| 775 GVNFlagSet gvn_flags() const { return gvn_flags_; } | 782 GVNFlagSet gvn_flags() const { return gvn_flags_; } |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 | 1183 |
| 1177 | 1184 |
| 1178 class HControlInstruction : public HInstruction { | 1185 class HControlInstruction : public HInstruction { |
| 1179 public: | 1186 public: |
| 1180 virtual HBasicBlock* SuccessorAt(int i) = 0; | 1187 virtual HBasicBlock* SuccessorAt(int i) = 0; |
| 1181 virtual int SuccessorCount() = 0; | 1188 virtual int SuccessorCount() = 0; |
| 1182 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; | 1189 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; |
| 1183 | 1190 |
| 1184 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1191 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1185 | 1192 |
| 1193 virtual bool KnownSuccessorBlock(HBasicBlock** block) { |
| 1194 *block = NULL; |
| 1195 return false; |
| 1196 } |
| 1197 |
| 1186 HBasicBlock* FirstSuccessor() { | 1198 HBasicBlock* FirstSuccessor() { |
| 1187 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; | 1199 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; |
| 1188 } | 1200 } |
| 1189 HBasicBlock* SecondSuccessor() { | 1201 HBasicBlock* SecondSuccessor() { |
| 1190 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; | 1202 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; |
| 1191 } | 1203 } |
| 1192 | 1204 |
| 1193 void Not() { | 1205 void Not() { |
| 1194 HBasicBlock* swap = SuccessorAt(0); | 1206 HBasicBlock* swap = SuccessorAt(0); |
| 1195 SetSuccessorAt(0, SuccessorAt(1)); | 1207 SetSuccessorAt(0, SuccessorAt(1)); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1265 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1277 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 1266 return Representation::None(); | 1278 return Representation::None(); |
| 1267 } | 1279 } |
| 1268 | 1280 |
| 1269 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1281 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1270 | 1282 |
| 1271 DECLARE_CONCRETE_INSTRUCTION(DummyUse); | 1283 DECLARE_CONCRETE_INSTRUCTION(DummyUse); |
| 1272 }; | 1284 }; |
| 1273 | 1285 |
| 1274 | 1286 |
| 1275 class HDeoptimize V8_FINAL : public HTemplateInstruction<0> { | |
| 1276 public: | |
| 1277 DECLARE_INSTRUCTION_FACTORY_P2(HDeoptimize, const char*, | |
| 1278 Deoptimizer::BailoutType); | |
| 1279 | |
| 1280 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | |
| 1281 return Representation::None(); | |
| 1282 } | |
| 1283 | |
| 1284 const char* reason() const { return reason_; } | |
| 1285 Deoptimizer::BailoutType type() { return type_; } | |
| 1286 | |
| 1287 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) | |
| 1288 | |
| 1289 private: | |
| 1290 explicit HDeoptimize(const char* reason, Deoptimizer::BailoutType type) | |
| 1291 : reason_(reason), type_(type) {} | |
| 1292 | |
| 1293 const char* reason_; | |
| 1294 Deoptimizer::BailoutType type_; | |
| 1295 }; | |
| 1296 | |
| 1297 | |
| 1298 // Inserts an int3/stop break instruction for debugging purposes. | 1287 // Inserts an int3/stop break instruction for debugging purposes. |
| 1299 class HDebugBreak V8_FINAL : public HTemplateInstruction<0> { | 1288 class HDebugBreak V8_FINAL : public HTemplateInstruction<0> { |
| 1300 public: | 1289 public: |
| 1301 DECLARE_INSTRUCTION_FACTORY_P0(HDebugBreak); | 1290 DECLARE_INSTRUCTION_FACTORY_P0(HDebugBreak); |
| 1302 | 1291 |
| 1303 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1292 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 1304 return Representation::None(); | 1293 return Representation::None(); |
| 1305 } | 1294 } |
| 1306 | 1295 |
| 1307 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) | 1296 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) |
| 1308 }; | 1297 }; |
| 1309 | 1298 |
| 1310 | 1299 |
| 1311 class HGoto V8_FINAL : public HTemplateControlInstruction<1, 0> { | 1300 class HGoto V8_FINAL : public HTemplateControlInstruction<1, 0> { |
| 1312 public: | 1301 public: |
| 1313 explicit HGoto(HBasicBlock* target) { | 1302 explicit HGoto(HBasicBlock* target) { |
| 1314 SetSuccessorAt(0, target); | 1303 SetSuccessorAt(0, target); |
| 1315 } | 1304 } |
| 1316 | 1305 |
| 1306 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE { |
| 1307 *block = FirstSuccessor(); |
| 1308 return true; |
| 1309 } |
| 1310 |
| 1317 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1311 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 1318 return Representation::None(); | 1312 return Representation::None(); |
| 1319 } | 1313 } |
| 1320 | 1314 |
| 1321 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 1315 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 1322 | 1316 |
| 1323 DECLARE_CONCRETE_INSTRUCTION(Goto) | 1317 DECLARE_CONCRETE_INSTRUCTION(Goto) |
| 1324 }; | 1318 }; |
| 1325 | 1319 |
| 1326 | 1320 |
| 1321 class HDeoptimize V8_FINAL : public HTemplateControlInstruction<1, 0> { |
| 1322 public: |
| 1323 static HInstruction* New(Zone* zone, |
| 1324 HValue* context, |
| 1325 const char* reason, |
| 1326 Deoptimizer::BailoutType type, |
| 1327 HBasicBlock* unreachable_continuation) { |
| 1328 return new(zone) HDeoptimize(reason, type, unreachable_continuation); |
| 1329 } |
| 1330 |
| 1331 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE { |
| 1332 *block = NULL; |
| 1333 return true; |
| 1334 } |
| 1335 |
| 1336 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 1337 return Representation::None(); |
| 1338 } |
| 1339 |
| 1340 const char* reason() const { return reason_; } |
| 1341 Deoptimizer::BailoutType type() { return type_; } |
| 1342 |
| 1343 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
| 1344 |
| 1345 private: |
| 1346 explicit HDeoptimize(const char* reason, |
| 1347 Deoptimizer::BailoutType type, |
| 1348 HBasicBlock* unreachable_continuation) |
| 1349 : reason_(reason), type_(type) { |
| 1350 SetSuccessorAt(0, unreachable_continuation); |
| 1351 } |
| 1352 |
| 1353 const char* reason_; |
| 1354 Deoptimizer::BailoutType type_; |
| 1355 }; |
| 1356 |
| 1357 |
| 1327 class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> { | 1358 class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> { |
| 1328 public: | 1359 public: |
| 1329 HUnaryControlInstruction(HValue* value, | 1360 HUnaryControlInstruction(HValue* value, |
| 1330 HBasicBlock* true_target, | 1361 HBasicBlock* true_target, |
| 1331 HBasicBlock* false_target) { | 1362 HBasicBlock* false_target) { |
| 1332 SetOperandAt(0, value); | 1363 SetOperandAt(0, value); |
| 1333 SetSuccessorAt(0, true_target); | 1364 SetSuccessorAt(0, true_target); |
| 1334 SetSuccessorAt(1, false_target); | 1365 SetSuccessorAt(1, false_target); |
| 1335 } | 1366 } |
| 1336 | 1367 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1347 ToBooleanStub::Types); | 1378 ToBooleanStub::Types); |
| 1348 DECLARE_INSTRUCTION_FACTORY_P4(HBranch, HValue*, | 1379 DECLARE_INSTRUCTION_FACTORY_P4(HBranch, HValue*, |
| 1349 ToBooleanStub::Types, | 1380 ToBooleanStub::Types, |
| 1350 HBasicBlock*, HBasicBlock*); | 1381 HBasicBlock*, HBasicBlock*); |
| 1351 | 1382 |
| 1352 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1383 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 1353 return Representation::None(); | 1384 return Representation::None(); |
| 1354 } | 1385 } |
| 1355 virtual Representation observed_input_representation(int index) V8_OVERRIDE; | 1386 virtual Representation observed_input_representation(int index) V8_OVERRIDE; |
| 1356 | 1387 |
| 1388 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
| 1389 |
| 1357 ToBooleanStub::Types expected_input_types() const { | 1390 ToBooleanStub::Types expected_input_types() const { |
| 1358 return expected_input_types_; | 1391 return expected_input_types_; |
| 1359 } | 1392 } |
| 1360 | 1393 |
| 1361 DECLARE_CONCRETE_INSTRUCTION(Branch) | 1394 DECLARE_CONCRETE_INSTRUCTION(Branch) |
| 1362 | 1395 |
| 1363 private: | 1396 private: |
| 1364 HBranch(HValue* value, | 1397 HBranch(HValue* value, |
| 1365 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(), | 1398 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(), |
| 1366 HBasicBlock* true_target = NULL, | 1399 HBasicBlock* true_target = NULL, |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 InliningKind inlining_kind_; | 1928 InliningKind inlining_kind_; |
| 1896 Variable* arguments_var_; | 1929 Variable* arguments_var_; |
| 1897 HArgumentsObject* arguments_object_; | 1930 HArgumentsObject* arguments_object_; |
| 1898 bool undefined_receiver_; | 1931 bool undefined_receiver_; |
| 1899 ZoneList<HBasicBlock*> return_targets_; | 1932 ZoneList<HBasicBlock*> return_targets_; |
| 1900 }; | 1933 }; |
| 1901 | 1934 |
| 1902 | 1935 |
| 1903 class HLeaveInlined V8_FINAL : public HTemplateInstruction<0> { | 1936 class HLeaveInlined V8_FINAL : public HTemplateInstruction<0> { |
| 1904 public: | 1937 public: |
| 1905 HLeaveInlined() { } | 1938 HLeaveInlined(HEnterInlined* entry, |
| 1939 int drop_count) |
| 1940 : entry_(entry), |
| 1941 drop_count_(drop_count) { } |
| 1906 | 1942 |
| 1907 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1943 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 1908 return Representation::None(); | 1944 return Representation::None(); |
| 1909 } | 1945 } |
| 1910 | 1946 |
| 1947 virtual int argument_delta() const V8_OVERRIDE { |
| 1948 return entry_->arguments_pushed() ? -drop_count_ : 0; |
| 1949 } |
| 1950 |
| 1911 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) | 1951 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) |
| 1952 |
| 1953 private: |
| 1954 HEnterInlined* entry_; |
| 1955 int drop_count_; |
| 1912 }; | 1956 }; |
| 1913 | 1957 |
| 1914 | 1958 |
| 1915 class HPushArgument V8_FINAL : public HUnaryOperation { | 1959 class HPushArgument V8_FINAL : public HUnaryOperation { |
| 1916 public: | 1960 public: |
| 1917 DECLARE_INSTRUCTION_FACTORY_P1(HPushArgument, HValue*); | 1961 DECLARE_INSTRUCTION_FACTORY_P1(HPushArgument, HValue*); |
| 1918 | 1962 |
| 1919 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 1963 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 1920 return Representation::Tagged(); | 1964 return Representation::Tagged(); |
| 1921 } | 1965 } |
| 1922 | 1966 |
| 1967 virtual int argument_delta() const V8_OVERRIDE { return 1; } |
| 1923 HValue* argument() { return OperandAt(0); } | 1968 HValue* argument() { return OperandAt(0); } |
| 1924 | 1969 |
| 1925 DECLARE_CONCRETE_INSTRUCTION(PushArgument) | 1970 DECLARE_CONCRETE_INSTRUCTION(PushArgument) |
| 1926 | 1971 |
| 1927 private: | 1972 private: |
| 1928 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { | 1973 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { |
| 1929 set_representation(Representation::Tagged()); | 1974 set_representation(Representation::Tagged()); |
| 1930 } | 1975 } |
| 1931 }; | 1976 }; |
| 1932 | 1977 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2062 // The argument count includes the receiver. | 2107 // The argument count includes the receiver. |
| 2063 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { | 2108 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { |
| 2064 this->set_representation(Representation::Tagged()); | 2109 this->set_representation(Representation::Tagged()); |
| 2065 this->SetAllSideEffects(); | 2110 this->SetAllSideEffects(); |
| 2066 } | 2111 } |
| 2067 | 2112 |
| 2068 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { | 2113 virtual HType CalculateInferredType() V8_FINAL V8_OVERRIDE { |
| 2069 return HType::Tagged(); | 2114 return HType::Tagged(); |
| 2070 } | 2115 } |
| 2071 | 2116 |
| 2072 virtual int argument_count() const { return argument_count_; } | 2117 virtual int argument_count() const { |
| 2118 return argument_count_; |
| 2119 } |
| 2120 |
| 2121 virtual int argument_delta() const V8_OVERRIDE { |
| 2122 return -argument_count(); |
| 2123 } |
| 2073 | 2124 |
| 2074 virtual bool IsCall() V8_FINAL V8_OVERRIDE { return true; } | 2125 virtual bool IsCall() V8_FINAL V8_OVERRIDE { return true; } |
| 2075 | 2126 |
| 2076 private: | 2127 private: |
| 2077 int argument_count_; | 2128 int argument_count_; |
| 2078 }; | 2129 }; |
| 2079 | 2130 |
| 2080 | 2131 |
| 2081 class HUnaryCall : public HCall<1> { | 2132 class HUnaryCall : public HCall<1> { |
| 2082 public: | 2133 public: |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2338 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime, | 2389 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime, |
| 2339 Handle<String>, | 2390 Handle<String>, |
| 2340 const Runtime::Function*, | 2391 const Runtime::Function*, |
| 2341 int); | 2392 int); |
| 2342 | 2393 |
| 2343 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 2394 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 2344 | 2395 |
| 2345 HValue* context() { return OperandAt(0); } | 2396 HValue* context() { return OperandAt(0); } |
| 2346 const Runtime::Function* function() const { return c_function_; } | 2397 const Runtime::Function* function() const { return c_function_; } |
| 2347 Handle<String> name() const { return name_; } | 2398 Handle<String> name() const { return name_; } |
| 2399 SaveFPRegsMode save_doubles() const { return save_doubles_; } |
| 2400 void set_save_doubles(SaveFPRegsMode save_doubles) { |
| 2401 save_doubles_ = save_doubles; |
| 2402 } |
| 2348 | 2403 |
| 2349 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2404 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 2350 return Representation::Tagged(); | 2405 return Representation::Tagged(); |
| 2351 } | 2406 } |
| 2352 | 2407 |
| 2353 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) | 2408 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
| 2354 | 2409 |
| 2355 private: | 2410 private: |
| 2356 HCallRuntime(HValue* context, | 2411 HCallRuntime(HValue* context, |
| 2357 Handle<String> name, | 2412 Handle<String> name, |
| 2358 const Runtime::Function* c_function, | 2413 const Runtime::Function* c_function, |
| 2359 int argument_count) | 2414 int argument_count) |
| 2360 : HCall<1>(argument_count), c_function_(c_function), name_(name) { | 2415 : HCall<1>(argument_count), c_function_(c_function), name_(name), |
| 2416 save_doubles_(kDontSaveFPRegs) { |
| 2361 SetOperandAt(0, context); | 2417 SetOperandAt(0, context); |
| 2362 } | 2418 } |
| 2363 | 2419 |
| 2364 const Runtime::Function* c_function_; | 2420 const Runtime::Function* c_function_; |
| 2365 Handle<String> name_; | 2421 Handle<String> name_; |
| 2422 SaveFPRegsMode save_doubles_; |
| 2366 }; | 2423 }; |
| 2367 | 2424 |
| 2368 | 2425 |
| 2369 class HMapEnumLength V8_FINAL : public HUnaryOperation { | 2426 class HMapEnumLength V8_FINAL : public HUnaryOperation { |
| 2370 public: | 2427 public: |
| 2371 DECLARE_INSTRUCTION_FACTORY_P1(HMapEnumLength, HValue*); | 2428 DECLARE_INSTRUCTION_FACTORY_P1(HMapEnumLength, HValue*); |
| 2372 | 2429 |
| 2373 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 2430 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 2374 return Representation::Tagged(); | 2431 return Representation::Tagged(); |
| 2375 } | 2432 } |
| (...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3475 int32_value_ == other_constant->int32_value_; | 3532 int32_value_ == other_constant->int32_value_; |
| 3476 } else if (has_double_value_) { | 3533 } else if (has_double_value_) { |
| 3477 return other_constant->has_double_value_ && | 3534 return other_constant->has_double_value_ && |
| 3478 BitCast<int64_t>(double_value_) == | 3535 BitCast<int64_t>(double_value_) == |
| 3479 BitCast<int64_t>(other_constant->double_value_); | 3536 BitCast<int64_t>(other_constant->double_value_); |
| 3480 } else if (has_external_reference_value_) { | 3537 } else if (has_external_reference_value_) { |
| 3481 return other_constant->has_external_reference_value_ && | 3538 return other_constant->has_external_reference_value_ && |
| 3482 external_reference_value_ == | 3539 external_reference_value_ == |
| 3483 other_constant->external_reference_value_; | 3540 other_constant->external_reference_value_; |
| 3484 } else { | 3541 } else { |
| 3542 if (other_constant->has_int32_value_ || |
| 3543 other_constant->has_double_value_ || |
| 3544 other_constant->has_external_reference_value_) { |
| 3545 return false; |
| 3546 } |
| 3485 ASSERT(!object_.handle().is_null()); | 3547 ASSERT(!object_.handle().is_null()); |
| 3486 return other_constant->object_ == object_; | 3548 return other_constant->object_ == object_; |
| 3487 } | 3549 } |
| 3488 } | 3550 } |
| 3489 | 3551 |
| 3490 private: | 3552 private: |
| 3491 friend class HGraph; | 3553 friend class HGraph; |
| 3492 HConstant(Handle<Object> handle, Representation r = Representation::None()); | 3554 HConstant(Handle<Object> handle, Representation r = Representation::None()); |
| 3493 HConstant(int32_t value, | 3555 HConstant(int32_t value, |
| 3494 Representation r = Representation::None(), | 3556 Representation r = Representation::None(), |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4078 HBasicBlock* false_target = NULL) | 4140 HBasicBlock* false_target = NULL) |
| 4079 : HUnaryControlInstruction(value, true_target, false_target) { | 4141 : HUnaryControlInstruction(value, true_target, false_target) { |
| 4080 SetFlag(kFlexibleRepresentation); | 4142 SetFlag(kFlexibleRepresentation); |
| 4081 SetFlag(kAllowUndefinedAsNaN); | 4143 SetFlag(kAllowUndefinedAsNaN); |
| 4082 } | 4144 } |
| 4083 }; | 4145 }; |
| 4084 | 4146 |
| 4085 | 4147 |
| 4086 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { | 4148 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { |
| 4087 public: | 4149 public: |
| 4150 HCompareObjectEqAndBranch(HValue* left, |
| 4151 HValue* right, |
| 4152 HBasicBlock* true_target = NULL, |
| 4153 HBasicBlock* false_target = NULL) { |
| 4154 // TODO(danno): make this private when the IfBuilder properly constructs |
| 4155 // control flow instructions. |
| 4156 ASSERT(!left->IsConstant() || |
| 4157 (!HConstant::cast(left)->HasInteger32Value() || |
| 4158 HConstant::cast(left)->HasSmiValue())); |
| 4159 ASSERT(!right->IsConstant() || |
| 4160 (!HConstant::cast(right)->HasInteger32Value() || |
| 4161 HConstant::cast(right)->HasSmiValue())); |
| 4162 SetOperandAt(0, left); |
| 4163 SetOperandAt(1, right); |
| 4164 SetSuccessorAt(0, true_target); |
| 4165 SetSuccessorAt(1, false_target); |
| 4166 } |
| 4167 |
| 4088 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); | 4168 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); |
| 4089 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*, | 4169 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*, |
| 4090 HBasicBlock*, HBasicBlock*); | 4170 HBasicBlock*, HBasicBlock*); |
| 4091 | 4171 |
| 4172 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; |
| 4173 |
| 4092 HValue* left() { return OperandAt(0); } | 4174 HValue* left() { return OperandAt(0); } |
| 4093 HValue* right() { return OperandAt(1); } | 4175 HValue* right() { return OperandAt(1); } |
| 4094 | 4176 |
| 4095 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 4177 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 4096 | 4178 |
| 4097 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4179 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 4098 return Representation::Tagged(); | 4180 return Representation::Tagged(); |
| 4099 } | 4181 } |
| 4100 | 4182 |
| 4101 virtual Representation observed_input_representation(int index) V8_OVERRIDE { | 4183 virtual Representation observed_input_representation(int index) V8_OVERRIDE { |
| 4102 return Representation::Tagged(); | 4184 return Representation::Tagged(); |
| 4103 } | 4185 } |
| 4104 | 4186 |
| 4105 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) | 4187 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) |
| 4106 | |
| 4107 private: | |
| 4108 HCompareObjectEqAndBranch(HValue* left, | |
| 4109 HValue* right, | |
| 4110 HBasicBlock* true_target = NULL, | |
| 4111 HBasicBlock* false_target = NULL) { | |
| 4112 SetOperandAt(0, left); | |
| 4113 SetOperandAt(1, right); | |
| 4114 SetSuccessorAt(0, true_target); | |
| 4115 SetSuccessorAt(1, false_target); | |
| 4116 } | |
| 4117 }; | 4188 }; |
| 4118 | 4189 |
| 4119 | 4190 |
| 4120 class HIsObjectAndBranch V8_FINAL : public HUnaryControlInstruction { | 4191 class HIsObjectAndBranch V8_FINAL : public HUnaryControlInstruction { |
| 4121 public: | 4192 public: |
| 4122 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); | 4193 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); |
| 4123 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, | 4194 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, |
| 4124 HBasicBlock*, HBasicBlock*); | 4195 HBasicBlock*, HBasicBlock*); |
| 4125 | 4196 |
| 4126 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 4197 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| (...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5879 HLoadNamedField* b = HLoadNamedField::cast(other); | 5950 HLoadNamedField* b = HLoadNamedField::cast(other); |
| 5880 return access_.Equals(b->access_); | 5951 return access_.Equals(b->access_); |
| 5881 } | 5952 } |
| 5882 | 5953 |
| 5883 private: | 5954 private: |
| 5884 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) { | 5955 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) { |
| 5885 ASSERT(object != NULL); | 5956 ASSERT(object != NULL); |
| 5886 SetOperandAt(0, object); | 5957 SetOperandAt(0, object); |
| 5887 | 5958 |
| 5888 Representation representation = access.representation(); | 5959 Representation representation = access.representation(); |
| 5889 if (representation.IsSmi()) { | 5960 if (representation.IsByte()) { |
| 5961 set_representation(Representation::Integer32()); |
| 5962 } else if (representation.IsSmi()) { |
| 5890 set_type(HType::Smi()); | 5963 set_type(HType::Smi()); |
| 5891 set_representation(representation); | 5964 set_representation(representation); |
| 5892 } else if (representation.IsDouble() || | 5965 } else if (representation.IsDouble() || |
| 5893 representation.IsExternal() || | 5966 representation.IsExternal() || |
| 5894 representation.IsInteger32()) { | 5967 representation.IsInteger32()) { |
| 5895 set_representation(representation); | 5968 set_representation(representation); |
| 5896 } else if (FLAG_track_heap_object_fields && | 5969 } else if (FLAG_track_heap_object_fields && |
| 5897 representation.IsHeapObject()) { | 5970 representation.IsHeapObject()) { |
| 5898 set_type(HType::NonPrimitive()); | 5971 set_type(HType::NonPrimitive()); |
| 5899 set_representation(Representation::Tagged()); | 5972 set_representation(Representation::Tagged()); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6177 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { | 6250 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { |
| 6178 return index == 1; | 6251 return index == 1; |
| 6179 } | 6252 } |
| 6180 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { | 6253 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { |
| 6181 return !access().IsInobject() || access().offset() >= size; | 6254 return !access().IsInobject() || access().offset() >= size; |
| 6182 } | 6255 } |
| 6183 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 6256 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 6184 if (index == 0 && access().IsExternalMemory()) { | 6257 if (index == 0 && access().IsExternalMemory()) { |
| 6185 // object must be external in case of external memory access | 6258 // object must be external in case of external memory access |
| 6186 return Representation::External(); | 6259 return Representation::External(); |
| 6187 } else if (index == 1 && | 6260 } else if (index == 1) { |
| 6188 (field_representation().IsDouble() || | 6261 if (field_representation().IsByte() || |
| 6189 field_representation().IsSmi() || | 6262 field_representation().IsInteger32()) { |
| 6190 field_representation().IsInteger32())) { | 6263 return Representation::Integer32(); |
| 6191 return field_representation(); | 6264 } else if (field_representation().IsDouble() || |
| 6265 field_representation().IsSmi()) { |
| 6266 return field_representation(); |
| 6267 } |
| 6192 } | 6268 } |
| 6193 return Representation::Tagged(); | 6269 return Representation::Tagged(); |
| 6194 } | 6270 } |
| 6195 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 6271 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
| 6196 HValue* dominator) V8_OVERRIDE { | 6272 HValue* dominator) V8_OVERRIDE { |
| 6197 ASSERT(side_effect == kChangesNewSpacePromotion); | 6273 ASSERT(side_effect == kChangesNewSpacePromotion); |
| 6198 new_space_dominator_ = dominator; | 6274 new_space_dominator_ = dominator; |
| 6199 } | 6275 } |
| 6200 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6276 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 6201 | 6277 |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7058 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7134 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7059 }; | 7135 }; |
| 7060 | 7136 |
| 7061 | 7137 |
| 7062 #undef DECLARE_INSTRUCTION | 7138 #undef DECLARE_INSTRUCTION |
| 7063 #undef DECLARE_CONCRETE_INSTRUCTION | 7139 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7064 | 7140 |
| 7065 } } // namespace v8::internal | 7141 } } // namespace v8::internal |
| 7066 | 7142 |
| 7067 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7143 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |