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 361 matching lines...) Loading... | |
372 bool result = DataEquals(other); | 372 bool result = DataEquals(other); |
373 ASSERT(!result || Hashcode() == other->Hashcode()); | 373 ASSERT(!result || Hashcode() == other->Hashcode()); |
374 return result; | 374 return result; |
375 } | 375 } |
376 | 376 |
377 | 377 |
378 intptr_t HValue::Hashcode() { | 378 intptr_t HValue::Hashcode() { |
379 intptr_t result = opcode(); | 379 intptr_t result = opcode(); |
380 int count = OperandCount(); | 380 int count = OperandCount(); |
381 for (int i = 0; i < count; ++i) { | 381 for (int i = 0; i < count; ++i) { |
382 result = result * 19 + OperandAt(i)->id() + (result >> 7); | 382 HValue* operand = OperandAt(i); |
Jakob Kummerow
2012/11/19 12:36:00
as discussed, just pass in any existing HValue as
danno
2012/11/26 17:16:18
Done.
| |
383 if (operand != NULL) { | |
384 result = result * 19 + OperandAt(i)->id() + (result >> 7); | |
385 } else { | |
386 result = result * 19 + (result >> 7); | |
387 } | |
383 } | 388 } |
384 return result; | 389 return result; |
385 } | 390 } |
386 | 391 |
387 | 392 |
388 const char* HValue::Mnemonic() const { | 393 const char* HValue::Mnemonic() const { |
389 switch (opcode()) { | 394 switch (opcode()) { |
390 #define MAKE_CASE(type) case k##type: return #type; | 395 #define MAKE_CASE(type) case k##type: return #type; |
391 HYDROGEN_CONCRETE_INSTRUCTION_LIST(MAKE_CASE) | 396 HYDROGEN_CONCRETE_INSTRUCTION_LIST(MAKE_CASE) |
392 #undef MAKE_CASE | 397 #undef MAKE_CASE |
(...skipping 537 matching lines...) Loading... | |
930 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic()); | 935 stream->Add(" %s to %s", from().Mnemonic(), to().Mnemonic()); |
931 | 936 |
932 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); | 937 if (CanTruncateToInt32()) stream->Add(" truncating-int32"); |
933 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); | 938 if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?"); |
934 if (CheckFlag(kDeoptimizeOnUndefined)) stream->Add(" deopt-on-undefined"); | 939 if (CheckFlag(kDeoptimizeOnUndefined)) stream->Add(" deopt-on-undefined"); |
935 } | 940 } |
936 | 941 |
937 | 942 |
938 void HJSArrayLength::PrintDataTo(StringStream* stream) { | 943 void HJSArrayLength::PrintDataTo(StringStream* stream) { |
939 value()->PrintNameTo(stream); | 944 value()->PrintNameTo(stream); |
940 stream->Add(" "); | 945 if (typecheck() != NULL) { |
941 typecheck()->PrintNameTo(stream); | 946 stream->Add(" "); |
947 typecheck()->PrintNameTo(stream); | |
948 } | |
942 } | 949 } |
943 | 950 |
944 | 951 |
945 HValue* HUnaryMathOperation::Canonicalize() { | 952 HValue* HUnaryMathOperation::Canonicalize() { |
946 if (op() == kMathFloor) { | 953 if (op() == kMathFloor) { |
947 // If the input is integer32 then we replace the floor instruction | 954 // If the input is integer32 then we replace the floor instruction |
948 // with its input. This happens before the representation changes are | 955 // with its input. This happens before the representation changes are |
949 // introduced. | 956 // introduced. |
950 if (value()->representation().IsInteger32()) return value(); | 957 if (value()->representation().IsInteger32()) return value(); |
951 | 958 |
(...skipping 92 matching lines...) Loading... | |
1044 return; | 1051 return; |
1045 default: | 1052 default: |
1046 UNREACHABLE(); | 1053 UNREACHABLE(); |
1047 } | 1054 } |
1048 } | 1055 } |
1049 | 1056 |
1050 | 1057 |
1051 void HLoadElements::PrintDataTo(StringStream* stream) { | 1058 void HLoadElements::PrintDataTo(StringStream* stream) { |
1052 value()->PrintNameTo(stream); | 1059 value()->PrintNameTo(stream); |
1053 stream->Add(" "); | 1060 stream->Add(" "); |
1054 typecheck()->PrintNameTo(stream); | 1061 if (typecheck() != NULL) { |
1062 typecheck()->PrintNameTo(stream); | |
1063 } | |
1055 } | 1064 } |
1056 | 1065 |
1057 | 1066 |
1058 void HCheckMaps::PrintDataTo(StringStream* stream) { | 1067 void HCheckMaps::PrintDataTo(StringStream* stream) { |
1059 value()->PrintNameTo(stream); | 1068 value()->PrintNameTo(stream); |
1060 stream->Add(" [%p", *map_set()->first()); | 1069 stream->Add(" [%p", *map_set()->first()); |
1061 for (int i = 1; i < map_set()->length(); ++i) { | 1070 for (int i = 1; i < map_set()->length(); ++i) { |
1062 stream->Add(",%p", *map_set()->at(i)); | 1071 stream->Add(",%p", *map_set()->at(i)); |
1063 } | 1072 } |
1064 stream->Add("]"); | 1073 stream->Add("]"); |
(...skipping 781 matching lines...) Loading... | |
1846 ASSERT(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && | 1855 ASSERT(elements_kind() >= FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && |
1847 elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND); | 1856 elements_kind() <= LAST_EXTERNAL_ARRAY_ELEMENTS_KIND); |
1848 elements()->PrintNameTo(stream); | 1857 elements()->PrintNameTo(stream); |
1849 stream->Add("."); | 1858 stream->Add("."); |
1850 stream->Add(ElementsKindToString(elements_kind())); | 1859 stream->Add(ElementsKindToString(elements_kind())); |
1851 } | 1860 } |
1852 | 1861 |
1853 stream->Add("["); | 1862 stream->Add("["); |
1854 key()->PrintNameTo(stream); | 1863 key()->PrintNameTo(stream); |
1855 stream->Add("] "); | 1864 stream->Add("] "); |
1856 dependency()->PrintNameTo(stream); | 1865 if (dependency() != NULL) { |
1866 dependency()->PrintNameTo(stream); | |
1867 } | |
1857 if (RequiresHoleCheck()) { | 1868 if (RequiresHoleCheck()) { |
1858 stream->Add(" check_hole"); | 1869 stream->Add(" check_hole"); |
1859 } | 1870 } |
1860 } | 1871 } |
1861 | 1872 |
1862 | 1873 |
1863 bool HLoadKeyed::RequiresHoleCheck() const { | 1874 bool HLoadKeyed::RequiresHoleCheck() const { |
1864 if (IsFastPackedElementsKind(elements_kind())) { | 1875 if (IsFastPackedElementsKind(elements_kind())) { |
1865 return false; | 1876 return false; |
1866 } | 1877 } |
(...skipping 658 matching lines...) Loading... | |
2525 | 2536 |
2526 | 2537 |
2527 void HCheckFunction::Verify() { | 2538 void HCheckFunction::Verify() { |
2528 HInstruction::Verify(); | 2539 HInstruction::Verify(); |
2529 ASSERT(HasNoUses()); | 2540 ASSERT(HasNoUses()); |
2530 } | 2541 } |
2531 | 2542 |
2532 #endif | 2543 #endif |
2533 | 2544 |
2534 } } // namespace v8::internal | 2545 } } // namespace v8::internal |
OLD | NEW |