| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 4825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4836 DCHECK(result->IsRegister()); | 4836 DCHECK(result->IsRegister()); |
| 4837 Register result_reg = ToRegister(result); | 4837 Register result_reg = ToRegister(result); |
| 4838 | 4838 |
| 4839 if (instr->truncating()) { | 4839 if (instr->truncating()) { |
| 4840 XMMRegister input_reg = ToDoubleRegister(input); | 4840 XMMRegister input_reg = ToDoubleRegister(input); |
| 4841 __ TruncateDoubleToI(result_reg, input_reg); | 4841 __ TruncateDoubleToI(result_reg, input_reg); |
| 4842 } else { | 4842 } else { |
| 4843 Label lost_precision, is_nan, minus_zero, done; | 4843 Label lost_precision, is_nan, minus_zero, done; |
| 4844 XMMRegister input_reg = ToDoubleRegister(input); | 4844 XMMRegister input_reg = ToDoubleRegister(input); |
| 4845 XMMRegister xmm_scratch = double_scratch0(); | 4845 XMMRegister xmm_scratch = double_scratch0(); |
| 4846 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; |
| 4846 __ DoubleToI(result_reg, input_reg, xmm_scratch, | 4847 __ DoubleToI(result_reg, input_reg, xmm_scratch, |
| 4847 instr->hydrogen()->GetMinusZeroMode(), &lost_precision, | 4848 instr->hydrogen()->GetMinusZeroMode(), &lost_precision, |
| 4848 &is_nan, &minus_zero, | 4849 &is_nan, &minus_zero, dist); |
| 4849 DeoptEveryNTimes() ? Label::kFar : Label::kNear); | 4850 __ jmp(&done, dist); |
| 4850 __ jmp(&done, Label::kNear); | |
| 4851 __ bind(&lost_precision); | 4851 __ bind(&lost_precision); |
| 4852 DeoptimizeIf(no_condition, instr, "lost precision"); | 4852 DeoptimizeIf(no_condition, instr, "lost precision"); |
| 4853 __ bind(&is_nan); | 4853 __ bind(&is_nan); |
| 4854 DeoptimizeIf(no_condition, instr, "NaN"); | 4854 DeoptimizeIf(no_condition, instr, "NaN"); |
| 4855 __ bind(&minus_zero); | 4855 __ bind(&minus_zero); |
| 4856 DeoptimizeIf(no_condition, instr, "minus zero"); | 4856 DeoptimizeIf(no_condition, instr, "minus zero"); |
| 4857 __ bind(&done); | 4857 __ bind(&done); |
| 4858 } | 4858 } |
| 4859 } | 4859 } |
| 4860 | 4860 |
| 4861 | 4861 |
| 4862 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { | 4862 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { |
| 4863 LOperand* input = instr->value(); | 4863 LOperand* input = instr->value(); |
| 4864 DCHECK(input->IsDoubleRegister()); | 4864 DCHECK(input->IsDoubleRegister()); |
| 4865 LOperand* result = instr->result(); | 4865 LOperand* result = instr->result(); |
| 4866 DCHECK(result->IsRegister()); | 4866 DCHECK(result->IsRegister()); |
| 4867 Register result_reg = ToRegister(result); | 4867 Register result_reg = ToRegister(result); |
| 4868 | 4868 |
| 4869 Label lost_precision, is_nan, minus_zero, done; | 4869 Label lost_precision, is_nan, minus_zero, done; |
| 4870 XMMRegister input_reg = ToDoubleRegister(input); | 4870 XMMRegister input_reg = ToDoubleRegister(input); |
| 4871 XMMRegister xmm_scratch = double_scratch0(); | 4871 XMMRegister xmm_scratch = double_scratch0(); |
| 4872 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; |
| 4872 __ DoubleToI(result_reg, input_reg, xmm_scratch, | 4873 __ DoubleToI(result_reg, input_reg, xmm_scratch, |
| 4873 instr->hydrogen()->GetMinusZeroMode(), &lost_precision, &is_nan, | 4874 instr->hydrogen()->GetMinusZeroMode(), &lost_precision, &is_nan, |
| 4874 &minus_zero, DeoptEveryNTimes() ? Label::kFar : Label::kNear); | 4875 &minus_zero, dist); |
| 4875 __ jmp(&done, Label::kNear); | 4876 __ jmp(&done, dist); |
| 4876 __ bind(&lost_precision); | 4877 __ bind(&lost_precision); |
| 4877 DeoptimizeIf(no_condition, instr, "lost precision"); | 4878 DeoptimizeIf(no_condition, instr, "lost precision"); |
| 4878 __ bind(&is_nan); | 4879 __ bind(&is_nan); |
| 4879 DeoptimizeIf(no_condition, instr, "NaN"); | 4880 DeoptimizeIf(no_condition, instr, "NaN"); |
| 4880 __ bind(&minus_zero); | 4881 __ bind(&minus_zero); |
| 4881 DeoptimizeIf(no_condition, instr, "minus zero"); | 4882 DeoptimizeIf(no_condition, instr, "minus zero"); |
| 4882 __ bind(&done); | 4883 __ bind(&done); |
| 4883 __ SmiTag(result_reg); | 4884 __ SmiTag(result_reg); |
| 4884 DeoptimizeIf(overflow, instr, "overflow"); | 4885 DeoptimizeIf(overflow, instr, "overflow"); |
| 4885 } | 4886 } |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5696 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5697 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5697 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5698 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5698 } | 5699 } |
| 5699 | 5700 |
| 5700 | 5701 |
| 5701 #undef __ | 5702 #undef __ |
| 5702 | 5703 |
| 5703 } } // namespace v8::internal | 5704 } } // namespace v8::internal |
| 5704 | 5705 |
| 5705 #endif // V8_TARGET_ARCH_IA32 | 5706 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |