X87: Use register parameters in ElementsTransitionGenerator

port r22384

original commit message:
 Use register parameters in ElementsTransitionGenerator
x

BUG=
R=weiliang.lin@intel.com

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

Patch from Chunyang Dai <chunyang.dai@intel.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22402 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
weiliang.lin@intel.com 2014-07-15 09:46:10 +00:00
parent ee51510674
commit 2aad6f0024
4 changed files with 83 additions and 42 deletions

View File

@ -199,40 +199,47 @@ MemMoveFunction CreateMemMoveFunction() {
void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( void ElementsTransitionGenerator::GenerateMapChangeElementsTransition(
MacroAssembler* masm, AllocationSiteMode mode, MacroAssembler* masm,
Register receiver,
Register key,
Register value,
Register target_map,
AllocationSiteMode mode,
Label* allocation_memento_found) { Label* allocation_memento_found) {
// ----------- S t a t e ------------- Register scratch = edi;
// -- eax : value ASSERT(!AreAliased(receiver, key, value, target_map, scratch));
// -- ebx : target map
// -- ecx : key
// -- edx : receiver
// -- esp[0] : return address
// -----------------------------------
if (mode == TRACK_ALLOCATION_SITE) { if (mode == TRACK_ALLOCATION_SITE) {
ASSERT(allocation_memento_found != NULL); ASSERT(allocation_memento_found != NULL);
__ JumpIfJSArrayHasAllocationMemento(edx, edi, allocation_memento_found); __ JumpIfJSArrayHasAllocationMemento(
receiver, scratch, allocation_memento_found);
} }
// Set transitioned map. // Set transitioned map.
__ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); __ mov(FieldOperand(receiver, HeapObject::kMapOffset), target_map);
__ RecordWriteField(edx, __ RecordWriteField(receiver,
HeapObject::kMapOffset, HeapObject::kMapOffset,
ebx, target_map,
edi, scratch,
EMIT_REMEMBERED_SET, EMIT_REMEMBERED_SET,
OMIT_SMI_CHECK); OMIT_SMI_CHECK);
} }
void ElementsTransitionGenerator::GenerateSmiToDouble( void ElementsTransitionGenerator::GenerateSmiToDouble(
MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { MacroAssembler* masm,
// ----------- S t a t e ------------- Register receiver,
// -- eax : value Register key,
// -- ebx : target map Register value,
// -- ecx : key Register target_map,
// -- edx : receiver AllocationSiteMode mode,
// -- esp[0] : return address Label* fail) {
// ----------------------------------- // Return address is on the stack.
ASSERT(receiver.is(edx));
ASSERT(key.is(ecx));
ASSERT(value.is(eax));
ASSERT(target_map.is(ebx));
Label loop, entry, convert_hole, gc_required, only_change_map; Label loop, entry, convert_hole, gc_required, only_change_map;
if (mode == TRACK_ALLOCATION_SITE) { if (mode == TRACK_ALLOCATION_SITE) {
@ -342,14 +349,19 @@ void ElementsTransitionGenerator::GenerateSmiToDouble(
void ElementsTransitionGenerator::GenerateDoubleToObject( void ElementsTransitionGenerator::GenerateDoubleToObject(
MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { MacroAssembler* masm,
// ----------- S t a t e ------------- Register receiver,
// -- eax : value Register key,
// -- ebx : target map Register value,
// -- ecx : key Register target_map,
// -- edx : receiver AllocationSiteMode mode,
// -- esp[0] : return address Label* fail) {
// ----------------------------------- // Return address is on the stack.
ASSERT(receiver.is(edx));
ASSERT(key.is(ecx));
ASSERT(value.is(eax));
ASSERT(target_map.is(ebx));
Label loop, entry, convert_hole, gc_required, only_change_map, success; Label loop, entry, convert_hole, gc_required, only_change_map, success;
if (mode == TRACK_ALLOCATION_SITE) { if (mode == TRACK_ALLOCATION_SITE) {

View File

@ -804,7 +804,8 @@ static void KeyedStoreGenerateGenericHelper(
slow); slow);
AllocationSiteMode mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, AllocationSiteMode mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS,
FAST_DOUBLE_ELEMENTS); FAST_DOUBLE_ELEMENTS);
ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, slow); ElementsTransitionGenerator::GenerateSmiToDouble(
masm, receiver, key, value, ebx, mode, slow);
__ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset));
__ jmp(&fast_double_without_map_check); __ jmp(&fast_double_without_map_check);
@ -816,8 +817,8 @@ static void KeyedStoreGenerateGenericHelper(
edi, edi,
slow); slow);
mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, FAST_ELEMENTS); mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, FAST_ELEMENTS);
ElementsTransitionGenerator::GenerateMapChangeElementsTransition(masm, mode, ElementsTransitionGenerator::GenerateMapChangeElementsTransition(
slow); masm, receiver, key, value, ebx, mode, slow);
__ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset));
__ jmp(&finish_object_store); __ jmp(&finish_object_store);
@ -832,7 +833,8 @@ static void KeyedStoreGenerateGenericHelper(
edi, edi,
slow); slow);
mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS);
ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); ElementsTransitionGenerator::GenerateDoubleToObject(
masm, receiver, key, value, ebx, mode, slow);
__ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset)); __ mov(ebx, FieldOperand(receiver, JSObject::kElementsOffset));
__ jmp(&finish_object_store); __ jmp(&finish_object_store);
} }

View File

@ -2930,15 +2930,33 @@ void MacroAssembler::CallCFunction(Register function,
} }
bool AreAliased(Register r1, Register r2, Register r3, Register r4) { #ifdef DEBUG
if (r1.is(r2)) return true; bool AreAliased(Register reg1,
if (r1.is(r3)) return true; Register reg2,
if (r1.is(r4)) return true; Register reg3,
if (r2.is(r3)) return true; Register reg4,
if (r2.is(r4)) return true; Register reg5,
if (r3.is(r4)) return true; Register reg6,
return false; Register reg7,
Register reg8) {
int n_of_valid_regs = reg1.is_valid() + reg2.is_valid() +
reg3.is_valid() + reg4.is_valid() + reg5.is_valid() + reg6.is_valid() +
reg7.is_valid() + reg8.is_valid();
RegList regs = 0;
if (reg1.is_valid()) regs |= reg1.bit();
if (reg2.is_valid()) regs |= reg2.bit();
if (reg3.is_valid()) regs |= reg3.bit();
if (reg4.is_valid()) regs |= reg4.bit();
if (reg5.is_valid()) regs |= reg5.bit();
if (reg6.is_valid()) regs |= reg6.bit();
if (reg7.is_valid()) regs |= reg7.bit();
if (reg8.is_valid()) regs |= reg8.bit();
int n_of_non_aliasing_regs = NumRegs(regs);
return n_of_valid_regs != n_of_non_aliasing_regs;
} }
#endif
CodePatcher::CodePatcher(byte* address, int size) CodePatcher::CodePatcher(byte* address, int size)

View File

@ -30,7 +30,16 @@ enum RegisterValueType {
}; };
bool AreAliased(Register r1, Register r2, Register r3, Register r4); #ifdef DEBUG
bool AreAliased(Register reg1,
Register reg2,
Register reg3 = no_reg,
Register reg4 = no_reg,
Register reg5 = no_reg,
Register reg6 = no_reg,
Register reg7 = no_reg,
Register reg8 = no_reg);
#endif
// MacroAssembler implements a collection of frequently used macros. // MacroAssembler implements a collection of frequently used macros.