Commit 23866a6f authored by ulan's avatar ulan Committed by Commit bot

Load API call data from function instead of embedding it in handler.

BUG=v8:3629
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#26326}
parent 60bd272f
......@@ -256,7 +256,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
// Abi for CallApiFunctionStub.
Register callee = r0;
Register call_data = r4;
Register data = r4;
Register holder = r2;
Register api_function_address = r1;
......@@ -282,18 +282,18 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
Isolate* isolate = masm->isolate();
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
Handle<Object> call_data_obj(api_call_info->data(), isolate);
bool call_data_undefined = false;
// Put call_data in place.
if (isolate->heap()->InNewSpace(*call_data_obj)) {
__ Move(call_data, api_call_info);
__ ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset));
} else if (call_data_obj->IsUndefined()) {
// Put call data in place.
if (api_call_info->data()->IsUndefined()) {
call_data_undefined = true;
__ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
__ LoadRoot(data, Heap::kUndefinedValueRootIndex);
} else {
__ Move(call_data, call_data_obj);
__ ldr(data,
FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset));
__ ldr(data,
FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset));
__ ldr(data, FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset));
__ ldr(data, FieldMemOperand(data, CallHandlerInfo::kDataOffset));
}
// Put api_function_address in place.
......
......@@ -168,7 +168,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
// Abi for CallApiFunctionStub.
Register callee = x0;
Register call_data = x4;
Register data = x4;
Register holder = x2;
Register api_function_address = x1;
......@@ -194,18 +194,18 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
Isolate* isolate = masm->isolate();
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
Handle<Object> call_data_obj(api_call_info->data(), isolate);
bool call_data_undefined = false;
// Put call_data in place.
if (isolate->heap()->InNewSpace(*call_data_obj)) {
__ LoadObject(call_data, api_call_info);
__ Ldr(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset));
} else if (call_data_obj->IsUndefined()) {
// Put call data in place.
if (api_call_info->data()->IsUndefined()) {
call_data_undefined = true;
__ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
__ LoadRoot(data, Heap::kUndefinedValueRootIndex);
} else {
__ LoadObject(call_data, call_data_obj);
__ Ldr(data,
FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset));
__ Ldr(data,
FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset));
__ Ldr(data, FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset));
__ Ldr(data, FieldMemOperand(data, CallHandlerInfo::kDataOffset));
}
// Put api_function_address in place.
......
......@@ -144,30 +144,30 @@ void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(
// when api call ICs are generated in hydrogen.
void PropertyHandlerCompiler::GenerateApiAccessorCall(
MacroAssembler* masm, const CallOptimization& optimization,
Handle<Map> receiver_map, Register receiver, Register scratch_in,
Handle<Map> receiver_map, Register receiver, Register scratch,
bool is_store, Register store_parameter, Register accessor_holder,
int accessor_index) {
DCHECK(!accessor_holder.is(scratch_in));
DCHECK(!accessor_holder.is(scratch));
// Copy return value.
__ pop(scratch_in);
__ pop(scratch);
// receiver
__ push(receiver);
// Write the arguments to stack frame.
if (is_store) {
DCHECK(!receiver.is(store_parameter));
DCHECK(!scratch_in.is(store_parameter));
DCHECK(!scratch.is(store_parameter));
__ push(store_parameter);
}
__ push(scratch_in);
__ push(scratch);
// Stack now matches JSFunction abi.
DCHECK(optimization.is_simple_api_call());
// Abi for CallApiFunctionStub.
Register callee = edi;
Register call_data = ebx;
Register data = ebx;
Register holder = ecx;
Register api_function_address = edx;
Register scratch = eax; // scratch_in is no longer valid.
scratch = no_reg;
// Put callee in place.
__ LoadAccessor(callee, accessor_holder, accessor_index,
......@@ -191,19 +191,16 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
Isolate* isolate = masm->isolate();
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
Handle<Object> call_data_obj(api_call_info->data(), isolate);
bool call_data_undefined = false;
// Put call_data in place.
if (isolate->heap()->InNewSpace(*call_data_obj)) {
__ mov(scratch, api_call_info);
__ mov(call_data, FieldOperand(scratch, CallHandlerInfo::kDataOffset));
} else if (call_data_obj->IsUndefined()) {
// Put call data in place.
if (api_call_info->data()->IsUndefined()) {
call_data_undefined = true;
__ mov(call_data, Immediate(isolate->factory()->undefined_value()));
__ mov(data, Immediate(isolate->factory()->undefined_value()));
} else {
__ mov(call_data, call_data_obj);
__ mov(data, FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset));
__ mov(data, FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset));
__ mov(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset));
__ mov(data, FieldOperand(data, CallHandlerInfo::kDataOffset));
}
// Put api_function_address in place.
......
......@@ -249,7 +249,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
// Abi for CallApiFunctionStub.
Register callee = a0;
Register call_data = t0;
Register data = t0;
Register holder = a2;
Register api_function_address = a1;
......@@ -275,18 +275,16 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
Isolate* isolate = masm->isolate();
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
Handle<Object> call_data_obj(api_call_info->data(), isolate);
bool call_data_undefined = false;
// Put call_data in place.
if (isolate->heap()->InNewSpace(*call_data_obj)) {
__ li(call_data, api_call_info);
__ lw(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset));
} else if (call_data_obj->IsUndefined()) {
// Put call data in place.
if (api_call_info->data()->IsUndefined()) {
call_data_undefined = true;
__ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
__ LoadRoot(data, Heap::kUndefinedValueRootIndex);
} else {
__ li(call_data, call_data_obj);
__ lw(data, FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset));
__ lw(data, FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset));
__ lw(data, FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset));
__ lw(data, FieldMemOperand(data, CallHandlerInfo::kDataOffset));
}
// Put api_function_address in place.
Address function_address = v8::ToCData<Address>(api_call_info->callback());
......
......@@ -250,7 +250,7 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
// Abi for CallApiFunctionStub.
Register callee = a0;
Register call_data = a4;
Register data = a4;
Register holder = a2;
Register api_function_address = a1;
......@@ -276,18 +276,16 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
Isolate* isolate = masm->isolate();
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
Handle<Object> call_data_obj(api_call_info->data(), isolate);
bool call_data_undefined = false;
// Put call_data in place.
if (isolate->heap()->InNewSpace(*call_data_obj)) {
__ li(call_data, api_call_info);
__ ld(call_data, FieldMemOperand(call_data, CallHandlerInfo::kDataOffset));
} else if (call_data_obj->IsUndefined()) {
// Put call data in place.
if (api_call_info->data()->IsUndefined()) {
call_data_undefined = true;
__ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
__ LoadRoot(data, Heap::kUndefinedValueRootIndex);
} else {
__ li(call_data, call_data_obj);
__ ld(data, FieldMemOperand(callee, JSFunction::kSharedFunctionInfoOffset));
__ ld(data, FieldMemOperand(data, SharedFunctionInfo::kFunctionDataOffset));
__ ld(data, FieldMemOperand(data, FunctionTemplateInfo::kCallCodeOffset));
__ ld(data, FieldMemOperand(data, CallHandlerInfo::kDataOffset));
}
// Put api_function_address in place.
Address function_address = v8::ToCData<Address>(api_call_info->callback());
......
......@@ -130,30 +130,30 @@ static void CompileCallLoadPropertyWithInterceptor(
// Generate call to api function.
void PropertyHandlerCompiler::GenerateApiAccessorCall(
MacroAssembler* masm, const CallOptimization& optimization,
Handle<Map> receiver_map, Register receiver, Register scratch_in,
Handle<Map> receiver_map, Register receiver, Register scratch,
bool is_store, Register store_parameter, Register accessor_holder,
int accessor_index) {
DCHECK(!accessor_holder.is(scratch_in));
DCHECK(!accessor_holder.is(scratch));
DCHECK(optimization.is_simple_api_call());
__ PopReturnAddressTo(scratch_in);
__ PopReturnAddressTo(scratch);
// receiver
__ Push(receiver);
// Write the arguments to stack frame.
if (is_store) {
DCHECK(!receiver.is(store_parameter));
DCHECK(!scratch_in.is(store_parameter));
DCHECK(!scratch.is(store_parameter));
__ Push(store_parameter);
}
__ PushReturnAddressFrom(scratch_in);
__ PushReturnAddressFrom(scratch);
// Stack now matches JSFunction abi.
// Abi for CallApiFunctionStub.
Register callee = rdi;
Register call_data = rbx;
Register data = rbx;
Register holder = rcx;
Register api_function_address = rdx;
Register scratch = rax; // scratch_in is no longer valid.
scratch = no_reg;
// Put callee in place.
__ LoadAccessor(callee, accessor_holder, accessor_index,
......@@ -177,18 +177,16 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
Isolate* isolate = masm->isolate();
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
Handle<Object> call_data_obj(api_call_info->data(), isolate);
bool call_data_undefined = false;
// Put call_data in place.
if (isolate->heap()->InNewSpace(*call_data_obj)) {
__ Move(scratch, api_call_info);
__ movp(call_data, FieldOperand(scratch, CallHandlerInfo::kDataOffset));
} else if (call_data_obj->IsUndefined()) {
// Put call data in place.
if (api_call_info->data()->IsUndefined()) {
call_data_undefined = true;
__ LoadRoot(call_data, Heap::kUndefinedValueRootIndex);
__ LoadRoot(data, Heap::kUndefinedValueRootIndex);
} else {
__ Move(call_data, call_data_obj);
__ movp(data, FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset));
__ movp(data, FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset));
__ movp(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset));
__ movp(data, FieldOperand(data, CallHandlerInfo::kDataOffset));
}
// Put api_function_address in place.
......
......@@ -144,30 +144,30 @@ void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(
// when api call ICs are generated in hydrogen.
void PropertyHandlerCompiler::GenerateApiAccessorCall(
MacroAssembler* masm, const CallOptimization& optimization,
Handle<Map> receiver_map, Register receiver, Register scratch_in,
Handle<Map> receiver_map, Register receiver, Register scratch,
bool is_store, Register store_parameter, Register accessor_holder,
int accessor_index) {
DCHECK(!accessor_holder.is(scratch_in));
DCHECK(!accessor_holder.is(scratch));
// Copy return value.
__ pop(scratch_in);
__ pop(scratch);
// receiver
__ push(receiver);
// Write the arguments to stack frame.
if (is_store) {
DCHECK(!receiver.is(store_parameter));
DCHECK(!scratch_in.is(store_parameter));
DCHECK(!scratch.is(store_parameter));
__ push(store_parameter);
}
__ push(scratch_in);
__ push(scratch);
// Stack now matches JSFunction abi.
DCHECK(optimization.is_simple_api_call());
// Abi for CallApiFunctionStub.
Register callee = eax;
Register call_data = ebx;
Register data = ebx;
Register holder = ecx;
Register api_function_address = edx;
Register scratch = edi; // scratch_in is no longer valid.
scratch = no_reg;
// Put callee in place.
__ LoadAccessor(callee, accessor_holder, accessor_index,
......@@ -191,18 +191,16 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
Isolate* isolate = masm->isolate();
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
Handle<Object> call_data_obj(api_call_info->data(), isolate);
bool call_data_undefined = false;
// Put call_data in place.
if (isolate->heap()->InNewSpace(*call_data_obj)) {
__ mov(scratch, api_call_info);
__ mov(call_data, FieldOperand(scratch, CallHandlerInfo::kDataOffset));
} else if (call_data_obj->IsUndefined()) {
// Put call data in place.
if (api_call_info->data()->IsUndefined()) {
call_data_undefined = true;
__ mov(call_data, Immediate(isolate->factory()->undefined_value()));
__ mov(data, Immediate(isolate->factory()->undefined_value()));
} else {
__ mov(call_data, call_data_obj);
__ mov(data, FieldOperand(callee, JSFunction::kSharedFunctionInfoOffset));
__ mov(data, FieldOperand(data, SharedFunctionInfo::kFunctionDataOffset));
__ mov(data, FieldOperand(data, FunctionTemplateInfo::kCallCodeOffset));
__ mov(data, FieldOperand(data, CallHandlerInfo::kDataOffset));
}
// Put api_function_address in place.
......
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