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 ToBooleanStub::Types expected = instr->expected_input_types(); |
| 1064 |
1063 // Untagged integers or doubles, smis and booleans don't require a | 1065 // Untagged integers or doubles, smis and booleans don't require a |
1064 // deoptimization environment nor a temp register. | 1066 // deoptimization environment nor a temp register. |
1065 Representation rep = value->representation(); | 1067 Representation rep = value->representation(); |
1066 HType type = value->type(); | 1068 HType type = value->type(); |
1067 if (!rep.IsTagged() || type.IsSmi() || type.IsBoolean()) { | 1069 if (!rep.IsTagged() || type.IsSmi() || type.IsBoolean() || |
| 1070 expected == ToBooleanStub::all_types()) { |
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(); | |
1072 // We need a temporary register when we have to access the map *or* we have | 1074 // 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 | 1075 // no type info yet, in which case we handle all cases (including the ones |
1074 // involving maps). | 1076 // involving maps). |
1075 bool needs_temp = expected.NeedsMap() || expected.IsEmpty(); | 1077 bool needs_temp = expected.NeedsMap() || expected.IsEmpty(); |
1076 LOperand* temp = needs_temp ? TempRegister() : NULL; | 1078 LOperand* temp = needs_temp ? TempRegister() : NULL; |
1077 return AssignEnvironment(new(zone()) LBranch(UseRegister(value), temp)); | 1079 return AssignEnvironment(new(zone()) LBranch(UseRegister(value), temp)); |
1078 } | 1080 } |
1079 | 1081 |
1080 | 1082 |
1081 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { | 1083 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { |
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2796 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2798 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2797 LOperand* object = UseRegister(instr->object()); | 2799 LOperand* object = UseRegister(instr->object()); |
2798 LOperand* index = UseTempRegister(instr->index()); | 2800 LOperand* index = UseTempRegister(instr->index()); |
2799 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2801 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2800 } | 2802 } |
2801 | 2803 |
2802 | 2804 |
2803 } } // namespace v8::internal | 2805 } } // namespace v8::internal |
2804 | 2806 |
2805 #endif // V8_TARGET_ARCH_IA32 | 2807 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |