Revision: 23169
Author:   [email protected]
Date:     Mon Aug 18 15:08:14 2014 UTC
Log: Use LookupIterator in SetAccessor / DefineAccessor and remove "search_hidden_prototypes" from LookupOwn

BUG=
[email protected]

Review URL: https://codereview.chromium.org/468163002
http://code.google.com/p/v8/source/detail?r=23169

Modified:
 /branches/bleeding_edge/src/lookup.h
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h

=======================================
--- /branches/bleeding_edge/src/lookup.h        Mon Aug 18 15:03:13 2014 UTC
+++ /branches/bleeding_edge/src/lookup.h        Mon Aug 18 15:08:14 2014 UTC
@@ -143,6 +143,7 @@
     return property_details_;
   }
bool IsConfigurable() const { return !property_details().IsDontDelete(); }
+  bool IsReadOnly() const { return property_details().IsReadOnly(); }
   Representation representation() const {
     return property_details().representation();
   }
=======================================
--- /branches/bleeding_edge/src/objects.cc      Mon Aug 18 15:03:13 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Mon Aug 18 15:08:14 2014 UTC
@@ -5771,8 +5771,7 @@
 }


-void JSReceiver::LookupOwn(
- Handle<Name> name, LookupResult* result, bool search_hidden_prototypes) {
+void JSReceiver::LookupOwn(Handle<Name> name, LookupResult* result) {
   DisallowHeapAllocation no_gc;
   DCHECK(name->IsName());

@@ -5780,8 +5779,7 @@
     PrototypeIterator iter(GetIsolate(), this);
     if (iter.IsAtEnd()) return result->NotFound();
     DCHECK(iter.GetCurrent()->IsJSGlobalObject());
-    return JSReceiver::cast(iter.GetCurrent())
-        ->LookupOwn(name, result, search_hidden_prototypes);
+    return JSReceiver::cast(iter.GetCurrent())->LookupOwn(name, result);
   }

   if (IsJSProxy()) {
@@ -5805,14 +5803,6 @@
   }

   js_object->LookupOwnRealNamedProperty(name, result);
- if (result->IsFound() || name->IsOwn() || !search_hidden_prototypes) return;
-
-  PrototypeIterator iter(GetIsolate(), js_object);
-  if (!iter.GetCurrent()->IsJSReceiver()) return;
-  JSReceiver* receiver = JSReceiver::cast(iter.GetCurrent());
-  if (receiver->map()->is_hidden_prototype()) {
-    receiver->LookupOwn(name, result, search_hidden_prototypes);
-  }
 }


@@ -5822,7 +5812,7 @@
   for (PrototypeIterator iter(GetIsolate(), this,
                               PrototypeIterator::START_AT_RECEIVER);
        !iter.IsAtEnd(); iter.Advance()) {
-    JSReceiver::cast(iter.GetCurrent())->LookupOwn(name, result, false);
+    JSReceiver::cast(iter.GetCurrent())->LookupOwn(name, result);
     if (result->IsFound()) return;
     if (name->IsOwn()) {
       result->NotFound();
@@ -6348,12 +6338,13 @@
             Object::GetElement(isolate, object, index).ToHandleChecked();
       }
     } else {
-      LookupResult lookup(isolate);
-      object->LookupOwn(name, &lookup, true);
-      preexists = lookup.IsProperty();
-      if (preexists && lookup.IsDataProperty()) {
-        old_value =
-            Object::GetPropertyOrElement(object, name).ToHandleChecked();
+      LookupIterator it(object, name,
+                        LookupIterator::CHECK_HIDDEN_SKIP_INTERCEPTOR);
+      CHECK(GetPropertyAttributes(&it).has_value);
+      preexists = it.IsFound();
+      if (preexists && (it.property_kind() == LookupIterator::DATA ||
+                        it.GetAccessors()->IsAccessorInfo())) {
+        old_value = GetProperty(&it).ToHandleChecked();
       }
     }
   }
@@ -6543,11 +6534,12 @@
     SetElementCallback(object, index, info, info->property_attributes());
   } else {
     // Lookup the name.
-    LookupResult result(isolate);
-    object->LookupOwn(name, &result, true);
+    LookupIterator it(object, name,
+                      LookupIterator::CHECK_HIDDEN_SKIP_INTERCEPTOR);
+    CHECK(GetPropertyAttributes(&it).has_value);
     // ES5 forbids turning a property into an accessor if it's not
- // configurable (that is IsDontDelete in ES3 and v8), see 8.6.1 (Table 5). - if (result.IsFound() && (result.IsReadOnly() || result.IsDontDelete())) {
+    // configurable. See 8.6.1 (Table 5).
+    if (it.IsFound() && (it.IsReadOnly() || !it.IsConfigurable())) {
       return factory->undefined_value();
     }

=======================================
--- /branches/bleeding_edge/src/objects.h       Mon Aug 18 15:03:13 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Mon Aug 18 15:08:14 2014 UTC
@@ -1999,8 +1999,7 @@

   // Lookup a property.  If found, the result is valid and has
   // detailed information.
-  void LookupOwn(Handle<Name> name, LookupResult* result,
-                 bool search_hidden_prototypes = false);
+  void LookupOwn(Handle<Name> name, LookupResult* result);
   void Lookup(Handle<Name> name, LookupResult* result);

   enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS };

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to