| 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 4947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4958 __ Set(input_reg, 1); | 4958 __ Set(input_reg, 1); |
| 4959 __ jmp(done); | 4959 __ jmp(done); |
| 4960 | 4960 |
| 4961 __ bind(&check_false); | 4961 __ bind(&check_false); |
| 4962 __ CompareRoot(input_reg, Heap::kFalseValueRootIndex); | 4962 __ CompareRoot(input_reg, Heap::kFalseValueRootIndex); |
| 4963 __ RecordComment("Deferred TaggedToI: cannot truncate"); | 4963 __ RecordComment("Deferred TaggedToI: cannot truncate"); |
| 4964 DeoptimizeIf(not_equal, instr->environment()); | 4964 DeoptimizeIf(not_equal, instr->environment()); |
| 4965 __ Set(input_reg, 0); | 4965 __ Set(input_reg, 0); |
| 4966 __ jmp(done); | 4966 __ jmp(done); |
| 4967 } else { | 4967 } else { |
| 4968 Label bailout; | 4968 XMMRegister scratch = ToDoubleRegister(instr->temp()); |
| 4969 XMMRegister xmm_temp = ToDoubleRegister(instr->temp()); | 4969 DCHECK(!scratch.is(xmm0)); |
| 4970 __ TaggedToI(input_reg, input_reg, xmm_temp, | 4970 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 4971 instr->hydrogen()->GetMinusZeroMode(), &bailout, Label::kNear); | 4971 Heap::kHeapNumberMapRootIndex); |
| 4972 | 4972 __ RecordComment("Deferred TaggedToI: not a heap number"); |
| 4973 DeoptimizeIf(not_equal, instr->environment()); |
| 4974 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
| 4975 __ cvttsd2si(input_reg, xmm0); |
| 4976 __ Cvtlsi2sd(scratch, input_reg); |
| 4977 __ ucomisd(xmm0, scratch); |
| 4978 __ RecordComment("Deferred TaggedToI: lost precision"); |
| 4979 DeoptimizeIf(not_equal, instr->environment()); |
| 4980 __ RecordComment("Deferred TaggedToI: NaN"); |
| 4981 DeoptimizeIf(parity_even, instr->environment()); |
| 4982 if (instr->hydrogen()->GetMinusZeroMode() == FAIL_ON_MINUS_ZERO) { |
| 4983 __ testl(input_reg, input_reg); |
| 4984 __ j(not_zero, done); |
| 4985 __ movmskpd(input_reg, xmm0); |
| 4986 __ andl(input_reg, Immediate(1)); |
| 4987 __ RecordComment("Deferred TaggedToI: minus zero"); |
| 4988 DeoptimizeIf(not_zero, instr->environment()); |
| 4989 } |
| 4973 __ jmp(done); | 4990 __ jmp(done); |
| 4974 __ bind(&bailout); | |
| 4975 DeoptimizeIf(no_condition, instr->environment()); | |
| 4976 } | 4991 } |
| 4977 } | 4992 } |
| 4978 | 4993 |
| 4979 | 4994 |
| 4980 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4995 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
| 4981 class DeferredTaggedToI FINAL : public LDeferredCode { | 4996 class DeferredTaggedToI FINAL : public LDeferredCode { |
| 4982 public: | 4997 public: |
| 4983 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4998 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
| 4984 : LDeferredCode(codegen), instr_(instr) { } | 4999 : LDeferredCode(codegen), instr_(instr) { } |
| 4985 virtual void Generate() OVERRIDE { | 5000 virtual void Generate() OVERRIDE { |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5876 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5891 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5877 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5892 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5878 } | 5893 } |
| 5879 | 5894 |
| 5880 | 5895 |
| 5881 #undef __ | 5896 #undef __ |
| 5882 | 5897 |
| 5883 } } // namespace v8::internal | 5898 } } // namespace v8::internal |
| 5884 | 5899 |
| 5885 #endif // V8_TARGET_ARCH_X64 | 5900 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |