Load API accessor from descriptor instead of embedding it in handler.
BUG=v8:3629 LOG=N Review URL: https://codereview.chromium.org/880333003 Cr-Commit-Position: refs/heads/master@{#26320}
This commit is contained in:
parent
fca95cf753
commit
6ea31f7eee
@ -241,7 +241,9 @@ static void CompileCallLoadPropertyWithInterceptor(
|
||||
void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
MacroAssembler* masm, const CallOptimization& optimization,
|
||||
Handle<Map> receiver_map, Register receiver, Register scratch_in,
|
||||
bool is_store, Register store_parameter) {
|
||||
bool is_store, Register store_parameter, Register accessor_holder,
|
||||
int accessor_index) {
|
||||
DCHECK(!accessor_holder.is(scratch_in));
|
||||
DCHECK(!receiver.is(scratch_in));
|
||||
__ push(receiver);
|
||||
// Write the arguments to stack frame.
|
||||
@ -258,6 +260,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
Register holder = r2;
|
||||
Register api_function_address = r1;
|
||||
|
||||
// Put callee in place.
|
||||
__ LoadAccessor(callee, accessor_holder, accessor_index,
|
||||
is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
|
||||
|
||||
// Put holder in place.
|
||||
CallOptimization::HolderLookup holder_lookup;
|
||||
Handle<JSObject> api_holder =
|
||||
@ -275,13 +281,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
}
|
||||
|
||||
Isolate* isolate = masm->isolate();
|
||||
Handle<JSFunction> function = optimization.constant_function();
|
||||
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
||||
Handle<Object> call_data_obj(api_call_info->data(), isolate);
|
||||
|
||||
// Put callee in place.
|
||||
__ Move(callee, function);
|
||||
|
||||
bool call_data_undefined = false;
|
||||
// Put call_data in place.
|
||||
if (isolate->heap()->InNewSpace(*call_data_obj)) {
|
||||
|
@ -149,7 +149,9 @@ static void CompileCallLoadPropertyWithInterceptor(
|
||||
void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
MacroAssembler* masm, const CallOptimization& optimization,
|
||||
Handle<Map> receiver_map, Register receiver, Register scratch,
|
||||
bool is_store, Register store_parameter) {
|
||||
bool is_store, Register store_parameter, Register accessor_holder,
|
||||
int accessor_index) {
|
||||
DCHECK(!AreAliased(accessor_holder, scratch));
|
||||
DCHECK(!AreAliased(receiver, scratch));
|
||||
|
||||
MacroAssembler::PushPopQueue queue(masm);
|
||||
@ -170,6 +172,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
Register holder = x2;
|
||||
Register api_function_address = x1;
|
||||
|
||||
// Put callee in place.
|
||||
__ LoadAccessor(callee, accessor_holder, accessor_index,
|
||||
is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
|
||||
|
||||
// Put holder in place.
|
||||
CallOptimization::HolderLookup holder_lookup;
|
||||
Handle<JSObject> api_holder =
|
||||
@ -187,13 +193,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
}
|
||||
|
||||
Isolate* isolate = masm->isolate();
|
||||
Handle<JSFunction> function = optimization.constant_function();
|
||||
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
||||
Handle<Object> call_data_obj(api_call_info->data(), isolate);
|
||||
|
||||
// Put callee in place.
|
||||
__ LoadObject(callee, function);
|
||||
|
||||
bool call_data_undefined = false;
|
||||
// Put call_data in place.
|
||||
if (isolate->heap()->InNewSpace(*call_data_obj)) {
|
||||
|
@ -229,12 +229,13 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback(
|
||||
|
||||
|
||||
Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback(
|
||||
Handle<Name> name, const CallOptimization& call_optimization) {
|
||||
Handle<Name> name, const CallOptimization& call_optimization,
|
||||
int accessor_index) {
|
||||
DCHECK(call_optimization.is_simple_api_call());
|
||||
Frontend(name);
|
||||
Register holder = Frontend(name);
|
||||
Handle<Map> receiver_map = IC::TypeToMap(*type(), isolate());
|
||||
GenerateApiAccessorCall(masm(), call_optimization, receiver_map, receiver(),
|
||||
scratch1(), false, no_reg);
|
||||
scratch2(), false, no_reg, holder, accessor_index);
|
||||
return GetCode(kind(), Code::FAST, name);
|
||||
}
|
||||
|
||||
@ -454,10 +455,11 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreViaSetter(
|
||||
|
||||
Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
|
||||
Handle<JSObject> object, Handle<Name> name,
|
||||
const CallOptimization& call_optimization) {
|
||||
Frontend(name);
|
||||
const CallOptimization& call_optimization, int accessor_index) {
|
||||
Register holder = Frontend(name);
|
||||
GenerateApiAccessorCall(masm(), call_optimization, handle(object->map()),
|
||||
receiver(), scratch1(), true, value());
|
||||
receiver(), scratch2(), true, value(), holder,
|
||||
accessor_index);
|
||||
return GetCode(kind(), Code::FAST, name);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,9 @@ class PropertyHandlerCompiler : public PropertyAccessCompiler {
|
||||
const CallOptimization& optimization,
|
||||
Handle<Map> receiver_map,
|
||||
Register receiver, Register scratch,
|
||||
bool is_store, Register store_parameter);
|
||||
bool is_store, Register store_parameter,
|
||||
Register accessor_holder,
|
||||
int accessor_index);
|
||||
|
||||
// Helper function used to check that the dictionary doesn't contain
|
||||
// the property. This function may return false negatives, so miss_label
|
||||
@ -124,7 +126,8 @@ class NamedLoadHandlerCompiler : public PropertyHandlerCompiler {
|
||||
Handle<ExecutableAccessorInfo> callback);
|
||||
|
||||
Handle<Code> CompileLoadCallback(Handle<Name> name,
|
||||
const CallOptimization& call_optimization);
|
||||
const CallOptimization& call_optimization,
|
||||
int accessor_index);
|
||||
|
||||
Handle<Code> CompileLoadConstant(Handle<Name> name, int constant_index);
|
||||
|
||||
@ -224,7 +227,8 @@ class NamedStoreHandlerCompiler : public PropertyHandlerCompiler {
|
||||
Handle<Code> CompileStoreCallback(Handle<JSObject> object, Handle<Name> name,
|
||||
Handle<ExecutableAccessorInfo> callback);
|
||||
Handle<Code> CompileStoreCallback(Handle<JSObject> object, Handle<Name> name,
|
||||
const CallOptimization& call_optimization);
|
||||
const CallOptimization& call_optimization,
|
||||
int accessor_index);
|
||||
Handle<Code> CompileStoreViaSetter(Handle<JSObject> object, Handle<Name> name,
|
||||
int accessor_index,
|
||||
int expected_arguments);
|
||||
|
@ -145,7 +145,9 @@ void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(
|
||||
void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
MacroAssembler* masm, const CallOptimization& optimization,
|
||||
Handle<Map> receiver_map, Register receiver, Register scratch_in,
|
||||
bool is_store, Register store_parameter) {
|
||||
bool is_store, Register store_parameter, Register accessor_holder,
|
||||
int accessor_index) {
|
||||
DCHECK(!accessor_holder.is(scratch_in));
|
||||
// Copy return value.
|
||||
__ pop(scratch_in);
|
||||
// receiver
|
||||
@ -167,6 +169,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
Register api_function_address = edx;
|
||||
Register scratch = eax; // scratch_in is no longer valid.
|
||||
|
||||
// Put callee in place.
|
||||
__ LoadAccessor(callee, accessor_holder, accessor_index,
|
||||
is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
|
||||
|
||||
// Put holder in place.
|
||||
CallOptimization::HolderLookup holder_lookup;
|
||||
Handle<JSObject> api_holder =
|
||||
@ -184,12 +190,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
}
|
||||
|
||||
Isolate* isolate = masm->isolate();
|
||||
Handle<JSFunction> function = optimization.constant_function();
|
||||
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
||||
Handle<Object> call_data_obj(api_call_info->data(), isolate);
|
||||
|
||||
// Put callee in place.
|
||||
__ LoadHeapObject(callee, function);
|
||||
|
||||
bool call_data_undefined = false;
|
||||
// Put call_data in place.
|
||||
|
@ -1237,8 +1237,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
|
||||
cache_holder);
|
||||
if (call_optimization.is_simple_api_call() &&
|
||||
call_optimization.IsCompatibleReceiver(receiver, holder)) {
|
||||
return compiler.CompileLoadCallback(lookup->name(),
|
||||
call_optimization);
|
||||
return compiler.CompileLoadCallback(lookup->name(), call_optimization,
|
||||
lookup->GetAccessorIndex());
|
||||
}
|
||||
int expected_arguments = function->shared()->formal_parameter_count();
|
||||
return compiler.CompileLoadViaGetter(
|
||||
@ -1741,7 +1741,8 @@ Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup,
|
||||
if (call_optimization.is_simple_api_call() &&
|
||||
call_optimization.IsCompatibleReceiver(receiver, holder)) {
|
||||
return compiler.CompileStoreCallback(receiver, lookup->name(),
|
||||
call_optimization);
|
||||
call_optimization,
|
||||
lookup->GetAccessorIndex());
|
||||
}
|
||||
int expected_arguments = function->shared()->formal_parameter_count();
|
||||
return compiler.CompileStoreViaSetter(receiver, lookup->name(),
|
||||
|
@ -234,7 +234,9 @@ static void CompileCallLoadPropertyWithInterceptor(
|
||||
void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
MacroAssembler* masm, const CallOptimization& optimization,
|
||||
Handle<Map> receiver_map, Register receiver, Register scratch_in,
|
||||
bool is_store, Register store_parameter) {
|
||||
bool is_store, Register store_parameter, Register accessor_holder,
|
||||
int accessor_index) {
|
||||
DCHECK(!accessor_holder.is(scratch_in));
|
||||
DCHECK(!receiver.is(scratch_in));
|
||||
__ push(receiver);
|
||||
// Write the arguments to stack frame.
|
||||
@ -251,6 +253,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
Register holder = a2;
|
||||
Register api_function_address = a1;
|
||||
|
||||
// Put callee in place.
|
||||
__ LoadAccessor(callee, holder, accessor_index,
|
||||
is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
|
||||
|
||||
// Put holder in place.
|
||||
CallOptimization::HolderLookup holder_lookup;
|
||||
Handle<JSObject> api_holder =
|
||||
@ -268,13 +274,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
}
|
||||
|
||||
Isolate* isolate = masm->isolate();
|
||||
Handle<JSFunction> function = optimization.constant_function();
|
||||
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
||||
Handle<Object> call_data_obj(api_call_info->data(), isolate);
|
||||
|
||||
// Put callee in place.
|
||||
__ li(callee, function);
|
||||
|
||||
bool call_data_undefined = false;
|
||||
// Put call_data in place.
|
||||
if (isolate->heap()->InNewSpace(*call_data_obj)) {
|
||||
|
@ -235,7 +235,9 @@ static void CompileCallLoadPropertyWithInterceptor(
|
||||
void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
MacroAssembler* masm, const CallOptimization& optimization,
|
||||
Handle<Map> receiver_map, Register receiver, Register scratch_in,
|
||||
bool is_store, Register store_parameter) {
|
||||
bool is_store, Register store_parameter, Register accessor_holder,
|
||||
int accessor_index) {
|
||||
DCHECK(!accessor_holder.is(scratch_in));
|
||||
DCHECK(!receiver.is(scratch_in));
|
||||
__ push(receiver);
|
||||
// Write the arguments to stack frame.
|
||||
@ -252,6 +254,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
Register holder = a2;
|
||||
Register api_function_address = a1;
|
||||
|
||||
// Put callee in place.
|
||||
__ LoadAccessor(callee, holder, accessor_index,
|
||||
is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
|
||||
|
||||
// Put holder in place.
|
||||
CallOptimization::HolderLookup holder_lookup;
|
||||
Handle<JSObject> api_holder =
|
||||
@ -269,13 +275,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
}
|
||||
|
||||
Isolate* isolate = masm->isolate();
|
||||
Handle<JSFunction> function = optimization.constant_function();
|
||||
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
||||
Handle<Object> call_data_obj(api_call_info->data(), isolate);
|
||||
|
||||
// Put callee in place.
|
||||
__ li(callee, function);
|
||||
|
||||
bool call_data_undefined = false;
|
||||
// Put call_data in place.
|
||||
if (isolate->heap()->InNewSpace(*call_data_obj)) {
|
||||
|
@ -131,7 +131,9 @@ static void CompileCallLoadPropertyWithInterceptor(
|
||||
void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
MacroAssembler* masm, const CallOptimization& optimization,
|
||||
Handle<Map> receiver_map, Register receiver, Register scratch_in,
|
||||
bool is_store, Register store_parameter) {
|
||||
bool is_store, Register store_parameter, Register accessor_holder,
|
||||
int accessor_index) {
|
||||
DCHECK(!accessor_holder.is(scratch_in));
|
||||
DCHECK(optimization.is_simple_api_call());
|
||||
|
||||
__ PopReturnAddressTo(scratch_in);
|
||||
@ -153,6 +155,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
Register api_function_address = rdx;
|
||||
Register scratch = rax; // scratch_in is no longer valid.
|
||||
|
||||
// Put callee in place.
|
||||
__ LoadAccessor(callee, accessor_holder, accessor_index,
|
||||
is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
|
||||
|
||||
// Put holder in place.
|
||||
CallOptimization::HolderLookup holder_lookup;
|
||||
Handle<JSObject> api_holder =
|
||||
@ -170,13 +176,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
}
|
||||
|
||||
Isolate* isolate = masm->isolate();
|
||||
Handle<JSFunction> function = optimization.constant_function();
|
||||
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
||||
Handle<Object> call_data_obj(api_call_info->data(), isolate);
|
||||
|
||||
// Put callee in place.
|
||||
__ Move(callee, function);
|
||||
|
||||
bool call_data_undefined = false;
|
||||
// Put call_data in place.
|
||||
if (isolate->heap()->InNewSpace(*call_data_obj)) {
|
||||
|
@ -145,7 +145,9 @@ void NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(
|
||||
void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
MacroAssembler* masm, const CallOptimization& optimization,
|
||||
Handle<Map> receiver_map, Register receiver, Register scratch_in,
|
||||
bool is_store, Register store_parameter) {
|
||||
bool is_store, Register store_parameter, Register accessor_holder,
|
||||
int accessor_index) {
|
||||
DCHECK(!accessor_holder.is(scratch_in));
|
||||
// Copy return value.
|
||||
__ pop(scratch_in);
|
||||
// receiver
|
||||
@ -167,6 +169,10 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
Register api_function_address = edx;
|
||||
Register scratch = edi; // scratch_in is no longer valid.
|
||||
|
||||
// Put callee in place.
|
||||
__ LoadAccessor(callee, accessor_holder, accessor_index,
|
||||
is_store ? ACCESSOR_SETTER : ACCESSOR_GETTER);
|
||||
|
||||
// Put holder in place.
|
||||
CallOptimization::HolderLookup holder_lookup;
|
||||
Handle<JSObject> api_holder =
|
||||
@ -184,13 +190,9 @@ void PropertyHandlerCompiler::GenerateApiAccessorCall(
|
||||
}
|
||||
|
||||
Isolate* isolate = masm->isolate();
|
||||
Handle<JSFunction> function = optimization.constant_function();
|
||||
Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
|
||||
Handle<Object> call_data_obj(api_call_info->data(), isolate);
|
||||
|
||||
// Put callee in place.
|
||||
__ LoadHeapObject(callee, function);
|
||||
|
||||
bool call_data_undefined = false;
|
||||
// Put call_data in place.
|
||||
if (isolate->heap()->InNewSpace(*call_data_obj)) {
|
||||
|
Loading…
Reference in New Issue
Block a user