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 4746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4757 __ j(not_equal, &check_false, Label::kNear); | 4757 __ j(not_equal, &check_false, Label::kNear); |
4758 __ Move(input_reg, Immediate(1)); | 4758 __ Move(input_reg, Immediate(1)); |
4759 __ jmp(done); | 4759 __ jmp(done); |
4760 | 4760 |
4761 __ bind(&check_false); | 4761 __ bind(&check_false); |
4762 __ cmp(input_reg, factory()->false_value()); | 4762 __ cmp(input_reg, factory()->false_value()); |
4763 __ RecordComment("Deferred TaggedToI: cannot truncate"); | 4763 __ RecordComment("Deferred TaggedToI: cannot truncate"); |
4764 DeoptimizeIf(not_equal, instr->environment()); | 4764 DeoptimizeIf(not_equal, instr->environment()); |
4765 __ Move(input_reg, Immediate(0)); | 4765 __ Move(input_reg, Immediate(0)); |
4766 } else { | 4766 } else { |
4767 Label bailout; | 4767 XMMRegister scratch = ToDoubleRegister(instr->temp()); |
4768 XMMRegister scratch = (instr->temp() != NULL) | 4768 DCHECK(!scratch.is(xmm0)); |
4769 ? ToDoubleRegister(instr->temp()) | 4769 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
4770 : no_xmm_reg; | 4770 isolate()->factory()->heap_number_map()); |
4771 __ TaggedToI(input_reg, input_reg, scratch, | 4771 __ RecordComment("Deferred TaggedToI: not a heap number"); |
4772 instr->hydrogen()->GetMinusZeroMode(), &bailout); | 4772 DeoptimizeIf(not_equal, instr->environment()); |
4773 __ jmp(done); | 4773 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
4774 __ bind(&bailout); | 4774 __ cvttsd2si(input_reg, Operand(xmm0)); |
4775 DeoptimizeIf(no_condition, instr->environment()); | 4775 __ Cvtsi2sd(scratch, Operand(input_reg)); |
| 4776 __ ucomisd(xmm0, scratch); |
| 4777 __ RecordComment("Deferred TaggedToI: lost precision"); |
| 4778 DeoptimizeIf(not_equal, instr->environment()); |
| 4779 __ RecordComment("Deferred TaggedToI: NaN"); |
| 4780 DeoptimizeIf(parity_even, instr->environment()); |
| 4781 if (instr->hydrogen()->GetMinusZeroMode() == FAIL_ON_MINUS_ZERO) { |
| 4782 __ test(input_reg, Operand(input_reg)); |
| 4783 __ j(not_zero, done); |
| 4784 __ movmskpd(input_reg, xmm0); |
| 4785 __ and_(input_reg, 1); |
| 4786 __ RecordComment("Deferred TaggedToI: minus zero"); |
| 4787 DeoptimizeIf(not_zero, instr->environment()); |
| 4788 } |
4776 } | 4789 } |
4777 } | 4790 } |
4778 | 4791 |
4779 | 4792 |
4780 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4793 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
4781 class DeferredTaggedToI FINAL : public LDeferredCode { | 4794 class DeferredTaggedToI FINAL : public LDeferredCode { |
4782 public: | 4795 public: |
4783 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4796 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
4784 : LDeferredCode(codegen), instr_(instr) { } | 4797 : LDeferredCode(codegen), instr_(instr) { } |
4785 virtual void Generate() OVERRIDE { | 4798 virtual void Generate() OVERRIDE { |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5698 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5711 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5699 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5712 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5700 } | 5713 } |
5701 | 5714 |
5702 | 5715 |
5703 #undef __ | 5716 #undef __ |
5704 | 5717 |
5705 } } // namespace v8::internal | 5718 } } // namespace v8::internal |
5706 | 5719 |
5707 #endif // V8_TARGET_ARCH_IA32 | 5720 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |