Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Unified Diff: src/ic/ic.cc

Issue 1778493005: Inline calling into the interceptor into the IC callbacks rather than going through the LookupItera… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ic/handler-compiler.cc ('k') | src/objects.h » ('j') | src/objects.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/ic.cc
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index 74a204d8a8802307042a1f1acad71bc03b54d4d3..6faa60d1449a6061f876fbda39c1c90aba88a902 100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -2787,13 +2787,27 @@ RUNTIME_FUNCTION(Runtime_LoadPropertyWithInterceptorOnly) {
Handle<JSObject> holder =
args.at<JSObject>(NamedLoadHandlerCompiler::kInterceptorArgsHolderIndex);
HandleScope scope(isolate);
- LookupIterator it(receiver, name, holder, LookupIterator::OWN);
- bool done;
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, JSObject::GetPropertyWithInterceptor(&it, &done));
- if (done) return *result;
- return isolate->heap()->no_interceptor_result_sentinel();
+
+ InterceptorInfo* interceptor = holder->GetNamedInterceptor();
+ PropertyCallbackArguments arguments(isolate, interceptor->data(), *receiver,
+ *holder, Object::DONT_THROW);
+
+ v8::GenericNamedPropertyGetterCallback getter =
+ v8::ToCData<v8::GenericNamedPropertyGetterCallback>(
+ interceptor->getter());
+ LOG(isolate, ApiNamedPropertyAccess("interceptor-named-get", *holder, *name));
+ v8::Local<v8::Value> result =
+ arguments.Call(getter, v8::Utils::ToLocal(name));
+
+ RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
+
+ Handle<Object> result_internal;
+ if (result.IsEmpty()) {
+ return isolate->heap()->no_interceptor_result_sentinel();
+ }
+ result_internal = v8::Utils::OpenHandle(*result);
+ result_internal->VerifyApiCallResultType();
+ return *result_internal;
}
@@ -2869,10 +2883,33 @@ RUNTIME_FUNCTION(Runtime_LoadElementWithInterceptor) {
Handle<JSObject> receiver = args.at<JSObject>(0);
DCHECK(args.smi_at(1) >= 0);
uint32_t index = args.smi_at(1);
- Handle<Object> result;
- LookupIterator it(isolate, receiver, index, receiver);
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, Object::GetProperty(&it));
- return *result;
+
+ InterceptorInfo* interceptor = receiver->GetIndexedInterceptor();
+ v8::Local<v8::Value> result;
+ PropertyCallbackArguments arguments(isolate, interceptor->data(), *receiver,
+ *receiver, Object::DONT_THROW);
+
+ v8::IndexedPropertyGetterCallback getter =
+ v8::ToCData<v8::IndexedPropertyGetterCallback>(interceptor->getter());
+ LOG(isolate,
+ ApiIndexedPropertyAccess("interceptor-indexed-get", *receiver, index));
+ result = arguments.Call(getter, index);
+
+ RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
+
+ Handle<Object> result_internal;
+ if (result.IsEmpty()) {
+ LookupIterator it(isolate, receiver, index, receiver);
+ DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state());
+ it.Next();
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result_internal,
+ Object::GetProperty(&it));
+ } else {
+ result_internal = v8::Utils::OpenHandle(*result);
+ result_internal->VerifyApiCallResultType();
+ }
+
+ return *result_internal;
}
« no previous file with comments | « src/ic/handler-compiler.cc ('k') | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698