| 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 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2157 return cond; | 2157 return cond; |
| 2158 } | 2158 } |
| 2159 | 2159 |
| 2160 | 2160 |
| 2161 void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) { | 2161 void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) { |
| 2162 LOperand* left = instr->left(); | 2162 LOperand* left = instr->left(); |
| 2163 LOperand* right = instr->right(); | 2163 LOperand* right = instr->right(); |
| 2164 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 2164 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 2165 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 2165 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 2166 Condition cc = TokenToCondition(instr->op(), instr->is_double()); | 2166 Condition cc = TokenToCondition(instr->op(), instr->is_double()); |
| 2167 CpuFeatures::Scope scope(SSE2); | |
| 2168 | 2167 |
| 2169 if (left->IsConstantOperand() && right->IsConstantOperand()) { | 2168 if (left->IsConstantOperand() && right->IsConstantOperand()) { |
| 2170 // We can statically evaluate the comparison. | 2169 // We can statically evaluate the comparison. |
| 2171 double left_val = ToDouble(LConstantOperand::cast(left)); | 2170 double left_val = ToDouble(LConstantOperand::cast(left)); |
| 2172 double right_val = ToDouble(LConstantOperand::cast(right)); | 2171 double right_val = ToDouble(LConstantOperand::cast(right)); |
| 2173 int next_block = | 2172 int next_block = |
| 2174 EvalComparison(instr->op(), left_val, right_val) ? true_block | 2173 EvalComparison(instr->op(), left_val, right_val) ? true_block |
| 2175 : false_block; | 2174 : false_block; |
| 2176 EmitGoto(next_block); | 2175 EmitGoto(next_block); |
| 2177 } else { | 2176 } else { |
| 2178 if (instr->is_double()) { | 2177 if (instr->is_double()) { |
| 2178 CpuFeatures::Scope scope(SSE2); |
| 2179 // Don't base result on EFLAGS when a NaN is involved. Instead | 2179 // Don't base result on EFLAGS when a NaN is involved. Instead |
| 2180 // jump to the false block. | 2180 // jump to the false block. |
| 2181 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right)); | 2181 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right)); |
| 2182 __ j(parity_even, chunk_->GetAssemblyLabel(false_block)); | 2182 __ j(parity_even, chunk_->GetAssemblyLabel(false_block)); |
| 2183 } else { | 2183 } else { |
| 2184 if (right->IsConstantOperand()) { | 2184 if (right->IsConstantOperand()) { |
| 2185 __ cmp(ToRegister(left), ToInteger32Immediate(right)); | 2185 __ cmp(ToRegister(left), ToInteger32Immediate(right)); |
| 2186 } else if (left->IsConstantOperand()) { | 2186 } else if (left->IsConstantOperand()) { |
| 2187 __ cmp(ToOperand(right), ToInteger32Immediate(left)); | 2187 __ cmp(ToOperand(right), ToInteger32Immediate(left)); |
| 2188 // We transposed the operands. Reverse the condition. | 2188 // We transposed the operands. Reverse the condition. |
| (...skipping 4013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6202 FixedArray::kHeaderSize - kPointerSize)); | 6202 FixedArray::kHeaderSize - kPointerSize)); |
| 6203 __ bind(&done); | 6203 __ bind(&done); |
| 6204 } | 6204 } |
| 6205 | 6205 |
| 6206 | 6206 |
| 6207 #undef __ | 6207 #undef __ |
| 6208 | 6208 |
| 6209 } } // namespace v8::internal | 6209 } } // namespace v8::internal |
| 6210 | 6210 |
| 6211 #endif // V8_TARGET_ARCH_IA32 | 6211 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |