Chromium Code Reviews| Index: src/hydrogen-instructions.cc |
| =================================================================== |
| --- src/hydrogen-instructions.cc (revision 7842) |
| +++ src/hydrogen-instructions.cc (working copy) |
| @@ -60,12 +60,10 @@ |
| case kDouble: return "d"; |
| case kInteger32: return "i"; |
| case kExternal: return "x"; |
| - case kNumRepresentations: |
| + default: |
|
danno
2011/05/11 09:10:13
I think the idea here is to have the compiler comp
|
| UNREACHABLE(); |
| return NULL; |
| } |
| - UNREACHABLE(); |
| - return NULL; |
| } |
| @@ -402,11 +400,42 @@ |
| } |
| -void HValue::PrintTypeTo(HType type, StringStream* stream) { |
| - stream->Add(type.ToShortString()); |
| +void HValue::PrintTypeTo(StringStream* stream) { |
| + if (!representation().IsTagged() || type().Equals(HType::Tagged())) return; |
| + stream->Add(" type[%s]", type().ToString()); |
| } |
| +void HValue::PrintRangeTo(StringStream* stream) { |
| + if (range() == NULL || range()->IsMostGeneric()) return; |
| + stream->Add(" range[%d,%d,m0=%d]", |
| + range()->lower(), |
| + range()->upper(), |
| + static_cast<int>(range()->CanBeMinusZero())); |
| +} |
| + |
| + |
| +void HValue::PrintChangesTo(StringStream* stream) { |
| + int changes_flags = (flags() & HValue::ChangesFlagsMask()); |
| + if (changes_flags == 0) return; |
| + stream->Add(" changes["); |
| + if (changes_flags == AllSideEffects()) { |
| + stream->Add("EVERYTHING"); |
|
fschneider
2011/05/11 08:42:07
"*" would be less verbose.
Sven Panne
2011/05/11 09:08:25
Done.
|
| + } else { |
| + bool add_comma = false; |
| +#define DECLARE_DO(type) \ |
|
fschneider
2011/05/11 08:42:07
since it's not a declaration maybe PRINT_DO?
Sven Panne
2011/05/11 09:08:25
Done.
|
| + if (changes_flags & (1 << kChanges##type)) { \ |
| + if (add_comma) stream->Add(","); \ |
| + add_comma = true; \ |
| + stream->Add(#type); \ |
| + } |
| + GVN_FLAG_LIST(DECLARE_DO); |
| +#undef DECLARE_DO |
| + } |
| + stream->Add("]"); |
| +} |
| + |
| + |
| void HValue::PrintNameTo(StringStream* stream) { |
| stream->Add("%s%d", representation_.Mnemonic(), id()); |
| } |
| @@ -465,28 +494,18 @@ |
| void HInstruction::PrintTo(StringStream* stream) { |
| + PrintMnemonicTo(stream); |
| + PrintDataTo(stream); |
| + PrintRangeTo(stream); |
| + PrintChangesTo(stream); |
| + PrintTypeTo(stream); |
| +} |
| + |
| + |
| +void HInstruction::PrintMnemonicTo(StringStream* stream) { |
| stream->Add("%s", Mnemonic()); |
| if (HasSideEffects()) stream->Add("*"); |
| stream->Add(" "); |
| - PrintDataTo(stream); |
| - |
| - if (range() != NULL && |
| - !range()->IsMostGeneric() && |
| - !range()->CanBeMinusZero()) { |
| - stream->Add(" range[%d,%d,m0=%d]", |
| - range()->lower(), |
| - range()->upper(), |
| - static_cast<int>(range()->CanBeMinusZero())); |
| - } |
| - |
| - int changes_flags = (flags() & HValue::ChangesFlagsMask()); |
| - if (changes_flags != 0) { |
| - stream->Add(" changes[0x%x]", changes_flags); |
| - } |
| - |
| - if (representation().IsTagged() && !type().Equals(HType::Tagged())) { |
| - stream->Add(" type[%s]", type().ToString()); |
| - } |
| } |