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

Unified Diff: src/objects-inl.h

Issue 1414403003: Fix HasProperty/HasElement for Proxies on the prototype chain (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/objects.cc ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index e110c989bb6dd208a04441f505185c503c47b370..e893b2c492cd47ac8e7599535b6eb4fbe55dd1b4 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -7274,27 +7274,17 @@ MaybeHandle<Object> Object::GetPropertyOrElement(Handle<JSReceiver> holder,
Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object,
Handle<Name> name) {
- // Call the "has" trap on proxies.
- if (object->IsJSProxy()) {
- Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
- return JSProxy::HasPropertyWithHandler(proxy, name);
- }
-
- Maybe<PropertyAttributes> result = GetPropertyAttributes(object, name);
- return result.IsJust() ? Just(result.FromJust() != ABSENT) : Nothing<bool>();
+ LookupIterator it =
+ LookupIterator::PropertyOrElement(object->GetIsolate(), object, name);
+ return HasProperty(&it);
}
Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object,
Handle<Name> name) {
- // Call the "has" trap on proxies.
- if (object->IsJSProxy()) {
- Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
- return JSProxy::HasPropertyWithHandler(proxy, name);
- }
-
- Maybe<PropertyAttributes> result = GetOwnPropertyAttributes(object, name);
- return result.IsJust() ? Just(result.FromJust() != ABSENT) : Nothing<bool>();
+ LookupIterator it = LookupIterator::PropertyOrElement(
+ object->GetIsolate(), object, name, LookupIterator::HIDDEN);
+ return HasProperty(&it);
}
@@ -7315,31 +7305,16 @@ Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes(
Maybe<bool> JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) {
- // Call the "has" trap on proxies.
- if (object->IsJSProxy()) {
- Isolate* isolate = object->GetIsolate();
- Handle<Name> name = isolate->factory()->Uint32ToString(index);
- Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
- return JSProxy::HasPropertyWithHandler(proxy, name);
- }
-
- Maybe<PropertyAttributes> result = GetElementAttributes(object, index);
- return result.IsJust() ? Just(result.FromJust() != ABSENT) : Nothing<bool>();
+ LookupIterator it(object->GetIsolate(), object, index);
+ return HasProperty(&it);
}
Maybe<bool> JSReceiver::HasOwnElement(Handle<JSReceiver> object,
uint32_t index) {
- // Call the "has" trap on proxies.
- if (object->IsJSProxy()) {
- Isolate* isolate = object->GetIsolate();
- Handle<Name> name = isolate->factory()->Uint32ToString(index);
- Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
- return JSProxy::HasPropertyWithHandler(proxy, name);
- }
-
- Maybe<PropertyAttributes> result = GetOwnElementAttributes(object, index);
- return result.IsJust() ? Just(result.FromJust() != ABSENT) : Nothing<bool>();
+ LookupIterator it(object->GetIsolate(), object, index,
+ LookupIterator::HIDDEN);
+ return HasProperty(&it);
}
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698