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

Unified Diff: src/stub-cache.cc

Issue 314953006: Implement LookupIterator designed to replace LookupResult (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Adding to BUILD.gn Created 6 years, 6 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
Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index ef9270fb49f0709e3921ad62d046cfa5ffc6c229..c15038ee9ecc3f13c63ae159a2bea5af453c3262 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -546,83 +546,28 @@ static Object* ThrowReferenceError(Isolate* isolate, Name* name) {
}
-MUST_USE_RESULT static MaybeHandle<Object> LoadWithInterceptor(
- Arguments* args,
- PropertyAttributes* attrs) {
- ASSERT(args->length() == StubCache::kInterceptorArgsLength);
- Handle<Name> name_handle =
- args->at<Name>(StubCache::kInterceptorArgsNameIndex);
- Handle<InterceptorInfo> interceptor_info =
- args->at<InterceptorInfo>(StubCache::kInterceptorArgsInfoIndex);
- Handle<JSObject> receiver_handle =
- args->at<JSObject>(StubCache::kInterceptorArgsThisIndex);
- Handle<JSObject> holder_handle =
- args->at<JSObject>(StubCache::kInterceptorArgsHolderIndex);
-
- Isolate* isolate = receiver_handle->GetIsolate();
-
- // TODO(rossberg): Support symbols in the API.
- if (name_handle->IsSymbol()) {
- return JSObject::GetPropertyPostInterceptor(
- holder_handle, receiver_handle, name_handle, attrs);
- }
- Handle<String> name = Handle<String>::cast(name_handle);
-
- Address getter_address = v8::ToCData<Address>(interceptor_info->getter());
- v8::NamedPropertyGetterCallback getter =
- FUNCTION_CAST<v8::NamedPropertyGetterCallback>(getter_address);
- ASSERT(getter != NULL);
-
- PropertyCallbackArguments callback_args(isolate,
- interceptor_info->data(),
- *receiver_handle,
- *holder_handle);
- {
- HandleScope scope(isolate);
- // Use the interceptor getter.
- v8::Handle<v8::Value> r =
- callback_args.Call(getter, v8::Utils::ToLocal(name));
- RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
- if (!r.IsEmpty()) {
- *attrs = NONE;
- Handle<Object> result = v8::Utils::OpenHandle(*r);
- result->VerifyApiCallResultType();
- return scope.CloseAndEscape(result);
- }
- }
-
- return JSObject::GetPropertyPostInterceptor(
- holder_handle, receiver_handle, name_handle, attrs);
-}
-
-
/**
* Loads a property with an interceptor performing post interceptor
* lookup if interceptor failed.
*/
-RUNTIME_FUNCTION(LoadPropertyWithInterceptorForLoad) {
- PropertyAttributes attr = NONE;
+RUNTIME_FUNCTION(LoadPropertyWithInterceptor) {
HandleScope scope(isolate);
+ ASSERT(args.length() == StubCache::kInterceptorArgsLength);
+ Handle<Name> name =
+ args.at<Name>(StubCache::kInterceptorArgsNameIndex);
+ Handle<JSObject> receiver =
+ args.at<JSObject>(StubCache::kInterceptorArgsThisIndex);
+ Handle<JSObject> holder =
+ args.at<JSObject>(StubCache::kInterceptorArgsHolderIndex);
+
Handle<Object> result;
+ LookupIterator it(receiver, name, holder);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, LoadWithInterceptor(&args, &attr));
-
- // If the property is present, return it.
- if (attr != ABSENT) return *result;
- return ThrowReferenceError(isolate, Name::cast(args[0]));
-}
+ isolate, result, JSObject::GetProperty(&it));
+ if (it.IsFound()) return *result;
-RUNTIME_FUNCTION(LoadPropertyWithInterceptorForCall) {
- PropertyAttributes attr;
- HandleScope scope(isolate);
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, result, LoadWithInterceptor(&args, &attr));
- // This is call IC. In this case, we simply return the undefined result which
- // will lead to an exception when trying to invoke the result as a
- // function.
- return *result;
+ return ThrowReferenceError(isolate, Name::cast(args[0]));
}
« src/objects-inl.h ('K') | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698