From 418501faef07db65847225f6d96862b5a8436255 Mon Sep 17 00:00:00 2001 From: "fschneider@chromium.org" Date: Thu, 14 Apr 2011 11:10:00 +0000 Subject: [PATCH] Refine allocation policy for input operands at calls. For instructions that are marked as calls we can use: 1. Fixed input registers 2. Use-at-start policy (register, memory or constant). (Memory or constant would not need the use-at-start policy, but not specifying use-at-start prevents the allocator from using a register even if there is one available. That's why use-at-start is required and guarded by assertion) Review URL: http://codereview.chromium.org/6853010 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7616 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/lithium-arm.cc | 19 +++++++++---------- src/ia32/lithium-ia32.cc | 22 +++++++++++----------- src/x64/lithium-x64.cc | 22 +++++++++++----------- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc index 3f1d15bdb0..f179865348 100644 --- a/src/arm/lithium-arm.cc +++ b/src/arm/lithium-arm.cc @@ -61,22 +61,21 @@ void LOsrEntry::MarkSpilledRegister(int allocation_index, #ifdef DEBUG void LInstruction::VerifyCall() { - // Call instructions can use only fixed registers as - // temporaries and outputs because all registers - // are blocked by the calling convention. - // Inputs must use a fixed register. + // Call instructions can use only fixed registers as temporaries and + // outputs because all registers are blocked by the calling convention. + // Inputs operands must use a fixed register or use-at-start policy or + // a non-register policy. ASSERT(Output() == NULL || LUnallocated::cast(Output())->HasFixedPolicy() || !LUnallocated::cast(Output())->HasRegisterPolicy()); for (UseIterator it(this); it.HasNext(); it.Advance()) { - LOperand* operand = it.Next(); - ASSERT(LUnallocated::cast(operand)->HasFixedPolicy() || - !LUnallocated::cast(operand)->HasRegisterPolicy()); + LUnallocated* operand = LUnallocated::cast(it.Next()); + ASSERT(operand->HasFixedPolicy() || + operand->IsUsedAtStart()); } for (TempIterator it(this); it.HasNext(); it.Advance()) { - LOperand* operand = it.Next(); - ASSERT(LUnallocated::cast(operand)->HasFixedPolicy() || - !LUnallocated::cast(operand)->HasRegisterPolicy()); + LUnallocated* operand = LUnallocated::cast(it.Next()); + ASSERT(operand->HasFixedPolicy() ||!operand->HasRegisterPolicy()); } } #endif diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc index 9ccd18979e..76a4a063d5 100644 --- a/src/ia32/lithium-ia32.cc +++ b/src/ia32/lithium-ia32.cc @@ -71,22 +71,21 @@ void LOsrEntry::MarkSpilledDoubleRegister(int allocation_index, #ifdef DEBUG void LInstruction::VerifyCall() { - // Call instructions can use only fixed registers as - // temporaries and outputs because all registers - // are blocked by the calling convention. - // Inputs must use a fixed register. + // Call instructions can use only fixed registers as temporaries and + // outputs because all registers are blocked by the calling convention. + // Inputs operands must use a fixed register or use-at-start policy or + // a non-register policy. ASSERT(Output() == NULL || LUnallocated::cast(Output())->HasFixedPolicy() || !LUnallocated::cast(Output())->HasRegisterPolicy()); for (UseIterator it(this); it.HasNext(); it.Advance()) { - LOperand* operand = it.Next(); - ASSERT(LUnallocated::cast(operand)->HasFixedPolicy() || - !LUnallocated::cast(operand)->HasRegisterPolicy()); + LUnallocated* operand = LUnallocated::cast(it.Next()); + ASSERT(operand->HasFixedPolicy() || + operand->IsUsedAtStart()); } for (TempIterator it(this); it.HasNext(); it.Advance()) { - LOperand* operand = it.Next(); - ASSERT(LUnallocated::cast(operand)->HasFixedPolicy() || - !LUnallocated::cast(operand)->HasRegisterPolicy()); + LUnallocated* operand = LUnallocated::cast(it.Next()); + ASSERT(operand->HasFixedPolicy() ||!operand->HasRegisterPolicy()); } } #endif @@ -2046,7 +2045,8 @@ LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { LDeleteProperty* result = - new LDeleteProperty(Use(instr->object()), UseOrConstant(instr->key())); + new LDeleteProperty(UseAtStart(instr->object()), + UseOrConstantAtStart(instr->key())); return MarkAsCall(DefineFixed(result, eax), instr); } diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc index 07ca3a5110..62573ca46f 100644 --- a/src/x64/lithium-x64.cc +++ b/src/x64/lithium-x64.cc @@ -71,22 +71,21 @@ void LOsrEntry::MarkSpilledDoubleRegister(int allocation_index, #ifdef DEBUG void LInstruction::VerifyCall() { - // Call instructions can use only fixed registers as - // temporaries and outputs because all registers - // are blocked by the calling convention. - // Inputs must use a fixed register. + // Call instructions can use only fixed registers as temporaries and + // outputs because all registers are blocked by the calling convention. + // Inputs operands must use a fixed register or use-at-start policy or + // a non-register policy. ASSERT(Output() == NULL || LUnallocated::cast(Output())->HasFixedPolicy() || !LUnallocated::cast(Output())->HasRegisterPolicy()); for (UseIterator it(this); it.HasNext(); it.Advance()) { - LOperand* operand = it.Next(); - ASSERT(LUnallocated::cast(operand)->HasFixedPolicy() || - !LUnallocated::cast(operand)->HasRegisterPolicy()); + LUnallocated* operand = LUnallocated::cast(it.Next()); + ASSERT(operand->HasFixedPolicy() || + operand->IsUsedAtStart()); } for (TempIterator it(this); it.HasNext(); it.Advance()) { - LOperand* operand = it.Next(); - ASSERT(LUnallocated::cast(operand)->HasFixedPolicy() || - !LUnallocated::cast(operand)->HasRegisterPolicy()); + LUnallocated* operand = LUnallocated::cast(it.Next()); + ASSERT(operand->HasFixedPolicy() ||!operand->HasRegisterPolicy()); } } #endif @@ -1984,7 +1983,8 @@ LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) { LDeleteProperty* result = - new LDeleteProperty(Use(instr->object()), UseOrConstant(instr->key())); + new LDeleteProperty(UseAtStart(instr->object()), + UseOrConstantAtStart(instr->key())); return MarkAsCall(DefineFixed(result, rax), instr); }