OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4605 | 4605 |
4606 // Smi to XMM conversion | 4606 // Smi to XMM conversion |
4607 __ bind(&load_smi); | 4607 __ bind(&load_smi); |
4608 __ SmiToInteger32(kScratchRegister, input_reg); | 4608 __ SmiToInteger32(kScratchRegister, input_reg); |
4609 __ Cvtlsi2sd(result_reg, kScratchRegister); | 4609 __ Cvtlsi2sd(result_reg, kScratchRegister); |
4610 __ bind(&done); | 4610 __ bind(&done); |
4611 } | 4611 } |
4612 | 4612 |
4613 | 4613 |
4614 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { | 4614 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { |
4615 Label heap_number; | |
4616 Register input_reg = ToRegister(instr->value()); | 4615 Register input_reg = ToRegister(instr->value()); |
4617 | 4616 |
| 4617 if (instr->truncating()) { |
| 4618 Label no_heap_number, check_bools, check_false; |
4618 | 4619 |
4619 if (instr->truncating()) { | |
4620 // Heap number map check. | 4620 // Heap number map check. |
4621 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), | 4621 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), |
4622 Heap::kHeapNumberMapRootIndex); | 4622 Heap::kHeapNumberMapRootIndex); |
4623 __ j(equal, &heap_number, Label::kNear); | 4623 __ j(not_equal, &no_heap_number, Label::kNear); |
4624 // Check for undefined. Undefined is converted to zero for truncating | 4624 __ TruncateHeapNumberToI(input_reg, input_reg); |
4625 // conversions. | 4625 __ jmp(done); |
| 4626 |
| 4627 __ bind(&no_heap_number); |
| 4628 // Check for Oddballs. Undefined/False is converted to zero and True to one |
| 4629 // for truncating conversions. |
4626 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); | 4630 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); |
| 4631 __ j(not_equal, &check_bools, Label::kNear); |
| 4632 __ Set(input_reg, 0); |
| 4633 __ jmp(done); |
| 4634 |
| 4635 __ bind(&check_bools); |
| 4636 __ CompareRoot(input_reg, Heap::kTrueValueRootIndex); |
| 4637 __ j(not_equal, &check_false, Label::kNear); |
| 4638 __ Set(input_reg, 1); |
| 4639 __ jmp(done); |
| 4640 |
| 4641 __ bind(&check_false); |
| 4642 __ CompareRoot(input_reg, Heap::kFalseValueRootIndex); |
| 4643 __ RecordComment("Deferred TaggedToI: cannot truncate"); |
4627 DeoptimizeIf(not_equal, instr->environment()); | 4644 DeoptimizeIf(not_equal, instr->environment()); |
4628 __ Set(input_reg, 0); | 4645 __ Set(input_reg, 0); |
4629 __ jmp(done); | 4646 __ jmp(done); |
4630 | |
4631 __ bind(&heap_number); | |
4632 __ TruncateHeapNumberToI(input_reg, input_reg); | |
4633 } else { | 4647 } else { |
4634 Label bailout; | 4648 Label bailout; |
4635 XMMRegister xmm_temp = ToDoubleRegister(instr->temp()); | 4649 XMMRegister xmm_temp = ToDoubleRegister(instr->temp()); |
4636 __ TaggedToI(input_reg, input_reg, xmm_temp, | 4650 __ TaggedToI(input_reg, input_reg, xmm_temp, |
4637 instr->hydrogen()->GetMinusZeroMode(), &bailout, Label::kNear); | 4651 instr->hydrogen()->GetMinusZeroMode(), &bailout, Label::kNear); |
4638 | 4652 |
4639 __ jmp(done); | 4653 __ jmp(done); |
4640 __ bind(&bailout); | 4654 __ bind(&bailout); |
4641 DeoptimizeIf(no_condition, instr->environment()); | 4655 DeoptimizeIf(no_condition, instr->environment()); |
4642 } | 4656 } |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5438 FixedArray::kHeaderSize - kPointerSize)); | 5452 FixedArray::kHeaderSize - kPointerSize)); |
5439 __ bind(&done); | 5453 __ bind(&done); |
5440 } | 5454 } |
5441 | 5455 |
5442 | 5456 |
5443 #undef __ | 5457 #undef __ |
5444 | 5458 |
5445 } } // namespace v8::internal | 5459 } } // namespace v8::internal |
5446 | 5460 |
5447 #endif // V8_TARGET_ARCH_X64 | 5461 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |