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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 HValue* value = instr->value(); | 1053 HValue* value = instr->value(); |
1054 if (value->EmitAtUses()) { | 1054 if (value->EmitAtUses()) { |
1055 ASSERT(value->IsConstant()); | 1055 ASSERT(value->IsConstant()); |
1056 ASSERT(!value->representation().IsDouble()); | 1056 ASSERT(!value->representation().IsDouble()); |
1057 HBasicBlock* successor = HConstant::cast(value)->BooleanValue() | 1057 HBasicBlock* successor = HConstant::cast(value)->BooleanValue() |
1058 ? instr->FirstSuccessor() | 1058 ? instr->FirstSuccessor() |
1059 : instr->SecondSuccessor(); | 1059 : instr->SecondSuccessor(); |
1060 return new(zone()) LGoto(successor->block_id()); | 1060 return new(zone()) LGoto(successor->block_id()); |
1061 } | 1061 } |
1062 | 1062 |
1063 // Untagged integers or doubles, smis and booleans don't require a | 1063 ToBooleanStub::Types expected = instr->expected_input_types(); |
1064 // deoptimization environment nor a temp register. | 1064 |
| 1065 // Tagged values that are not known smis or booleans require a |
| 1066 // deoptimization environment. If the instruction is generic no |
| 1067 // environment is needed since all cases are handled. |
1065 Representation rep = value->representation(); | 1068 Representation rep = value->representation(); |
1066 HType type = value->type(); | 1069 HType type = value->type(); |
1067 if (!rep.IsTagged() || type.IsSmi() || type.IsBoolean()) { | 1070 if (!rep.IsTagged() || type.IsSmi() || type.IsBoolean()) { |
1068 return new(zone()) LBranch(UseRegister(value), NULL); | 1071 return new(zone()) LBranch(UseRegister(value), NULL); |
1069 } | 1072 } |
1070 | 1073 |
1071 ToBooleanStub::Types expected = instr->expected_input_types(); | 1074 bool needs_temp = expected.NeedsMap() || expected.IsEmpty(); |
| 1075 LOperand* temp = needs_temp ? TempRegister() : NULL; |
| 1076 |
| 1077 // The Generic stub does not have a deopt, so we need no environment. |
| 1078 if (expected.IsGeneric()) { |
| 1079 return new(zone()) LBranch(UseRegister(value), temp); |
| 1080 } |
| 1081 |
1072 // We need a temporary register when we have to access the map *or* we have | 1082 // We need a temporary register when we have to access the map *or* we have |
1073 // no type info yet, in which case we handle all cases (including the ones | 1083 // no type info yet, in which case we handle all cases (including the ones |
1074 // involving maps). | 1084 // involving maps). |
1075 bool needs_temp = expected.NeedsMap() || expected.IsEmpty(); | |
1076 LOperand* temp = needs_temp ? TempRegister() : NULL; | |
1077 return AssignEnvironment(new(zone()) LBranch(UseRegister(value), temp)); | 1085 return AssignEnvironment(new(zone()) LBranch(UseRegister(value), temp)); |
1078 } | 1086 } |
1079 | 1087 |
1080 | 1088 |
1081 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { | 1089 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { |
1082 return new(zone()) LDebugBreak(); | 1090 return new(zone()) LDebugBreak(); |
1083 } | 1091 } |
1084 | 1092 |
1085 | 1093 |
1086 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 1094 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2806 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2814 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2807 LOperand* object = UseRegister(instr->object()); | 2815 LOperand* object = UseRegister(instr->object()); |
2808 LOperand* index = UseTempRegister(instr->index()); | 2816 LOperand* index = UseTempRegister(instr->index()); |
2809 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2817 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2810 } | 2818 } |
2811 | 2819 |
2812 | 2820 |
2813 } } // namespace v8::internal | 2821 } } // namespace v8::internal |
2814 | 2822 |
2815 #endif // V8_TARGET_ARCH_IA32 | 2823 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |