| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 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 5020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5031 DCHECK(result->IsRegister()); | 5031 DCHECK(result->IsRegister()); |
| 5032 | 5032 |
| 5033 XMMRegister input_reg = ToDoubleRegister(input); | 5033 XMMRegister input_reg = ToDoubleRegister(input); |
| 5034 Register result_reg = ToRegister(result); | 5034 Register result_reg = ToRegister(result); |
| 5035 | 5035 |
| 5036 if (instr->truncating()) { | 5036 if (instr->truncating()) { |
| 5037 __ TruncateDoubleToI(result_reg, input_reg); | 5037 __ TruncateDoubleToI(result_reg, input_reg); |
| 5038 } else { | 5038 } else { |
| 5039 Label lost_precision, is_nan, minus_zero, done; | 5039 Label lost_precision, is_nan, minus_zero, done; |
| 5040 XMMRegister xmm_scratch = double_scratch0(); | 5040 XMMRegister xmm_scratch = double_scratch0(); |
| 5041 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; |
| 5041 __ DoubleToI(result_reg, input_reg, xmm_scratch, | 5042 __ DoubleToI(result_reg, input_reg, xmm_scratch, |
| 5042 instr->hydrogen()->GetMinusZeroMode(), &lost_precision, | 5043 instr->hydrogen()->GetMinusZeroMode(), &lost_precision, |
| 5043 &is_nan, &minus_zero, | 5044 &is_nan, &minus_zero, dist); |
| 5044 DeoptEveryNTimes() ? Label::kFar : Label::kNear); | 5045 __ jmp(&done, dist); |
| 5045 __ jmp(&done, Label::kNear); | |
| 5046 __ bind(&lost_precision); | 5046 __ bind(&lost_precision); |
| 5047 DeoptimizeIf(no_condition, instr, "lost precision"); | 5047 DeoptimizeIf(no_condition, instr, "lost precision"); |
| 5048 __ bind(&is_nan); | 5048 __ bind(&is_nan); |
| 5049 DeoptimizeIf(no_condition, instr, "NaN"); | 5049 DeoptimizeIf(no_condition, instr, "NaN"); |
| 5050 __ bind(&minus_zero); | 5050 __ bind(&minus_zero); |
| 5051 DeoptimizeIf(no_condition, instr, "minus zero"); | 5051 DeoptimizeIf(no_condition, instr, "minus zero"); |
| 5052 __ bind(&done); | 5052 __ bind(&done); |
| 5053 } | 5053 } |
| 5054 } | 5054 } |
| 5055 | 5055 |
| 5056 | 5056 |
| 5057 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { | 5057 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { |
| 5058 LOperand* input = instr->value(); | 5058 LOperand* input = instr->value(); |
| 5059 DCHECK(input->IsDoubleRegister()); | 5059 DCHECK(input->IsDoubleRegister()); |
| 5060 LOperand* result = instr->result(); | 5060 LOperand* result = instr->result(); |
| 5061 DCHECK(result->IsRegister()); | 5061 DCHECK(result->IsRegister()); |
| 5062 | 5062 |
| 5063 XMMRegister input_reg = ToDoubleRegister(input); | 5063 XMMRegister input_reg = ToDoubleRegister(input); |
| 5064 Register result_reg = ToRegister(result); | 5064 Register result_reg = ToRegister(result); |
| 5065 | 5065 |
| 5066 Label lost_precision, is_nan, minus_zero, done; | 5066 Label lost_precision, is_nan, minus_zero, done; |
| 5067 XMMRegister xmm_scratch = double_scratch0(); | 5067 XMMRegister xmm_scratch = double_scratch0(); |
| 5068 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear; |
| 5068 __ DoubleToI(result_reg, input_reg, xmm_scratch, | 5069 __ DoubleToI(result_reg, input_reg, xmm_scratch, |
| 5069 instr->hydrogen()->GetMinusZeroMode(), &lost_precision, &is_nan, | 5070 instr->hydrogen()->GetMinusZeroMode(), &lost_precision, &is_nan, |
| 5070 &minus_zero, DeoptEveryNTimes() ? Label::kFar : Label::kNear); | 5071 &minus_zero, dist); |
| 5071 __ jmp(&done, Label::kNear); | 5072 __ jmp(&done, dist); |
| 5072 __ bind(&lost_precision); | 5073 __ bind(&lost_precision); |
| 5073 DeoptimizeIf(no_condition, instr, "lost precision"); | 5074 DeoptimizeIf(no_condition, instr, "lost precision"); |
| 5074 __ bind(&is_nan); | 5075 __ bind(&is_nan); |
| 5075 DeoptimizeIf(no_condition, instr, "NaN"); | 5076 DeoptimizeIf(no_condition, instr, "NaN"); |
| 5076 __ bind(&minus_zero); | 5077 __ bind(&minus_zero); |
| 5077 DeoptimizeIf(no_condition, instr, "minus zero"); | 5078 DeoptimizeIf(no_condition, instr, "minus zero"); |
| 5078 __ bind(&done); | 5079 __ bind(&done); |
| 5079 __ Integer32ToSmi(result_reg, result_reg); | 5080 __ Integer32ToSmi(result_reg, result_reg); |
| 5080 DeoptimizeIf(overflow, instr, "overflow"); | 5081 DeoptimizeIf(overflow, instr, "overflow"); |
| 5081 } | 5082 } |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5879 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5880 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5880 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5881 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5881 } | 5882 } |
| 5882 | 5883 |
| 5883 | 5884 |
| 5884 #undef __ | 5885 #undef __ |
| 5885 | 5886 |
| 5886 } } // namespace v8::internal | 5887 } } // namespace v8::internal |
| 5887 | 5888 |
| 5888 #endif // V8_TARGET_ARCH_X64 | 5889 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |