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