Chromium Code Reviews| 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 4745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4756 __ cmp(input_reg, factory()->true_value()); | 4756 __ cmp(input_reg, factory()->true_value()); |
| 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 __ jmp(done); | |
|
Jakob Kummerow
2014/09/17 09:22:35
As discussed, we don't need this jump (as it would
| |
| 4766 } else { | 4767 } else { |
| 4767 Label bailout; | 4768 XMMRegister scratch = ToDoubleRegister(instr->temp()); |
| 4768 XMMRegister scratch = (instr->temp() != NULL) | 4769 DCHECK(!scratch.is(xmm0)); |
| 4769 ? ToDoubleRegister(instr->temp()) | 4770 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 4770 : no_xmm_reg; | 4771 isolate()->factory()->heap_number_map()); |
| 4771 __ TaggedToI(input_reg, input_reg, scratch, | 4772 __ RecordComment("Deferred TaggedToI: not a heap number"); |
| 4772 instr->hydrogen()->GetMinusZeroMode(), &bailout); | 4773 DeoptimizeIf(not_equal, instr->environment()); |
| 4774 __ movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); | |
| 4775 __ cvttsd2si(input_reg, Operand(xmm0)); | |
| 4776 __ Cvtsi2sd(scratch, Operand(input_reg)); | |
| 4777 __ ucomisd(xmm0, scratch); | |
| 4778 __ RecordComment("Deferred TaggedToI: lost precision"); | |
| 4779 DeoptimizeIf(not_equal, instr->environment()); | |
| 4780 __ RecordComment("Deferred TaggedToI: NaN"); | |
| 4781 DeoptimizeIf(parity_even, instr->environment()); | |
| 4782 if (instr->hydrogen()->GetMinusZeroMode() == FAIL_ON_MINUS_ZERO) { | |
| 4783 __ test(input_reg, Operand(input_reg)); | |
| 4784 __ j(not_zero, done); | |
| 4785 __ movmskpd(input_reg, xmm0); | |
| 4786 __ and_(input_reg, 1); | |
| 4787 __ RecordComment("Deferred TaggedToI: minus zero"); | |
| 4788 DeoptimizeIf(not_zero, instr->environment()); | |
| 4789 } | |
| 4773 __ jmp(done); | 4790 __ jmp(done); |
|
Jakob Kummerow
2014/09/17 09:22:35
This can go too (see above).
| |
| 4774 __ bind(&bailout); | |
| 4775 DeoptimizeIf(no_condition, instr->environment()); | |
| 4776 } | 4791 } |
| 4777 } | 4792 } |
| 4778 | 4793 |
| 4779 | 4794 |
| 4780 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4795 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
| 4781 class DeferredTaggedToI FINAL : public LDeferredCode { | 4796 class DeferredTaggedToI FINAL : public LDeferredCode { |
| 4782 public: | 4797 public: |
| 4783 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) | 4798 DeferredTaggedToI(LCodeGen* codegen, LTaggedToI* instr) |
| 4784 : LDeferredCode(codegen), instr_(instr) { } | 4799 : LDeferredCode(codegen), instr_(instr) { } |
| 4785 virtual void Generate() OVERRIDE { | 4800 virtual void Generate() OVERRIDE { |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5698 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5713 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5699 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5714 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5700 } | 5715 } |
| 5701 | 5716 |
| 5702 | 5717 |
| 5703 #undef __ | 5718 #undef __ |
| 5704 | 5719 |
| 5705 } } // namespace v8::internal | 5720 } } // namespace v8::internal |
| 5706 | 5721 |
| 5707 #endif // V8_TARGET_ARCH_IA32 | 5722 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |