| Index: src/x64/assembler-x64.cc
|
| diff --git a/src/x64/assembler-x64.cc b/src/x64/assembler-x64.cc
|
| index b4fd678e1792b8b5046d894a7151d7d1987930cf..f6f3bcc0e41a0e9d966618c15bc68e93fd93fa61 100644
|
| --- a/src/x64/assembler-x64.cc
|
| +++ b/src/x64/assembler-x64.cc
|
| @@ -437,21 +437,43 @@ void Assembler::arithmetic_op(byte opcode, Register reg, const Operand& op) {
|
| }
|
|
|
|
|
| -void Assembler::arithmetic_op(byte opcode, Register dst, Register src) {
|
| +void Assembler::arithmetic_op(byte opcode, Register reg, Register rm_reg) {
|
| EnsureSpace ensure_space(this);
|
| last_pc_ = pc_;
|
| - emit_rex_64(dst, src);
|
| + emit_rex_64(reg, rm_reg);
|
| emit(opcode);
|
| - emit_modrm(dst, src);
|
| + emit_modrm(reg, rm_reg);
|
| }
|
|
|
|
|
| -void Assembler::arithmetic_op_32(byte opcode, Register dst, Register src) {
|
| +void Assembler::arithmetic_op_16(byte opcode, Register reg, Register rm_reg) {
|
| EnsureSpace ensure_space(this);
|
| last_pc_ = pc_;
|
| - emit_optional_rex_32(dst, src);
|
| + emit(0x66);
|
| + emit_optional_rex_32(reg, rm_reg);
|
| emit(opcode);
|
| - emit_modrm(dst, src);
|
| + emit_modrm(reg, rm_reg);
|
| +}
|
| +
|
| +
|
| +void Assembler::arithmetic_op_16(byte opcode,
|
| + Register reg,
|
| + const Operand& rm_reg) {
|
| + EnsureSpace ensure_space(this);
|
| + last_pc_ = pc_;
|
| + emit(0x66);
|
| + emit_optional_rex_32(reg, rm_reg);
|
| + emit(opcode);
|
| + emit_operand(reg, rm_reg);
|
| +}
|
| +
|
| +
|
| +void Assembler::arithmetic_op_32(byte opcode, Register reg, Register rm_reg) {
|
| + EnsureSpace ensure_space(this);
|
| + last_pc_ = pc_;
|
| + emit_optional_rex_32(reg, rm_reg);
|
| + emit(opcode);
|
| + emit_modrm(reg, rm_reg);
|
| }
|
|
|
|
|
| @@ -504,6 +526,47 @@ void Assembler::immediate_arithmetic_op(byte subcode,
|
| }
|
|
|
|
|
| +void Assembler::immediate_arithmetic_op_16(byte subcode,
|
| + Register dst,
|
| + Immediate src) {
|
| + EnsureSpace ensure_space(this);
|
| + last_pc_ = pc_;
|
| + emit(0x66); // Operand size override prefix.
|
| + emit_optional_rex_32(dst);
|
| + if (is_int8(src.value_)) {
|
| + emit(0x83);
|
| + emit_modrm(subcode, dst);
|
| + emit(src.value_);
|
| + } else if (dst.is(rax)) {
|
| + emit(0x05 | (subcode << 3));
|
| + emitl(src.value_);
|
| + } else {
|
| + emit(0x81);
|
| + emit_modrm(subcode, dst);
|
| + emitl(src.value_);
|
| + }
|
| +}
|
| +
|
| +
|
| +void Assembler::immediate_arithmetic_op_16(byte subcode,
|
| + const Operand& dst,
|
| + Immediate src) {
|
| + EnsureSpace ensure_space(this);
|
| + last_pc_ = pc_;
|
| + emit(0x66); // Operand size override prefix.
|
| + emit_optional_rex_32(dst);
|
| + if (is_int8(src.value_)) {
|
| + emit(0x83);
|
| + emit_operand(subcode, dst);
|
| + emit(src.value_);
|
| + } else {
|
| + emit(0x81);
|
| + emit_operand(subcode, dst);
|
| + emitl(src.value_);
|
| + }
|
| +}
|
| +
|
| +
|
| void Assembler::immediate_arithmetic_op_32(byte subcode,
|
| Register dst,
|
| Immediate src) {
|
| @@ -744,6 +807,14 @@ void Assembler::cmovl(Condition cc, Register dst, const Operand& src) {
|
| }
|
|
|
|
|
| +void Assembler::cmpb_al(Immediate imm8) {
|
| + ASSERT(is_int8(imm8.value_) || is_uint8(imm8.value_));
|
| + EnsureSpace ensure_space(this);
|
| + last_pc_ = pc_;
|
| + emit(0x3c);
|
| + emit(imm8.value_);
|
| +}
|
| +
|
|
|
| void Assembler::cpuid() {
|
| ASSERT(CpuFeatures::IsEnabled(CpuFeatures::CPUID));
|
| @@ -1193,6 +1264,32 @@ void Assembler::movq(const Operand& dst, Immediate value) {
|
| }
|
|
|
|
|
| +/*
|
| + * Loads the ip-relative location of the src label into the target
|
| + * location (as a 32-bit offset sign extended to 64-bit).
|
| + */
|
| +void Assembler::movl(const Operand& dst, Label* src) {
|
| + EnsureSpace ensure_space(this);
|
| + last_pc_ = pc_;
|
| + emit_optional_rex_32(dst);
|
| + emit(0xC7);
|
| + emit_operand(0, dst);
|
| + if (src->is_bound()) {
|
| + int offset = src->pos() - pc_offset() - sizeof(int32_t);
|
| + ASSERT(offset <= 0);
|
| + emitl(offset);
|
| + } else if (src->is_linked()) {
|
| + emitl(src->pos());
|
| + src->link_to(pc_offset() - sizeof(int32_t));
|
| + } else {
|
| + ASSERT(src->is_unused());
|
| + int32_t current = pc_offset();
|
| + emitl(current);
|
| + src->link_to(current);
|
| + }
|
| +}
|
| +
|
| +
|
| void Assembler::movq(Register dst, Handle<Object> value, RelocInfo::Mode mode) {
|
| // If there is no relocation info, emit the value of the handle efficiently
|
| // (possibly using less that 8 bytes for the value).
|
|
|