Commit 5a2de1fc authored by verwaest@chromium.org's avatar verwaest@chromium.org

Remove special frontend for callbacks with slow-mode holders.

BUG=
R=ishell@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22856 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ecec3015
......@@ -838,50 +838,6 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
}
Register NamedLoadHandlerCompiler::CallbackFrontend(Register object_reg,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
Register reg = FrontendHeader(object_reg, name, &miss);
if (!holder()->HasFastProperties()) {
DCHECK(!holder()->IsGlobalObject());
DCHECK(!reg.is(scratch2()));
DCHECK(!reg.is(scratch3()));
DCHECK(!reg.is(scratch4()));
// Load the properties dictionary.
Register dictionary = scratch4();
__ ldr(dictionary, FieldMemOperand(reg, JSObject::kPropertiesOffset));
// Probe the dictionary.
Label probe_done;
NameDictionaryLookupStub::GeneratePositiveLookup(masm(),
&miss,
&probe_done,
dictionary,
this->name(),
scratch2(),
scratch3());
__ bind(&probe_done);
// If probing finds an entry in the dictionary, scratch3 contains the
// pointer into the dictionary. Check that the value is the callback.
Register pointer = scratch3();
const int kElementsStartOffset = NameDictionary::kHeaderSize +
NameDictionary::kElementsStartIndex * kPointerSize;
const int kValueOffset = kElementsStartOffset + kPointerSize;
__ ldr(scratch2(), FieldMemOperand(pointer, kValueOffset));
__ cmp(scratch2(), Operand(callback));
__ b(ne, &miss);
}
FrontendFooter(name, &miss);
return reg;
}
void NamedLoadHandlerCompiler::GenerateLoadField(
Register reg, FieldIndex field, Representation representation) {
if (!reg.is(receiver())) __ mov(receiver(), reg);
......
......@@ -794,51 +794,6 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
}
Register NamedLoadHandlerCompiler::CallbackFrontend(Register object_reg,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
Register reg = FrontendHeader(object_reg, name, &miss);
// FrontendHeader can return its result into scratch1() so do not
// use it.
Register scratch2 = this->scratch2();
Register scratch3 = this->scratch3();
Register dictionary = this->scratch4();
DCHECK(!AreAliased(reg, scratch2, scratch3, dictionary));
if (!holder()->HasFastProperties()) {
DCHECK(!holder()->IsGlobalObject());
// Load the properties dictionary.
__ Ldr(dictionary, FieldMemOperand(reg, JSObject::kPropertiesOffset));
// Probe the dictionary.
Label probe_done;
NameDictionaryLookupStub::GeneratePositiveLookup(masm(),
&miss,
&probe_done,
dictionary,
this->name(),
scratch2,
scratch3);
__ Bind(&probe_done);
// If probing finds an entry in the dictionary, scratch3 contains the
// pointer into the dictionary. Check that the value is the callback.
Register pointer = scratch3;
const int kElementsStartOffset = NameDictionary::kHeaderSize +
NameDictionary::kElementsStartIndex * kPointerSize;
const int kValueOffset = kElementsStartOffset + kPointerSize;
__ Ldr(scratch2, FieldMemOperand(pointer, kValueOffset));
__ Cmp(scratch2, Operand(callback));
__ B(ne, &miss);
}
FrontendFooter(name, &miss);
return reg;
}
void NamedLoadHandlerCompiler::GenerateLoadField(
Register reg, FieldIndex field, Representation representation) {
__ Mov(receiver(), reg);
......
......@@ -807,63 +807,6 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
}
Register NamedLoadHandlerCompiler::CallbackFrontend(Register object_reg,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
Register reg = FrontendHeader(object_reg, name, &miss);
if (!holder()->HasFastProperties()) {
DCHECK(!holder()->IsGlobalObject());
DCHECK(!reg.is(scratch2()));
DCHECK(!reg.is(scratch3()));
Register dictionary = scratch1();
bool must_preserve_dictionary_reg = reg.is(dictionary);
// Load the properties dictionary.
if (must_preserve_dictionary_reg) {
__ push(dictionary);
}
__ mov(dictionary, FieldOperand(reg, JSObject::kPropertiesOffset));
// Probe the dictionary.
Label probe_done, pop_and_miss;
NameDictionaryLookupStub::GeneratePositiveLookup(masm(),
&pop_and_miss,
&probe_done,
dictionary,
this->name(),
scratch2(),
scratch3());
__ bind(&pop_and_miss);
if (must_preserve_dictionary_reg) {
__ pop(dictionary);
}
__ jmp(&miss);
__ bind(&probe_done);
// If probing finds an entry in the dictionary, scratch2 contains the
// index into the dictionary. Check that the value is the callback.
Register index = scratch2();
const int kElementsStartOffset =
NameDictionary::kHeaderSize +
NameDictionary::kElementsStartIndex * kPointerSize;
const int kValueOffset = kElementsStartOffset + kPointerSize;
__ mov(scratch3(),
Operand(dictionary, index, times_4, kValueOffset - kHeapObjectTag));
if (must_preserve_dictionary_reg) {
__ pop(dictionary);
}
__ cmp(scratch3(), callback);
__ j(not_equal, &miss);
}
FrontendFooter(name, &miss);
return reg;
}
void NamedLoadHandlerCompiler::GenerateLoadField(
Register reg, FieldIndex field, Representation representation) {
if (!reg.is(receiver())) __ mov(receiver(), reg);
......
......@@ -1001,14 +1001,13 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
type)) {
return slow_stub();
}
if (holder->IsGlobalObject()) return slow_stub();
if (!holder->HasFastProperties()) return slow_stub();
return compiler.CompileLoadCallback(name, info);
}
if (accessors->IsAccessorPair()) {
Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
isolate());
if (!getter->IsJSFunction()) return slow_stub();
if (holder->IsGlobalObject()) return slow_stub();
if (!holder->HasFastProperties()) return slow_stub();
Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
if (!object->IsJSObject() && !function->IsBuiltin() &&
......
......@@ -837,49 +837,6 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
}
Register NamedLoadHandlerCompiler::CallbackFrontend(Register object_reg,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
Register reg = FrontendHeader(object_reg, name, &miss);
if (!holder()->HasFastProperties()) {
DCHECK(!holder()->IsGlobalObject());
DCHECK(!reg.is(scratch2()));
DCHECK(!reg.is(scratch3()));
DCHECK(!reg.is(scratch4()));
// Load the properties dictionary.
Register dictionary = scratch4();
__ lw(dictionary, FieldMemOperand(reg, JSObject::kPropertiesOffset));
// Probe the dictionary.
Label probe_done;
NameDictionaryLookupStub::GeneratePositiveLookup(masm(),
&miss,
&probe_done,
dictionary,
this->name(),
scratch2(),
scratch3());
__ bind(&probe_done);
// If probing finds an entry in the dictionary, scratch3 contains the
// pointer into the dictionary. Check that the value is the callback.
Register pointer = scratch3();
const int kElementsStartOffset = NameDictionary::kHeaderSize +
NameDictionary::kElementsStartIndex * kPointerSize;
const int kValueOffset = kElementsStartOffset + kPointerSize;
__ lw(scratch2(), FieldMemOperand(pointer, kValueOffset));
__ Branch(&miss, ne, scratch2(), Operand(callback));
}
FrontendFooter(name, &miss);
return reg;
}
void NamedLoadHandlerCompiler::GenerateLoadField(
Register reg, FieldIndex field, Representation representation) {
if (!reg.is(receiver())) __ mov(receiver(), reg);
......
......@@ -841,49 +841,6 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
}
Register NamedLoadHandlerCompiler::CallbackFrontend(Register object_reg,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
Register reg = FrontendHeader(object_reg, name, &miss);
if (!holder()->HasFastProperties()) {
DCHECK(!holder()->IsGlobalObject());
DCHECK(!reg.is(scratch2()));
DCHECK(!reg.is(scratch3()));
DCHECK(!reg.is(scratch4()));
// Load the properties dictionary.
Register dictionary = scratch4();
__ ld(dictionary, FieldMemOperand(reg, JSObject::kPropertiesOffset));
// Probe the dictionary.
Label probe_done;
NameDictionaryLookupStub::GeneratePositiveLookup(masm(),
&miss,
&probe_done,
dictionary,
this->name(),
scratch2(),
scratch3());
__ bind(&probe_done);
// If probing finds an entry in the dictionary, scratch3 contains the
// pointer into the dictionary. Check that the value is the callback.
Register pointer = scratch3();
const int kElementsStartOffset = NameDictionary::kHeaderSize +
NameDictionary::kElementsStartIndex * kPointerSize;
const int kValueOffset = kElementsStartOffset + kPointerSize;
__ ld(scratch2(), FieldMemOperand(pointer, kValueOffset));
__ Branch(&miss, ne, scratch2(), Operand(callback));
}
FrontendFooter(name, &miss);
return reg;
}
void NamedLoadHandlerCompiler::GenerateLoadField(
Register reg, FieldIndex field, Representation representation) {
if (!reg.is(receiver())) __ mov(receiver(), reg);
......
......@@ -870,7 +870,7 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadNonexistent(
Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback(
Handle<Name> name, Handle<ExecutableAccessorInfo> callback) {
Register reg = CallbackFrontend(receiver(), name, callback);
Register reg = Frontend(receiver(), name);
GenerateLoadCallback(reg, callback);
return GetCode(kind(), Code::FAST, name);
}
......@@ -879,8 +879,7 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback(
Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback(
Handle<Name> name, const CallOptimization& call_optimization) {
DCHECK(call_optimization.is_simple_api_call());
Handle<JSFunction> callback = call_optimization.constant_function();
CallbackFrontend(receiver(), name, callback);
Frontend(receiver(), name);
Handle<Map> receiver_map = IC::TypeToMap(*type(), isolate());
GenerateFastApiCall(
masm(), call_optimization, receiver_map,
......@@ -912,26 +911,18 @@ Handle<Code> NamedLoadHandlerCompiler::CompileLoadInterceptor(
void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor(
Register interceptor_reg, Handle<Name> name, LookupResult* lookup) {
Handle<JSObject> real_named_property_holder(lookup->holder());
set_type_for_object(holder());
set_holder(real_named_property_holder);
Register reg = Frontend(interceptor_reg, name);
if (lookup->IsField()) {
FieldIndex field = lookup->GetFieldIndex();
if (holder().is_identical_to(real_named_property_holder)) {
GenerateLoadField(interceptor_reg, field, lookup->representation());
} else {
set_type_for_object(holder());
set_holder(real_named_property_holder);
Register reg = Frontend(interceptor_reg, name);
GenerateLoadField(reg, field, lookup->representation());
}
GenerateLoadField(reg, lookup->GetFieldIndex(), lookup->representation());
} else {
// We found CALLBACKS property in prototype chain of interceptor's holder.
DCHECK(lookup->type() == CALLBACKS);
Handle<ExecutableAccessorInfo> callback(
ExecutableAccessorInfo::cast(lookup->GetCallbackObject()));
DCHECK(callback->getter() != NULL);
set_type_for_object(holder());
set_holder(real_named_property_holder);
Register reg = CallbackFrontend(interceptor_reg, name, callback);
GenerateLoadCallback(reg, callback);
}
}
......
......@@ -518,8 +518,6 @@ class NamedLoadHandlerCompiler : public PropertyHandlerCompiler {
virtual void FrontendFooter(Handle<Name> name, Label* miss);
private:
Register CallbackFrontend(Register object_reg, Handle<Name> name,
Handle<Object> callback);
Handle<Code> CompileLoadNonexistent(Handle<Name> name);
void GenerateLoadField(Register reg,
FieldIndex field,
......
......@@ -748,54 +748,6 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
}
Register NamedLoadHandlerCompiler::CallbackFrontend(Register object_reg,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
Register reg = FrontendHeader(object_reg, name, &miss);
if (!holder()->HasFastProperties()) {
DCHECK(!holder()->IsGlobalObject());
DCHECK(!reg.is(scratch2()));
DCHECK(!reg.is(scratch3()));
DCHECK(!reg.is(scratch4()));
// Load the properties dictionary.
Register dictionary = scratch4();
__ movp(dictionary, FieldOperand(reg, JSObject::kPropertiesOffset));
// Probe the dictionary.
Label probe_done;
NameDictionaryLookupStub::GeneratePositiveLookup(masm(),
&miss,
&probe_done,
dictionary,
this->name(),
scratch2(),
scratch3());
__ bind(&probe_done);
// If probing finds an entry in the dictionary, scratch3 contains the
// index into the dictionary. Check that the value is the callback.
Register index = scratch3();
const int kElementsStartOffset =
NameDictionary::kHeaderSize +
NameDictionary::kElementsStartIndex * kPointerSize;
const int kValueOffset = kElementsStartOffset + kPointerSize;
__ movp(scratch2(),
Operand(dictionary, index, times_pointer_size,
kValueOffset - kHeapObjectTag));
__ Move(scratch3(), callback, RelocInfo::EMBEDDED_OBJECT);
__ cmpp(scratch2(), scratch3());
__ j(not_equal, &miss);
}
FrontendFooter(name, &miss);
return reg;
}
void NamedLoadHandlerCompiler::GenerateLoadField(
Register reg, FieldIndex field, Representation representation) {
if (!reg.is(receiver())) __ movp(receiver(), reg);
......
......@@ -806,63 +806,6 @@ void NamedStoreHandlerCompiler::FrontendFooter(Handle<Name> name, Label* miss) {
}
Register NamedLoadHandlerCompiler::CallbackFrontend(Register object_reg,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
Register reg = FrontendHeader(object_reg, name, &miss);
if (!holder()->HasFastProperties()) {
DCHECK(!holder()->IsGlobalObject());
DCHECK(!reg.is(scratch2()));
DCHECK(!reg.is(scratch3()));
Register dictionary = scratch1();
bool must_preserve_dictionary_reg = reg.is(dictionary);
// Load the properties dictionary.
if (must_preserve_dictionary_reg) {
__ push(dictionary);
}
__ mov(dictionary, FieldOperand(reg, JSObject::kPropertiesOffset));
// Probe the dictionary.
Label probe_done, pop_and_miss;
NameDictionaryLookupStub::GeneratePositiveLookup(masm(),
&pop_and_miss,
&probe_done,
dictionary,
this->name(),
scratch2(),
scratch3());
__ bind(&pop_and_miss);
if (must_preserve_dictionary_reg) {
__ pop(dictionary);
}
__ jmp(&miss);
__ bind(&probe_done);
// If probing finds an entry in the dictionary, scratch2 contains the
// index into the dictionary. Check that the value is the callback.
Register index = scratch2();
const int kElementsStartOffset =
NameDictionary::kHeaderSize +
NameDictionary::kElementsStartIndex * kPointerSize;
const int kValueOffset = kElementsStartOffset + kPointerSize;
__ mov(scratch3(),
Operand(dictionary, index, times_4, kValueOffset - kHeapObjectTag));
if (must_preserve_dictionary_reg) {
__ pop(dictionary);
}
__ cmp(scratch3(), callback);
__ j(not_equal, &miss);
}
FrontendFooter(name, &miss);
return reg;
}
void NamedLoadHandlerCompiler::GenerateLoadField(
Register reg, FieldIndex field, Representation representation) {
if (!reg.is(receiver())) __ mov(receiver(), 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