OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 ASSERT(!dst.is(kScratchRegister)); | 596 ASSERT(!dst.is(kScratchRegister)); |
597 if (src->value() == 0) { | 597 if (src->value() == 0) { |
598 testq(dst, dst); | 598 testq(dst, dst); |
599 } else { | 599 } else { |
600 Move(kScratchRegister, src); | 600 Move(kScratchRegister, src); |
601 cmpq(dst, kScratchRegister); | 601 cmpq(dst, kScratchRegister); |
602 } | 602 } |
603 } | 603 } |
604 | 604 |
605 | 605 |
606 void MacroAssembler::SmiCompare(Register dst, const Operand& src) { | 606 void MacroAssembler::SmiCompare(Register dst, const Operand& src) { |
607 cmpq(dst, src); | 607 cmpq(dst, src); |
608 } | 608 } |
609 | 609 |
610 | 610 |
611 void MacroAssembler::SmiCompare(const Operand& dst, Register src) { | 611 void MacroAssembler::SmiCompare(const Operand& dst, Register src) { |
612 cmpq(dst, src); | 612 cmpq(dst, src); |
613 } | 613 } |
614 | 614 |
615 | 615 |
616 void MacroAssembler::SmiCompare(const Operand& dst, Smi* src) { | 616 void MacroAssembler::SmiCompare(const Operand& dst, Smi* src) { |
617 if (src->value() == 0) { | 617 cmpl(Operand(dst, kIntSize), Immediate(src->value())); |
618 // Only tagged long smi to have 32-bit representation. | |
619 cmpq(dst, Immediate(0)); | |
620 } else { | |
621 Move(kScratchRegister, src); | |
622 cmpq(dst, kScratchRegister); | |
623 } | |
624 } | 618 } |
625 | 619 |
626 | 620 |
627 void MacroAssembler::PositiveSmiTimesPowerOfTwoToInteger64(Register dst, | 621 void MacroAssembler::PositiveSmiTimesPowerOfTwoToInteger64(Register dst, |
628 Register src, | 622 Register src, |
629 int power) { | 623 int power) { |
630 ASSERT(power >= 0); | 624 ASSERT(power >= 0); |
631 ASSERT(power < 64); | 625 ASSERT(power < 64); |
632 if (power == 0) { | 626 if (power == 0) { |
633 SmiToInteger64(dst, src); | 627 SmiToInteger64(dst, src); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 addq(dst, kScratchRegister); | 909 addq(dst, kScratchRegister); |
916 } else { | 910 } else { |
917 Move(dst, constant); | 911 Move(dst, constant); |
918 addq(dst, src); | 912 addq(dst, src); |
919 } | 913 } |
920 } | 914 } |
921 | 915 |
922 | 916 |
923 void MacroAssembler::SmiAddConstant(const Operand& dst, Smi* constant) { | 917 void MacroAssembler::SmiAddConstant(const Operand& dst, Smi* constant) { |
924 if (constant->value() != 0) { | 918 if (constant->value() != 0) { |
925 Move(kScratchRegister, constant); | 919 addl(Operand(dst, kIntSize), Immediate(constant->value())); |
926 addq(dst, kScratchRegister); | |
927 } | 920 } |
928 } | 921 } |
929 | 922 |
930 | 923 |
931 void MacroAssembler::SmiAddConstant(Register dst, | 924 void MacroAssembler::SmiAddConstant(Register dst, |
932 Register src, | 925 Register src, |
933 Smi* constant, | 926 Smi* constant, |
934 Label* on_not_smi_result) { | 927 Label* on_not_smi_result) { |
935 if (constant->value() == 0) { | 928 if (constant->value() == 0) { |
936 if (!dst.is(src)) { | 929 if (!dst.is(src)) { |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 | 1593 |
1601 | 1594 |
1602 void MacroAssembler::Drop(int stack_elements) { | 1595 void MacroAssembler::Drop(int stack_elements) { |
1603 if (stack_elements > 0) { | 1596 if (stack_elements > 0) { |
1604 addq(rsp, Immediate(stack_elements * kPointerSize)); | 1597 addq(rsp, Immediate(stack_elements * kPointerSize)); |
1605 } | 1598 } |
1606 } | 1599 } |
1607 | 1600 |
1608 | 1601 |
1609 void MacroAssembler::Test(const Operand& src, Smi* source) { | 1602 void MacroAssembler::Test(const Operand& src, Smi* source) { |
1610 intptr_t smi = reinterpret_cast<intptr_t>(source); | 1603 testl(Operand(src, kIntSize), Immediate(source->value())); |
1611 if (is_int32(smi)) { | |
1612 testl(src, Immediate(static_cast<int32_t>(smi))); | |
1613 } else { | |
1614 Move(kScratchRegister, source); | |
1615 testq(src, kScratchRegister); | |
1616 } | |
1617 } | 1604 } |
1618 | 1605 |
1619 | 1606 |
1620 void MacroAssembler::Jump(ExternalReference ext) { | 1607 void MacroAssembler::Jump(ExternalReference ext) { |
1621 movq(kScratchRegister, ext); | 1608 movq(kScratchRegister, ext); |
1622 jmp(kScratchRegister); | 1609 jmp(kScratchRegister); |
1623 } | 1610 } |
1624 | 1611 |
1625 | 1612 |
1626 void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) { | 1613 void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) { |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2769 CPU::FlushICache(address_, size_); | 2756 CPU::FlushICache(address_, size_); |
2770 | 2757 |
2771 // Check that the code was patched as expected. | 2758 // Check that the code was patched as expected. |
2772 ASSERT(masm_.pc_ == address_ + size_); | 2759 ASSERT(masm_.pc_ == address_ + size_); |
2773 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2760 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2774 } | 2761 } |
2775 | 2762 |
2776 } } // namespace v8::internal | 2763 } } // namespace v8::internal |
2777 | 2764 |
2778 #endif // V8_TARGET_ARCH_X64 | 2765 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |