Reviewers: Michael Starzinger,

Description:
Remove duplication and unnecessary HandleScope from HasElement helper functions


Please review this at https://codereview.chromium.org/12328064/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/objects.cc


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index d9da23f363ed1e18e363ff3e79b0fe02d348cc29..526187e155769b137c807fdabc0271ed1a509906 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3370,11 +3370,6 @@ PropertyAttributes JSObject::GetElementAttributeWithReceiver( return GetElementAttributeWithInterceptor(receiver, index, continue_search);
   }

-  // Handle [] on String objects.
-  if (this->IsStringObjectWithCharacterAt(index)) {
-    return static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
-  }
-
   return GetElementAttributeWithoutInterceptor(
       receiver, index, continue_search);
 }
@@ -3426,28 +3421,25 @@ PropertyAttributes JSObject::GetElementAttributeWithInterceptor(

 PropertyAttributes JSObject::GetElementAttributeWithoutInterceptor(
       JSReceiver* receiver, uint32_t index, bool continue_search) {
-  Isolate* isolate = GetIsolate();
-  HandleScope scope(isolate);
-  Handle<JSReceiver> hreceiver(receiver);
-  Handle<JSObject> holder(this);
-  PropertyAttributes attr = holder->GetElementsAccessor()->GetAttributes(
-      *hreceiver, *holder, index);
+  PropertyAttributes attr = GetElementsAccessor()->GetAttributes(
+      receiver, this, index);
   if (attr != ABSENT) return attr;

-  if (holder->IsStringObjectWithCharacterAt(index)) {
+  // Handle [] on String objects.
+  if (IsStringObjectWithCharacterAt(index)) {
     return static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
   }

   if (!continue_search) return ABSENT;

-  Object* pt = holder->GetPrototype();
+  Object* pt = GetPrototype();
   if (pt->IsJSProxy()) {
// We need to follow the spec and simulate a call to [[GetOwnProperty]]. - return JSProxy::cast(pt)->GetElementAttributeWithHandler(*hreceiver, index); + return JSProxy::cast(pt)->GetElementAttributeWithHandler(receiver, index);
   }
   if (pt->IsNull()) return ABSENT;
   return JSObject::cast(pt)->GetElementAttributeWithReceiver(
-      *hreceiver, index, true);
+      receiver, index, true);
 }




--
--
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/groups/opt_out.


Reply via email to