void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
- Handle<JSFunction> getter) {
+ Register holder, int accessor_index, int expected_arguments) {
// ----------- S t a t e -------------
// -- r0 : receiver
// -- r2 : name
{
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
- if (!getter.is_null()) {
+ if (accessor_index >= 0) {
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
}
__ push(receiver);
ParameterCount actual(0);
- ParameterCount expected(getter);
- __ InvokeFunction(getter, expected, actual, CALL_FUNCTION,
- NullCallWrapper());
+ 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));
+ __ InvokeFunction(r1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
// the place to continue after deoptimization.
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
- Handle<JSFunction> getter) {
+ Register holder, int accessor_index, int expected_arguments) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
- if (!getter.is_null()) {
+ if (accessor_index >= 0) {
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
}
__ Push(receiver);
ParameterCount actual(0);
- ParameterCount expected(getter);
- __ InvokeFunction(getter, expected, actual, CALL_FUNCTION,
- NullCallWrapper());
+ 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));
+ __ InvokeFunction(x1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
// the place to continue after deoptimization.
Handle<Code> NamedLoadHandlerCompiler::CompileLoadViaGetter(
- Handle<Name> name, Handle<JSFunction> getter) {
- Frontend(name);
- GenerateLoadViaGetter(masm(), type(), receiver(), getter);
+ Handle<Name> name, int accessor_index, int expected_arguments) {
+ Register holder = Frontend(name);
+ GenerateLoadViaGetter(masm(), type(), receiver(), holder, accessor_index,
+ expected_arguments);
return GetCode(kind(), Code::FAST, name);
}
// inlined.
Handle<Code> CompileLoadInterceptor(LookupIterator* it);
- Handle<Code> CompileLoadViaGetter(Handle<Name> name,
- Handle<JSFunction> getter);
+ Handle<Code> CompileLoadViaGetter(Handle<Name> name, int accessor_index,
+ int expected_arguments);
Handle<Code> CompileLoadGlobal(Handle<PropertyCell> cell, Handle<Name> name,
bool is_configurable);
Handle<HeapType> type);
static void GenerateLoadViaGetter(MacroAssembler* masm, Handle<HeapType> type,
- Register receiver,
- Handle<JSFunction> getter);
+ Register receiver, Register holder,
+ int accessor_index, int expected_arguments);
static void GenerateLoadViaGetterForDeopt(MacroAssembler* masm) {
- GenerateLoadViaGetter(masm, Handle<HeapType>::null(), no_reg,
- Handle<JSFunction>());
+ GenerateLoadViaGetter(masm, Handle<HeapType>::null(), no_reg, no_reg, -1,
+ -1);
}
static void GenerateLoadFunctionPrototype(MacroAssembler* masm,
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
- Handle<JSFunction> getter) {
+ Register holder, int accessor_index, int expected_arguments) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
- if (!getter.is_null()) {
+ if (accessor_index >= 0) {
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
}
__ push(receiver);
ParameterCount actual(0);
- ParameterCount expected(getter);
- __ InvokeFunction(getter, expected, actual, CALL_FUNCTION,
+ 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));
+ __ InvokeFunction(edi, expected, actual, CALL_FUNCTION,
NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
return compiler.CompileLoadCallback(lookup->name(),
call_optimization);
}
- return compiler.CompileLoadViaGetter(lookup->name(), function);
+ int expected_arguments = function->shared()->formal_parameter_count();
+ return compiler.CompileLoadViaGetter(
+ lookup->name(), lookup->GetAccessorIndex(), expected_arguments);
}
break;
}
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
- Handle<JSFunction> getter) {
+ Register holder, int accessor_index, int expected_arguments) {
// ----------- S t a t e -------------
// -- a0 : receiver
// -- a2 : name
{
FrameScope scope(masm, StackFrame::INTERNAL);
- if (!getter.is_null()) {
+ if (accessor_index >= 0) {
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
}
__ push(receiver);
ParameterCount actual(0);
- ParameterCount expected(getter);
- __ InvokeFunction(getter, expected, actual, CALL_FUNCTION,
- NullCallWrapper());
+ 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));
+ __ InvokeFunction(a1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
// the place to continue after deoptimization.
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
- Handle<JSFunction> getter) {
+ Register holder, int accessor_index, int expected_arguments) {
// ----------- S t a t e -------------
// -- a0 : receiver
// -- a2 : name
{
FrameScope scope(masm, StackFrame::INTERNAL);
- if (!getter.is_null()) {
+ if (accessor_index >= 0) {
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
}
__ push(receiver);
ParameterCount actual(0);
- ParameterCount expected(getter);
- __ InvokeFunction(getter, expected, actual, CALL_FUNCTION,
- NullCallWrapper());
+ 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));
+ __ InvokeFunction(a1, expected, actual, CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
// the place to continue after deoptimization.
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
- Handle<JSFunction> getter) {
+ Register holder, int accessor_index, int expected_arguments) {
// ----------- S t a t e -------------
// -- rax : receiver
// -- rcx : name
{
FrameScope scope(masm, StackFrame::INTERNAL);
- if (!getter.is_null()) {
+ if (accessor_index >= 0) {
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
}
__ Push(receiver);
ParameterCount actual(0);
- ParameterCount expected(getter);
- __ InvokeFunction(getter, expected, actual, CALL_FUNCTION,
+ 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));
+ __ InvokeFunction(rdi, expected, actual, CALL_FUNCTION,
NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
void NamedLoadHandlerCompiler::GenerateLoadViaGetter(
MacroAssembler* masm, Handle<HeapType> type, Register receiver,
- Handle<JSFunction> getter) {
+ Register holder, int accessor_index, int expected_arguments) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
- if (!getter.is_null()) {
+ if (accessor_index >= 0) {
// Call the JavaScript getter with the receiver on the stack.
if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
// Swap in the global receiver.
}
__ push(receiver);
ParameterCount actual(0);
- ParameterCount expected(getter);
- __ InvokeFunction(getter, expected, actual, CALL_FUNCTION,
+ 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));
+ __ InvokeFunction(edi, expected, actual, CALL_FUNCTION,
NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
}
+int LookupIterator::GetAccessorIndex() const {
+ DCHECK(has_property_);
+ DCHECK(!holder_map_->is_dictionary_map());
+ DCHECK_EQ(v8::internal::ACCESSOR_CONSTANT, property_details_.type());
+ return descriptor_number();
+}
+
+
int LookupIterator::GetConstantIndex() const {
DCHECK(has_property_);
DCHECK(!holder_map_->is_dictionary_map());
}
FieldIndex GetFieldIndex() const;
Handle<HeapType> GetFieldType() const;
+ int GetAccessorIndex() const;
int GetConstantIndex() const;
Handle<PropertyCell> GetPropertyCell() const;
Handle<Object> GetAccessors() const;