Fix register aliasing after r26306, r26275.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#26317}
This commit is contained in:
ulan 2015-01-29 01:37:24 -08:00 committed by Commit bot
parent 1df5fed50a
commit d83a2445a2
9 changed files with 98 additions and 36 deletions

View File

@ -18,7 +18,8 @@ namespace internal {
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
// ----------- S t a t e -------------
// -- r0 : receiver
// -- r2 : name
@ -28,11 +29,14 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ ldr(receiver,
__ ldr(scratch,
FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ push(receiver);
ParameterCount actual(0);
@ -54,7 +58,8 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
// ----------- S t a t e -------------
// -- lr : return address
// -----------------------------------
@ -65,11 +70,15 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ push(value());
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
DCHECK(!value().is(scratch));
// Call the JavaScript setter with receiver and value on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ ldr(receiver,
__ ldr(scratch,
FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ Push(receiver, value());
ParameterCount actual(1);

View File

@ -221,12 +221,12 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
// ----------- S t a t e -------------
// -- lr : return address
// -----------------------------------
Label miss;
{
FrameScope scope(masm, StackFrame::INTERNAL);
@ -234,11 +234,15 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ Push(value());
if (accessor_index >= 0) {
DCHECK(!AreAliased(holder, scratch));
DCHECK(!AreAliased(receiver, scratch));
DCHECK(!AreAliased(value(), scratch));
// Call the JavaScript setter with receiver and value on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ Ldr(receiver,
__ Ldr(scratch,
FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ Push(receiver, value());
ParameterCount actual(1);
@ -263,16 +267,20 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
if (accessor_index >= 0) {
DCHECK(!AreAliased(holder, scratch));
DCHECK(!AreAliased(receiver, scratch));
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ Ldr(receiver,
__ Ldr(scratch,
FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ Push(receiver);
ParameterCount actual(0);

View File

@ -356,7 +356,7 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadViaGetter(
Handle<Name> name, int accessor_index, int expected_arguments) {
Register holder = Frontend(name);
GenerateLoadViaGetter(masm(), type(), receiver(), holder, accessor_index,
expected_arguments);
expected_arguments, scratch2());
return GetCode(kind(), Code::FAST, name);
}
@ -446,7 +446,7 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreViaSetter(
int expected_arguments) {
Register holder = Frontend(name);
GenerateStoreViaSetter(masm(), type(), receiver(), holder, accessor_index,
expected_arguments);
expected_arguments, scratch2());
return GetCode(kind(), Code::FAST, name);
}

View File

@ -145,11 +145,12 @@ class NamedLoadHandlerCompiler : public PropertyHandlerCompiler {
static void GenerateLoadViaGetter(MacroAssembler* masm, Handle<HeapType> type,
Register receiver, Register holder,
int accessor_index, int expected_arguments);
int accessor_index, int expected_arguments,
Register scratch);
static void GenerateLoadViaGetterForDeopt(MacroAssembler* masm) {
GenerateLoadViaGetter(masm, Handle<HeapType>::null(), no_reg, no_reg, -1,
-1);
-1, no_reg);
}
static void GenerateLoadFunctionPrototype(MacroAssembler* masm,
@ -232,11 +233,11 @@ class NamedStoreHandlerCompiler : public PropertyHandlerCompiler {
static void GenerateStoreViaSetter(MacroAssembler* masm,
Handle<HeapType> type, Register receiver,
Register holder, int accessor_index,
int expected_arguments);
int expected_arguments, Register scratch);
static void GenerateStoreViaSetterForDeopt(MacroAssembler* masm) {
GenerateStoreViaSetter(masm, Handle<HeapType>::null(), no_reg, no_reg, -1,
-1);
-1, no_reg);
}
static void GenerateSlow(MacroAssembler* masm);

View File

@ -18,16 +18,20 @@ namespace internal {
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ mov(receiver,
__ mov(scratch,
FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ push(receiver);
ParameterCount actual(0);
@ -231,7 +235,8 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell(
void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
// ----------- S t a t e -------------
// -- esp[0] : return address
// -----------------------------------
@ -242,11 +247,14 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ push(value());
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
DCHECK(!value().is(scratch));
// Call the JavaScript setter with receiver and value on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ mov(receiver,
__ mov(scratch,
FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ push(receiver);
__ push(value());

View File

@ -18,7 +18,8 @@ namespace internal {
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
// ----------- S t a t e -------------
// -- a0 : receiver
// -- a2 : name
@ -28,11 +29,14 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
FrameScope scope(masm, StackFrame::INTERNAL);
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ lw(receiver,
__ lw(scratch,
FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ push(receiver);
ParameterCount actual(0);
@ -54,7 +58,8 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
// ----------- S t a t e -------------
// -- ra : return address
// -----------------------------------
@ -65,11 +70,15 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ push(value());
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
DCHECK(!value().is(scratch));
// Call the JavaScript setter with receiver and value on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ lw(receiver,
__ lw(scratch,
FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ Push(receiver, value());
ParameterCount actual(1);

View File

@ -18,7 +18,8 @@ namespace internal {
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
// ----------- S t a t e -------------
// -- a0 : receiver
// -- a2 : name
@ -28,11 +29,14 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
FrameScope scope(masm, StackFrame::INTERNAL);
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ ld(receiver,
__ ld(scratch,
FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ push(receiver);
ParameterCount actual(0);
@ -54,7 +58,8 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
// ----------- S t a t e -------------
// -- ra : return address
// -----------------------------------
@ -65,11 +70,15 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ push(value());
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
DCHECK(!value().is(scratch));
// Call the JavaScript setter with receiver and value on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ ld(receiver,
__ ld(scratch,
FieldMemOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ Push(receiver, value());
ParameterCount actual(1);

View File

@ -214,7 +214,8 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell(
void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
// ----------- S t a t e -------------
// -- rsp[0] : return address
// -----------------------------------
@ -225,11 +226,15 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ Push(value());
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
DCHECK(!value().is(scratch));
// Call the JavaScript setter with receiver and value on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ movp(receiver,
__ movp(scratch,
FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ Push(receiver);
__ Push(value());
@ -256,7 +261,8 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
// ----------- S t a t e -------------
// -- rax : receiver
// -- rcx : name
@ -266,11 +272,14 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
FrameScope scope(masm, StackFrame::INTERNAL);
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ movp(receiver,
__ movp(scratch,
FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ Push(receiver);
ParameterCount actual(0);

View File

@ -18,16 +18,20 @@ namespace internal {
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ mov(receiver,
__ mov(scratch,
FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ push(receiver);
ParameterCount actual(0);
@ -231,7 +235,8 @@ void PropertyHandlerCompiler::GenerateCheckPropertyCell(
void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
Register holder, int accessor_index, int expected_arguments) {
Register holder, int accessor_index, int expected_arguments,
Register scratch) {
// ----------- S t a t e -------------
// -- esp[0] : return address
// -----------------------------------
@ -242,11 +247,15 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ push(value());
if (accessor_index >= 0) {
DCHECK(!holder.is(scratch));
DCHECK(!receiver.is(scratch));
DCHECK(!value().is(scratch));
// Call the JavaScript setter with receiver and value on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
__ mov(receiver,
__ mov(scratch,
FieldOperand(receiver, JSGlobalObject::kGlobalProxyOffset));
receiver = scratch;
}
__ push(receiver);
__ push(value());