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 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 void Assembler::testl(Register dst, Register src) { | 1601 void Assembler::testl(Register dst, Register src) { |
1602 EnsureSpace ensure_space(this); | 1602 EnsureSpace ensure_space(this); |
1603 last_pc_ = pc_; | 1603 last_pc_ = pc_; |
1604 emit_optional_rex_32(dst, src); | 1604 emit_optional_rex_32(dst, src); |
1605 emit(0x85); | 1605 emit(0x85); |
1606 emit_modrm(dst, src); | 1606 emit_modrm(dst, src); |
1607 } | 1607 } |
1608 | 1608 |
1609 | 1609 |
1610 void Assembler::testl(Register reg, Immediate mask) { | 1610 void Assembler::testl(Register reg, Immediate mask) { |
| 1611 // testl with a mask that fits in the low byte is exactly testb. |
| 1612 if (is_uint8(mask.value_) { |
| 1613 testb(reg, mask); |
| 1614 return; |
| 1615 } |
1611 EnsureSpace ensure_space(this); | 1616 EnsureSpace ensure_space(this); |
1612 last_pc_ = pc_; | 1617 last_pc_ = pc_; |
1613 if (reg.is(rax)) { | 1618 if (reg.is(rax)) { |
1614 emit(0xA9); | 1619 emit(0xA9); |
1615 emit(mask); | 1620 emit(mask); |
1616 } else { | 1621 } else { |
1617 emit_optional_rex_32(rax, reg); | 1622 emit_optional_rex_32(rax, reg); |
1618 emit(0xF7); | 1623 emit(0xF7); |
1619 emit_modrm(0x0, reg); | 1624 emit_modrm(0x0, reg); |
1620 emit(mask); | 1625 emit(mask); |
1621 } | 1626 } |
1622 } | 1627 } |
1623 | 1628 |
1624 | 1629 |
1625 void Assembler::testl(const Operand& op, Immediate mask) { | 1630 void Assembler::testl(const Operand& op, Immediate mask) { |
| 1631 // testl with a mask that fits in the low byte is exactly testb. |
| 1632 if (is_uint8(mask.value_)) { |
| 1633 testb(op, mask); |
| 1634 return; |
| 1635 } |
1626 EnsureSpace ensure_space(this); | 1636 EnsureSpace ensure_space(this); |
1627 last_pc_ = pc_; | 1637 last_pc_ = pc_; |
1628 emit_optional_rex_32(rax, op); | 1638 emit_optional_rex_32(rax, op); |
1629 emit(0xF7); | 1639 emit(0xF7); |
1630 emit_operand(rax, op); // Operation code 0 | 1640 emit_operand(rax, op); // Operation code 0 |
1631 emit(mask); | 1641 emit(mask); |
1632 } | 1642 } |
1633 | 1643 |
1634 | 1644 |
1635 void Assembler::testq(const Operand& op, Register reg) { | 1645 void Assembler::testq(const Operand& op, Register reg) { |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2224 RecordRelocInfo(RelocInfo::POSITION, current_position_); | 2234 RecordRelocInfo(RelocInfo::POSITION, current_position_); |
2225 written_position_ = current_position_; | 2235 written_position_ = current_position_; |
2226 } | 2236 } |
2227 } | 2237 } |
2228 | 2238 |
2229 | 2239 |
2230 const int RelocInfo::kApplyMask = 1 << RelocInfo::INTERNAL_REFERENCE; | 2240 const int RelocInfo::kApplyMask = 1 << RelocInfo::INTERNAL_REFERENCE; |
2231 | 2241 |
2232 | 2242 |
2233 } } // namespace v8::internal | 2243 } } // namespace v8::internal |
OLD | NEW |