X87: Use LookupIterator for CompileLoadInterceptor and delete Object::Lookup

port r23168.

original commit message:

 Use LookupIterator for CompileLoadInterceptor and delete Object::Lookup

BUG=
R=weiliang.lin@intel.com

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

Patch from Chunyang Dai <chunyang.dai@intel.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23176 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
weiliang.lin@intel.com 2014-08-19 04:56:54 +00:00
parent 936d7218b4
commit 3170fbb305

View File

@ -778,43 +778,26 @@ void NamedLoadHandlerCompiler::GenerateLoadConstant(Handle<Object> value) {
} }
void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg, void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
LookupResult* lookup, LookupIterator* it, Register holder_reg) {
Handle<Name> name) {
DCHECK(holder()->HasNamedInterceptor()); DCHECK(holder()->HasNamedInterceptor());
DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined()); DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
// So far the most popular follow ups for interceptor loads are FIELD
// and CALLBACKS, so inline only them, other cases may be added
// later.
bool compile_followup_inline = false;
if (lookup->IsFound() && lookup->IsCacheable()) {
if (lookup->IsField()) {
compile_followup_inline = true;
} else if (lookup->type() == CALLBACKS &&
lookup->GetCallbackObject()->IsExecutableAccessorInfo()) {
Handle<ExecutableAccessorInfo> callback(
ExecutableAccessorInfo::cast(lookup->GetCallbackObject()));
compile_followup_inline =
callback->getter() != NULL &&
ExecutableAccessorInfo::IsCompatibleReceiverType(isolate(), callback,
type());
}
}
if (compile_followup_inline) {
// Compile the interceptor call, followed by inline code to load the // Compile the interceptor call, followed by inline code to load the
// property from further up the prototype chain if the call fails. // property from further up the prototype chain if the call fails.
// Check that the maps haven't changed. // Check that the maps haven't changed.
DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1())); DCHECK(holder_reg.is(receiver()) || holder_reg.is(scratch1()));
// Preserve the receiver register explicitly whenever it is different from // Preserve the receiver register explicitly whenever it is different from the
// the holder and it is needed should the interceptor return without any // holder and it is needed should the interceptor return without any result.
// result. The CALLBACKS case needs the receiver to be passed into C++ code, // The ACCESSOR case needs the receiver to be passed into C++ code, the FIELD
// the FIELD case might cause a miss during the prototype check. // case might cause a miss during the prototype check.
bool must_perfrom_prototype_check = *holder() != lookup->holder(); bool must_perform_prototype_check =
bool must_preserve_receiver_reg = !receiver().is(holder_reg) && !holder().is_identical_to(it->GetHolder<JSObject>());
(lookup->type() == CALLBACKS || must_perfrom_prototype_check); bool must_preserve_receiver_reg =
!receiver().is(holder_reg) &&
(it->property_kind() == LookupIterator::ACCESSOR ||
must_perform_prototype_check);
// Save necessary data before invoking an interceptor. // Save necessary data before invoking an interceptor.
// Requires a frame to make GC aware of pushed pointers. // Requires a frame to make GC aware of pushed pointers.
@ -859,22 +842,24 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg,
// Leave the internal frame. // Leave the internal frame.
} }
GenerateLoadPostInterceptor(holder_reg, name, lookup); GenerateLoadPostInterceptor(it, holder_reg);
} else { // !compile_followup_inline }
void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
DCHECK(holder()->HasNamedInterceptor());
DCHECK(!holder()->GetNamedInterceptor()->getter()->IsUndefined());
// Call the runtime system to load the interceptor. // Call the runtime system to load the interceptor.
// Check that the maps haven't changed.
__ pop(scratch2()); // save old return address __ pop(scratch2()); // save old return address
PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(), PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
holder()); holder());
__ push(scratch2()); // restore old return address __ push(scratch2()); // restore old return address
ExternalReference ref = ExternalReference ref = ExternalReference(
ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptor), IC_Utility(IC::kLoadPropertyWithInterceptor), isolate());
isolate());
__ TailCallExternalReference( __ TailCallExternalReference(
ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1); ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
} }
}
Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback( Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(