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

Unified Diff: src/objects.cc

Issue 384963002: ES6 Unscopables (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Force use of holder as receiver for non js accessor callbacks Created 6 years, 5 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/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index abd018770bbcaf37dbf552ea06ebfa6d7cc92f13..b095a63d296ba138f7a3b730152cd744343a0074 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -129,7 +129,8 @@ void Object::Lookup(Handle<Name> name, LookupResult* result) {
}
-MaybeHandle<Object> Object::GetProperty(LookupIterator* it) {
+MaybeHandle<Object> Object::GetPropertyHelper(
+ LookupIterator* it, bool force_holder_as_receiver_for_accessor_callback) {
for (; it->IsFound(); it->Next()) {
switch (it->state()) {
case LookupIterator::NOT_FOUND:
@@ -150,10 +151,18 @@ MaybeHandle<Object> Object::GetProperty(LookupIterator* it) {
case LookupIterator::PROPERTY:
if (it->HasProperty()) {
switch (it->property_kind()) {
- case LookupIterator::ACCESSOR:
- return GetPropertyWithAccessor(
- it->GetReceiver(), it->name(),
- it->GetHolder(), it->GetAccessors());
+ case LookupIterator::ACCESSOR: {
+ Handle<Object> accessors = it->GetAccessors();
+ Handle<Object> receiver;
+ if (force_holder_as_receiver_for_accessor_callback &&
+ !accessors->IsAccessorPair()) {
+ receiver = it->GetHolder();
+ } else {
+ receiver = it->GetReceiver();
+ }
+ return GetPropertyWithAccessor(receiver, it->name(),
+ it->GetHolder(), accessors);
+ }
Toon Verwaest 2014/07/23 12:08:38 Euh, no. What you want to do is fix a bug in Arra
case LookupIterator::DATA:
return it->GetDataValue();
}
@@ -165,6 +174,19 @@ MaybeHandle<Object> Object::GetProperty(LookupIterator* it) {
}
+MaybeHandle<Object> Object::GetProperty(LookupIterator* it) {
+ return GetPropertyHelper(it, false);
+}
+
+
+MaybeHandle<Object> Object::GetPropertyForUnscopables(LookupIterator* it) {
+ // TODO(arv): For unscopables we need to make sure that we use the holder as
+ // the receiver for data properties that are implemented as callbacks
+ // (ACCESSER && !IsAccessorPair).
+ return GetPropertyHelper(it, true);
+}
+
+
bool Object::ToInt32(int32_t* value) {
if (IsSmi()) {
*value = Smi::cast(this)->value();
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698