Commit 24451355 authored by whesse@chromium.org's avatar whesse@chromium.org

Avoid calling ToRegister(register) when result is in register already, and register is shared.

Review URL: http://codereview.chromium.org/1325004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4260 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5f764c82
......@@ -1040,18 +1040,23 @@ Result VirtualFrame::CallKeyedStoreIC() {
PrepareForCall(0, 0);
if (!cgen()->allocator()->is_used(eax) ||
(value.is_register() && value.reg().is(eax))) {
value.ToRegister(eax); // No effect if value is in eax already.
if (!cgen()->allocator()->is_used(eax)) {
value.ToRegister(eax);
}
MoveResultsToRegisters(&key, &receiver, ecx, edx);
value.Unuse();
} else if (!cgen()->allocator()->is_used(ecx) ||
(key.is_register() && key.reg().is(ecx))) {
// Receiver and/or key are in eax.
key.ToRegister(ecx);
if (!cgen()->allocator()->is_used(ecx)) {
key.ToRegister(ecx);
}
MoveResultsToRegisters(&value, &receiver, eax, edx);
key.Unuse();
} else if (!cgen()->allocator()->is_used(edx) ||
(receiver.is_register() && receiver.reg().is(edx))) {
receiver.ToRegister(edx);
if (!cgen()->allocator()->is_used(edx)) {
receiver.ToRegister(edx);
}
MoveResultsToRegisters(&key, &value, ecx, eax);
receiver.Unuse();
} else {
......
......@@ -33,6 +33,13 @@ function identity(x) {
return x;
}
function lookup(w, a) {
// This function tests a code path in the generation of a keyed load IC
// where the key and the value are both in the same register.
a = a;
w[a] = a;
}
function cover_codegen_paths() {
var x = 1;
......@@ -131,6 +138,12 @@ function cover_codegen_paths() {
assertEquals(1073741824, 1 - di);
x = 3;
var w = { };
lookup(w, x);
lookup(w, x);
lookup(w, x);
x = 3; // Terminate while loop.
}
}
......
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