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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 switch (opcode()) { | 502 switch (opcode()) { |
503 #define MAKE_CASE(type) case k##type: return #type; | 503 #define MAKE_CASE(type) case k##type: return #type; |
504 HYDROGEN_CONCRETE_INSTRUCTION_LIST(MAKE_CASE) | 504 HYDROGEN_CONCRETE_INSTRUCTION_LIST(MAKE_CASE) |
505 #undef MAKE_CASE | 505 #undef MAKE_CASE |
506 case kPhi: return "Phi"; | 506 case kPhi: return "Phi"; |
507 default: return ""; | 507 default: return ""; |
508 } | 508 } |
509 } | 509 } |
510 | 510 |
511 | 511 |
| 512 bool HValue::CanReplaceWithDummyUses() { |
| 513 return FLAG_unreachable_code_elimination && |
| 514 !(block()->IsReachable() || |
| 515 IsBlockEntry() || |
| 516 IsControlInstruction() || |
| 517 IsSimulate() || |
| 518 IsEnterInlined() || |
| 519 IsLeaveInlined()); |
| 520 } |
| 521 |
| 522 |
512 bool HValue::IsInteger32Constant() { | 523 bool HValue::IsInteger32Constant() { |
513 return IsConstant() && HConstant::cast(this)->HasInteger32Value(); | 524 return IsConstant() && HConstant::cast(this)->HasInteger32Value(); |
514 } | 525 } |
515 | 526 |
516 | 527 |
517 int32_t HValue::GetInteger32Constant() { | 528 int32_t HValue::GetInteger32Constant() { |
518 return HConstant::cast(this)->Integer32Value(); | 529 return HConstant::cast(this)->Integer32Value(); |
519 } | 530 } |
520 | 531 |
521 | 532 |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 if (expected_input_types_.Contains(ToBooleanStub::HEAP_NUMBER)) { | 1057 if (expected_input_types_.Contains(ToBooleanStub::HEAP_NUMBER)) { |
1047 return Representation::Double(); | 1058 return Representation::Double(); |
1048 } | 1059 } |
1049 if (expected_input_types_.Contains(ToBooleanStub::SMI)) { | 1060 if (expected_input_types_.Contains(ToBooleanStub::SMI)) { |
1050 return Representation::Smi(); | 1061 return Representation::Smi(); |
1051 } | 1062 } |
1052 return Representation::None(); | 1063 return Representation::None(); |
1053 } | 1064 } |
1054 | 1065 |
1055 | 1066 |
| 1067 bool HBranch::KnownSuccessorBlock(HBasicBlock** block) { |
| 1068 HValue* value = this->value(); |
| 1069 if (value->EmitAtUses()) { |
| 1070 ASSERT(value->IsConstant()); |
| 1071 ASSERT(!value->representation().IsDouble()); |
| 1072 *block = HConstant::cast(value)->BooleanValue() |
| 1073 ? FirstSuccessor() |
| 1074 : SecondSuccessor(); |
| 1075 return true; |
| 1076 } |
| 1077 *block = NULL; |
| 1078 return false; |
| 1079 } |
| 1080 |
| 1081 |
1056 void HCompareMap::PrintDataTo(StringStream* stream) { | 1082 void HCompareMap::PrintDataTo(StringStream* stream) { |
1057 value()->PrintNameTo(stream); | 1083 value()->PrintNameTo(stream); |
1058 stream->Add(" (%p)", *map().handle()); | 1084 stream->Add(" (%p)", *map().handle()); |
1059 HControlInstruction::PrintDataTo(stream); | 1085 HControlInstruction::PrintDataTo(stream); |
1060 } | 1086 } |
1061 | 1087 |
1062 | 1088 |
1063 const char* HUnaryMathOperation::OpName() const { | 1089 const char* HUnaryMathOperation::OpName() const { |
1064 switch (op()) { | 1090 switch (op()) { |
1065 case kMathFloor: return "floor"; | 1091 case kMathFloor: return "floor"; |
(...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2853 | 2879 |
2854 | 2880 |
2855 void HCompareObjectEqAndBranch::PrintDataTo(StringStream* stream) { | 2881 void HCompareObjectEqAndBranch::PrintDataTo(StringStream* stream) { |
2856 left()->PrintNameTo(stream); | 2882 left()->PrintNameTo(stream); |
2857 stream->Add(" "); | 2883 stream->Add(" "); |
2858 right()->PrintNameTo(stream); | 2884 right()->PrintNameTo(stream); |
2859 HControlInstruction::PrintDataTo(stream); | 2885 HControlInstruction::PrintDataTo(stream); |
2860 } | 2886 } |
2861 | 2887 |
2862 | 2888 |
| 2889 bool HCompareObjectEqAndBranch::KnownSuccessorBlock(HBasicBlock** block) { |
| 2890 if (left()->IsConstant() && right()->IsConstant()) { |
| 2891 bool comparison_result = |
| 2892 HConstant::cast(left())->Equals(HConstant::cast(right())); |
| 2893 *block = comparison_result |
| 2894 ? FirstSuccessor() |
| 2895 : SecondSuccessor(); |
| 2896 return true; |
| 2897 } |
| 2898 *block = NULL; |
| 2899 return false; |
| 2900 } |
| 2901 |
| 2902 |
2863 void HCompareHoleAndBranch::InferRepresentation( | 2903 void HCompareHoleAndBranch::InferRepresentation( |
2864 HInferRepresentationPhase* h_infer) { | 2904 HInferRepresentationPhase* h_infer) { |
2865 ChangeRepresentation(value()->representation()); | 2905 ChangeRepresentation(value()->representation()); |
2866 } | 2906 } |
2867 | 2907 |
2868 | 2908 |
2869 void HGoto::PrintDataTo(StringStream* stream) { | 2909 void HGoto::PrintDataTo(StringStream* stream) { |
2870 stream->Add("B%d", SuccessorAt(0)->block_id()); | 2910 stream->Add("B%d", SuccessorAt(0)->block_id()); |
2871 } | 2911 } |
2872 | 2912 |
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4228 break; | 4268 break; |
4229 case kExternalMemory: | 4269 case kExternalMemory: |
4230 stream->Add("[external-memory]"); | 4270 stream->Add("[external-memory]"); |
4231 break; | 4271 break; |
4232 } | 4272 } |
4233 | 4273 |
4234 stream->Add("@%d", offset()); | 4274 stream->Add("@%d", offset()); |
4235 } | 4275 } |
4236 | 4276 |
4237 } } // namespace v8::internal | 4277 } } // namespace v8::internal |
OLD | NEW |