Commit 52840146 authored by ulan's avatar ulan Committed by Commit bot

Extract LoadAccessor into a masm function.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#26310}
parent 489b6f7c
......@@ -3750,6 +3750,19 @@ void MacroAssembler::EnumLength(Register dst, Register map) {
}
void MacroAssembler::LoadAccessor(Register dst, Register holder,
int accessor_index,
AccessorComponent accessor) {
ldr(dst, FieldMemOperand(holder, HeapObject::kMapOffset));
LoadInstanceDescriptors(dst, dst);
ldr(dst,
FieldMemOperand(dst, DescriptorArray::GetValueOffset(accessor_index)));
int offset = accessor == ACCESSOR_GETTER ? AccessorPair::kGetterOffset
: AccessorPair::kSetterOffset;
ldr(dst, FieldMemOperand(dst, offset));
}
void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) {
Register empty_fixed_array_value = r6;
LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex);
......
......@@ -1357,6 +1357,8 @@ class MacroAssembler: public Assembler {
void LoadInstanceDescriptors(Register map, Register descriptors);
void EnumLength(Register dst, Register map);
void NumberOfOwnDescriptors(Register dst, Register map);
void LoadAccessor(Register dst, Register holder, int accessor_index,
AccessorComponent accessor);
template<typename Field>
void DecodeField(Register dst, Register src) {
......
......@@ -1453,6 +1453,19 @@ void MacroAssembler::EnumLengthSmi(Register dst, Register map) {
}
void MacroAssembler::LoadAccessor(Register dst, Register holder,
int accessor_index,
AccessorComponent accessor) {
Ldr(dst, FieldMemOperand(holder, HeapObject::kMapOffset));
LoadInstanceDescriptors(dst, dst);
Ldr(dst,
FieldMemOperand(dst, DescriptorArray::GetValueOffset(accessor_index)));
int offset = accessor == ACCESSOR_GETTER ? AccessorPair::kGetterOffset
: AccessorPair::kSetterOffset;
Ldr(dst, FieldMemOperand(dst, offset));
}
void MacroAssembler::CheckEnumCache(Register object,
Register null_value,
Register scratch0,
......
......@@ -881,6 +881,8 @@ class MacroAssembler : public Assembler {
void EnumLengthUntagged(Register dst, Register map);
void EnumLengthSmi(Register dst, Register map);
void NumberOfOwnDescriptors(Register dst, Register map);
void LoadAccessor(Register dst, Register holder, int accessor_index,
AccessorComponent accessor);
template<typename Field>
void DecodeField(Register dst, Register src) {
......
......@@ -2671,6 +2671,18 @@ void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) {
}
void MacroAssembler::LoadAccessor(Register dst, Register holder,
int accessor_index,
AccessorComponent accessor) {
mov(dst, FieldOperand(holder, HeapObject::kMapOffset));
LoadInstanceDescriptors(dst, dst);
mov(dst, FieldOperand(dst, DescriptorArray::GetValueOffset(accessor_index)));
int offset = accessor == ACCESSOR_GETTER ? AccessorPair::kGetterOffset
: AccessorPair::kSetterOffset;
mov(dst, FieldOperand(dst, offset));
}
void MacroAssembler::LoadPowerOf2(XMMRegister dst,
Register scratch,
int power) {
......
......@@ -517,6 +517,8 @@ class MacroAssembler: public Assembler {
void LoadInstanceDescriptors(Register map, Register descriptors);
void EnumLength(Register dst, Register map);
void NumberOfOwnDescriptors(Register dst, Register map);
void LoadAccessor(Register dst, Register holder, int accessor_index,
AccessorComponent accessor);
template<typename Field>
void DecodeField(Register reg) {
......
......@@ -37,12 +37,7 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
__ push(receiver);
ParameterCount actual(0);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ ldr(scratch, FieldMemOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ ldr(scratch, FieldMemOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ ldr(r1, FieldMemOperand(scratch, AccessorPair::kGetterOffset));
__ LoadAccessor(r1, holder, accessor_index, ACCESSOR_GETTER);
__ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
......@@ -79,12 +74,7 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ Push(receiver, value());
ParameterCount actual(1);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ ldr(scratch, FieldMemOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ ldr(scratch, FieldMemOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ ldr(r1, FieldMemOperand(scratch, AccessorPair::kSetterOffset));
__ LoadAccessor(r1, holder, accessor_index, ACCESSOR_SETTER);
__ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
......
......@@ -243,12 +243,7 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ Push(receiver, value());
ParameterCount actual(1);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ Ldr(scratch, FieldMemOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ Ldr(scratch, FieldMemOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ Ldr(x1, FieldMemOperand(scratch, AccessorPair::kSetterOffset));
__ LoadAccessor(x1, holder, accessor_index, ACCESSOR_SETTER);
__ InvokeFunction(x1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
......@@ -282,12 +277,7 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
__ Push(receiver);
ParameterCount actual(0);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ Ldr(scratch, FieldMemOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ Ldr(scratch, FieldMemOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ Ldr(x1, FieldMemOperand(scratch, AccessorPair::kGetterOffset));
__ LoadAccessor(x1, holder, accessor_index, ACCESSOR_GETTER);
__ InvokeFunction(x1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
......
......@@ -32,12 +32,7 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
__ push(receiver);
ParameterCount actual(0);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ mov(scratch, FieldOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ mov(scratch, FieldOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ mov(edi, FieldOperand(scratch, AccessorPair::kGetterOffset));
__ LoadAccessor(edi, holder, accessor_index, ACCESSOR_GETTER);
__ InvokeFunction(edi, expected, actual, CALL_FUNCTION,
NullCallWrapper());
} else {
......@@ -257,12 +252,7 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ push(value());
ParameterCount actual(1);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ mov(scratch, FieldOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ mov(scratch, FieldOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ mov(edi, FieldOperand(scratch, AccessorPair::kSetterOffset));
__ LoadAccessor(edi, holder, accessor_index, ACCESSOR_SETTER);
__ InvokeFunction(edi, expected, actual, CALL_FUNCTION,
NullCallWrapper());
} else {
......
......@@ -37,12 +37,7 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
__ push(receiver);
ParameterCount actual(0);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ lw(scratch, FieldMemOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ lw(scratch, FieldMemOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ lw(a1, FieldMemOperand(scratch, AccessorPair::kGetterOffset));
__ LoadAccessor(a1, holder, accessor_index, ACCESSOR_GETTER);
__ InvokeFunction(a1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
......@@ -79,12 +74,7 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ Push(receiver, value());
ParameterCount actual(1);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ lw(scratch, FieldMemOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ lw(scratch, FieldMemOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ lw(a1, FieldMemOperand(scratch, AccessorPair::kSetterOffset));
__ LoadAccessor(a1, holder, accessor_index, ACCESSOR_SETTER);
__ InvokeFunction(a1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
......
......@@ -37,12 +37,7 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
__ push(receiver);
ParameterCount actual(0);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ ld(scratch, FieldMemOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ ld(scratch, FieldMemOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ ld(a1, FieldMemOperand(scratch, AccessorPair::kGetterOffset));
__ LoadAccessor(a1, holder, accessor_index, ACCESSOR_GETTER);
__ InvokeFunction(a1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
......@@ -79,12 +74,7 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ Push(receiver, value());
ParameterCount actual(1);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ ld(scratch, FieldMemOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ ld(scratch, FieldMemOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ ld(a1, FieldMemOperand(scratch, AccessorPair::kSetterOffset));
__ LoadAccessor(a1, holder, accessor_index, ACCESSOR_SETTER);
__ InvokeFunction(a1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
......
......@@ -235,12 +235,7 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ Push(value());
ParameterCount actual(1);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ movp(scratch, FieldOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ movp(scratch, FieldOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ movp(rdi, FieldOperand(scratch, AccessorPair::kSetterOffset));
__ LoadAccessor(rdi, holder, accessor_index, ACCESSOR_SETTER);
__ InvokeFunction(rdi, expected, actual, CALL_FUNCTION,
NullCallWrapper());
} else {
......@@ -280,12 +275,7 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
__ Push(receiver);
ParameterCount actual(0);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ movp(scratch, FieldOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ movp(scratch, FieldOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ movp(rdi, FieldOperand(scratch, AccessorPair::kGetterOffset));
__ LoadAccessor(rdi, holder, accessor_index, ACCESSOR_GETTER);
__ InvokeFunction(rdi, expected, actual, CALL_FUNCTION,
NullCallWrapper());
} else {
......
......@@ -32,12 +32,7 @@ void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
__ push(receiver);
ParameterCount actual(0);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ mov(scratch, FieldOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ mov(scratch, FieldOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ mov(edi, FieldOperand(scratch, AccessorPair::kGetterOffset));
__ LoadAccessor(edi, holder, accessor_index, ACCESSOR_GETTER);
__ InvokeFunction(edi, expected, actual, CALL_FUNCTION,
NullCallWrapper());
} else {
......@@ -257,12 +252,7 @@ void NamedStoreHandlerCompiler::GenerateStoreViaSetter(
__ push(value());
ParameterCount actual(1);
ParameterCount expected(expected_arguments);
Register scratch = holder;
__ mov(scratch, FieldOperand(holder, HeapObject::kMapOffset));
__ LoadInstanceDescriptors(scratch, scratch);
__ mov(scratch, FieldOperand(scratch, DescriptorArray::GetValueOffset(
accessor_index)));
__ mov(edi, FieldOperand(scratch, AccessorPair::kSetterOffset));
__ LoadAccessor(edi, holder, accessor_index, ACCESSOR_SETTER);
__ InvokeFunction(edi, expected, actual, CALL_FUNCTION,
NullCallWrapper());
} else {
......
......@@ -5884,6 +5884,19 @@ void MacroAssembler::EnumLength(Register dst, Register map) {
}
void MacroAssembler::LoadAccessor(Register dst, Register holder,
int accessor_index,
AccessorComponent accessor) {
lw(dst, FieldMemOperand(holder, HeapObject::kMapOffset));
LoadInstanceDescriptors(dst, dst);
lw(dst,
FieldMemOperand(dst, DescriptorArray::GetValueOffset(accessor_index)));
int offset = accessor == ACCESSOR_GETTER ? AccessorPair::kGetterOffset
: AccessorPair::kSetterOffset;
lw(dst, FieldMemOperand(dst, offset));
}
void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) {
Register empty_fixed_array_value = t2;
LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex);
......
......@@ -1516,6 +1516,8 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
void LoadInstanceDescriptors(Register map, Register descriptors);
void EnumLength(Register dst, Register map);
void NumberOfOwnDescriptors(Register dst, Register map);
void LoadAccessor(Register dst, Register holder, int accessor_index,
AccessorComponent accessor);
template<typename Field>
void DecodeField(Register dst, Register src) {
......
......@@ -5929,6 +5929,19 @@ void MacroAssembler::EnumLength(Register dst, Register map) {
}
void MacroAssembler::LoadAccessor(Register dst, Register holder,
int accessor_index,
AccessorComponent accessor) {
ld(dst, FieldMemOperand(holder, HeapObject::kMapOffset));
LoadInstanceDescriptors(dst, dst);
ld(dst,
FieldMemOperand(dst, DescriptorArray::GetValueOffset(accessor_index)));
int offset = accessor == ACCESSOR_GETTER ? AccessorPair::kGetterOffset
: AccessorPair::kSetterOffset;
ld(dst, FieldMemOperand(dst, offset));
}
void MacroAssembler::CheckEnumCache(Register null_value, Label* call_runtime) {
Register empty_fixed_array_value = a6;
LoadRoot(empty_fixed_array_value, Heap::kEmptyFixedArrayRootIndex);
......
......@@ -1591,6 +1591,8 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
void LoadInstanceDescriptors(Register map, Register descriptors);
void EnumLength(Register dst, Register map);
void NumberOfOwnDescriptors(Register dst, Register map);
void LoadAccessor(Register dst, Register holder, int accessor_index,
AccessorComponent accessor);
template<typename Field>
void DecodeField(Register dst, Register src) {
......
......@@ -3413,6 +3413,18 @@ void MacroAssembler::EnumLength(Register dst, Register map) {
}
void MacroAssembler::LoadAccessor(Register dst, Register holder,
int accessor_index,
AccessorComponent accessor) {
movp(dst, FieldOperand(holder, HeapObject::kMapOffset));
LoadInstanceDescriptors(dst, dst);
movp(dst, FieldOperand(dst, DescriptorArray::GetValueOffset(accessor_index)));
int offset = accessor == ACCESSOR_GETTER ? AccessorPair::kGetterOffset
: AccessorPair::kSetterOffset;
movp(dst, FieldOperand(dst, offset));
}
void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1,
Register scratch2, Handle<WeakCell> cell,
Handle<Code> success,
......
......@@ -1046,6 +1046,8 @@ class MacroAssembler: public Assembler {
void LoadInstanceDescriptors(Register map, Register descriptors);
void EnumLength(Register dst, Register map);
void NumberOfOwnDescriptors(Register dst, Register map);
void LoadAccessor(Register dst, Register holder, int accessor_index,
AccessorComponent accessor);
template<typename Field>
void DecodeField(Register reg) {
......
......@@ -2617,6 +2617,18 @@ void MacroAssembler::NumberOfOwnDescriptors(Register dst, Register map) {
}
void MacroAssembler::LoadAccessor(Register dst, Register holder,
int accessor_index,
AccessorComponent accessor) {
mov(dst, FieldOperand(holder, HeapObject::kMapOffset));
LoadInstanceDescriptors(dst, dst);
mov(dst, FieldOperand(dst, DescriptorArray::GetValueOffset(accessor_index)));
int offset = accessor == ACCESSOR_GETTER ? AccessorPair::kGetterOffset
: AccessorPair::kSetterOffset;
mov(dst, FieldOperand(dst, offset));
}
void MacroAssembler::LookupNumberStringCache(Register object,
Register result,
Register scratch1,
......
......@@ -485,6 +485,8 @@ class MacroAssembler: public Assembler {
void LoadInstanceDescriptors(Register map, Register descriptors);
void EnumLength(Register dst, Register map);
void NumberOfOwnDescriptors(Register dst, Register map);
void LoadAccessor(Register dst, Register holder, int accessor_index,
AccessorComponent accessor);
template<typename Field>
void DecodeField(Register reg) {
......
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