Chromium Code Reviews| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1043 if (expected_input_types_.Contains(ToBooleanStub::HEAP_NUMBER)) { | 1054 if (expected_input_types_.Contains(ToBooleanStub::HEAP_NUMBER)) { |
| 1044 return Representation::Double(); | 1055 return Representation::Double(); |
| 1045 } | 1056 } |
| 1046 if (expected_input_types_.Contains(ToBooleanStub::SMI)) { | 1057 if (expected_input_types_.Contains(ToBooleanStub::SMI)) { |
| 1047 return Representation::Smi(); | 1058 return Representation::Smi(); |
| 1048 } | 1059 } |
| 1049 return Representation::None(); | 1060 return Representation::None(); |
| 1050 } | 1061 } |
| 1051 | 1062 |
| 1052 | 1063 |
| 1064 bool HBranch::KnownSuccessorBlock(HBasicBlock** block) { | |
| 1065 HValue* value = this->value(); | |
| 1066 if (value->EmitAtUses()) { | |
| 1067 ASSERT(value->IsConstant()); | |
| 1068 ASSERT(!value->representation().IsDouble()); | |
| 1069 *block = HConstant::cast(value)->BooleanValue() | |
| 1070 ? FirstSuccessor() | |
| 1071 : SecondSuccessor(); | |
| 1072 return true; | |
| 1073 } | |
| 1074 *block = NULL; | |
| 1075 return false; | |
| 1076 } | |
| 1077 | |
| 1078 | |
| 1053 void HCompareMap::PrintDataTo(StringStream* stream) { | 1079 void HCompareMap::PrintDataTo(StringStream* stream) { |
| 1054 value()->PrintNameTo(stream); | 1080 value()->PrintNameTo(stream); |
| 1055 stream->Add(" (%p)", *map().handle()); | 1081 stream->Add(" (%p)", *map().handle()); |
| 1056 HControlInstruction::PrintDataTo(stream); | 1082 HControlInstruction::PrintDataTo(stream); |
| 1057 } | 1083 } |
| 1058 | 1084 |
| 1059 | 1085 |
| 1060 const char* HUnaryMathOperation::OpName() const { | 1086 const char* HUnaryMathOperation::OpName() const { |
| 1061 switch (op()) { | 1087 switch (op()) { |
| 1062 case kMathFloor: return "floor"; | 1088 case kMathFloor: return "floor"; |
| (...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2850 | 2876 |
| 2851 | 2877 |
| 2852 void HCompareObjectEqAndBranch::PrintDataTo(StringStream* stream) { | 2878 void HCompareObjectEqAndBranch::PrintDataTo(StringStream* stream) { |
| 2853 left()->PrintNameTo(stream); | 2879 left()->PrintNameTo(stream); |
| 2854 stream->Add(" "); | 2880 stream->Add(" "); |
| 2855 right()->PrintNameTo(stream); | 2881 right()->PrintNameTo(stream); |
| 2856 HControlInstruction::PrintDataTo(stream); | 2882 HControlInstruction::PrintDataTo(stream); |
| 2857 } | 2883 } |
| 2858 | 2884 |
| 2859 | 2885 |
| 2886 bool HCompareObjectEqAndBranch::KnownSuccessorBlock(HBasicBlock** block) { | |
| 2887 if (left()->IsConstant() && right()->IsConstant()) { | |
| 2888 bool comparison_result = | |
| 2889 HConstant::cast(left())->DataEquals(HConstant::cast(right())); | |
|
Michael Starzinger
2013/10/01 11:17:47
suggestion: We could use Equals() instead of DataE
danno
2013/10/23 11:46:51
Done.
| |
| 2890 *block = comparison_result | |
| 2891 ? FirstSuccessor() | |
| 2892 : SecondSuccessor(); | |
| 2893 return true; | |
| 2894 } | |
| 2895 *block = NULL; | |
| 2896 return false; | |
| 2897 } | |
| 2898 | |
| 2899 | |
| 2860 void HCompareHoleAndBranch::InferRepresentation( | 2900 void HCompareHoleAndBranch::InferRepresentation( |
| 2861 HInferRepresentationPhase* h_infer) { | 2901 HInferRepresentationPhase* h_infer) { |
| 2862 ChangeRepresentation(value()->representation()); | 2902 ChangeRepresentation(value()->representation()); |
| 2863 } | 2903 } |
| 2864 | 2904 |
| 2865 | 2905 |
| 2866 void HGoto::PrintDataTo(StringStream* stream) { | 2906 void HGoto::PrintDataTo(StringStream* stream) { |
| 2867 stream->Add("B%d", SuccessorAt(0)->block_id()); | 2907 stream->Add("B%d", SuccessorAt(0)->block_id()); |
| 2868 } | 2908 } |
| 2869 | 2909 |
| (...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4225 break; | 4265 break; |
| 4226 case kExternalMemory: | 4266 case kExternalMemory: |
| 4227 stream->Add("[external-memory]"); | 4267 stream->Add("[external-memory]"); |
| 4228 break; | 4268 break; |
| 4229 } | 4269 } |
| 4230 | 4270 |
| 4231 stream->Add("@%d", offset()); | 4271 stream->Add("@%d", offset()); |
| 4232 } | 4272 } |
| 4233 | 4273 |
| 4234 } } // namespace v8::internal | 4274 } } // namespace v8::internal |
| OLD | NEW |