Commit 91a2aa6a authored by titzer@chromium.org's avatar titzer@chromium.org

Add MacroAssembler::Move(reg, immediate) on IA32.

BUG=
R=mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/188463003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19780 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a7ead167
......@@ -2833,6 +2833,15 @@ void MacroAssembler::Move(Register dst, Register src) {
}
void MacroAssembler::Move(Register dst, Immediate imm) {
if (imm.is_zero()) {
xor_(dst, dst);
} else {
mov(dst, imm);
}
}
void MacroAssembler::SetCounter(StatsCounter* counter, int value) {
if (FLAG_native_code_counters && counter->Enabled()) {
mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value));
......
......@@ -843,6 +843,9 @@ class MacroAssembler: public Assembler {
// Move if the registers are not identical.
void Move(Register target, Register source);
// Move a constant into a register using the most efficient encoding.
void Move(Register dst, Immediate imm);
// Push a handle value.
void Push(Handle<Object> handle) { push(Immediate(handle)); }
void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); }
......
......@@ -122,6 +122,17 @@ TEST(LoadAndStoreWithRepresentation) {
__ cmp(ebx, edx);
__ j(not_equal, &exit);
// Test 5.
__ Move(edx, Immediate(0)); // Test Move()
__ cmp(edx, Immediate(0));
__ j(not_equal, &exit);
__ Move(ecx, Immediate(-1));
__ cmp(ecx, Immediate(-1));
__ j(not_equal, &exit);
__ Move(ebx, Immediate(0x77));
__ cmp(ebx, Immediate(0x77));
__ j(not_equal, &exit);
__ xor_(eax, eax); // Success.
__ bind(&exit);
__ add(esp, Immediate(1 * kPointerSize));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment