Revision: 20514
Author:   [email protected]
Date:     Fri Apr  4 13:20:24 2014 UTC
Log:      ElementsAccessor's public interface handlification.

[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/elements.cc     Fri Apr  4 13:05:37 2014 UTC
+++ /branches/bleeding_edge/src/elements.cc     Fri Apr  4 13:20:24 2014 UTC
@@ -642,26 +642,12 @@
                        Get(*receiver, *holder, key, *backing_store),
                        Object);
   }
-
-  // TODO(ishell): Temporary wrapper until handlified.
-  MUST_USE_RESULT virtual Handle<Object> Get(
-      Handle<Object> receiver,
-      Handle<JSObject> holder,
-      uint32_t key) V8_FINAL V8_OVERRIDE {
-    CALL_HEAP_FUNCTION(holder->GetIsolate(),
-                       Get(*receiver, *holder, key, NULL),
-                       Object);
-  }

   MUST_USE_RESULT virtual MaybeObject* Get(
       Object* receiver,
       JSObject* holder,
       uint32_t key,
       FixedArrayBase* backing_store) V8_FINAL V8_OVERRIDE {
-    if (backing_store == NULL) {
-      backing_store = holder->elements();
-    }
-
     if (!IsExternalArrayElementsKind(ElementsTraits::Kind) &&
         FLAG_trace_js_array_abuse) {
       CheckArrayAbuse(holder, "elements read", key);
@@ -686,13 +672,20 @@
   }

   MUST_USE_RESULT virtual PropertyAttributes GetAttributes(
+      Handle<Object> receiver,
+      Handle<JSObject> holder,
+      uint32_t key,
+      Handle<FixedArrayBase> backing_store) V8_FINAL V8_OVERRIDE {
+    return ElementsAccessorSubclass::GetAttributesImpl(
+        *receiver, *holder, key, *backing_store);
+  }
+
+  // TODO(ishell): To be removed once elements.cc is handlified.
+  MUST_USE_RESULT virtual PropertyAttributes GetAttributes(
       Object* receiver,
       JSObject* holder,
       uint32_t key,
       FixedArrayBase* backing_store) V8_FINAL V8_OVERRIDE {
-    if (backing_store == NULL) {
-      backing_store = holder->elements();
-    }
     return ElementsAccessorSubclass::GetAttributesImpl(
         receiver, holder, key, backing_store);
   }
@@ -708,14 +701,21 @@
return BackingStore::cast(backing_store)->is_the_hole(key) ? ABSENT : NONE;
   }

+  MUST_USE_RESULT virtual PropertyType GetType(
+      Handle<Object> receiver,
+      Handle<JSObject> holder,
+      uint32_t key,
+      Handle<FixedArrayBase> backing_store) V8_FINAL V8_OVERRIDE {
+    return ElementsAccessorSubclass::GetTypeImpl(
+        *receiver, *holder, key, *backing_store);
+  }
+
+  // TODO(ishell): To be removed once elements.cc is handlified.
   MUST_USE_RESULT virtual PropertyType GetType(
       Object* receiver,
       JSObject* holder,
       uint32_t key,
       FixedArrayBase* backing_store) V8_FINAL V8_OVERRIDE {
-    if (backing_store == NULL) {
-      backing_store = holder->elements();
-    }
     return ElementsAccessorSubclass::GetTypeImpl(
         receiver, holder, key, backing_store);
   }
=======================================
--- /branches/bleeding_edge/src/elements.h      Fri Apr  4 13:05:37 2014 UTC
+++ /branches/bleeding_edge/src/elements.h      Fri Apr  4 13:20:24 2014 UTC
@@ -79,16 +79,12 @@
       uint32_t key,
       Handle<FixedArrayBase> backing_store) = 0;

-  MUST_USE_RESULT virtual Handle<Object> Get(
+  MUST_USE_RESULT inline Handle<Object> Get(
       Handle<Object> receiver,
       Handle<JSObject> holder,
-      uint32_t key) = 0;
-
-  MUST_USE_RESULT virtual MaybeObject* Get(
-      Object* receiver,
-      JSObject* holder,
-      uint32_t key,
-      FixedArrayBase* backing_store = NULL) = 0;
+      uint32_t key) {
+    return Get(receiver, holder, key, handle(holder->elements()));
+  }

   // Returns an element's attributes, or ABSENT if there is no such
// element. This method doesn't iterate up the prototype chain. The caller
@@ -96,10 +92,17 @@
   // be compatible with the ElementsKind of the ElementsAccessor. If
// backing_store is NULL, the holder->elements() is used as the backing store.
   MUST_USE_RESULT virtual PropertyAttributes GetAttributes(
-      Object* receiver,
-      JSObject* holder,
+      Handle<Object> receiver,
+      Handle<JSObject> holder,
       uint32_t key,
-      FixedArrayBase* backing_store = NULL) = 0;
+      Handle<FixedArrayBase> backing_store) = 0;
+
+  MUST_USE_RESULT inline PropertyAttributes GetAttributes(
+      Handle<Object> receiver,
+      Handle<JSObject> holder,
+      uint32_t key) {
+ return GetAttributes(receiver, holder, key, handle(holder->elements()));
+  }

   // Returns an element's type, or NONEXISTENT if there is no such
// element. This method doesn't iterate up the prototype chain. The caller
@@ -107,10 +110,17 @@
   // be compatible with the ElementsKind of the ElementsAccessor. If
// backing_store is NULL, the holder->elements() is used as the backing store.
   MUST_USE_RESULT virtual PropertyType GetType(
-      Object* receiver,
-      JSObject* holder,
+      Handle<Object> receiver,
+      Handle<JSObject> holder,
       uint32_t key,
-      FixedArrayBase* backing_store = NULL) = 0;
+      Handle<FixedArrayBase> backing_store) = 0;
+
+  MUST_USE_RESULT inline PropertyType GetType(
+      Handle<Object> receiver,
+      Handle<JSObject> holder,
+      uint32_t key) {
+    return GetType(receiver, holder, key, handle(holder->elements()));
+  }

// Returns an element's accessors, or NULL if the element does not exist or // is plain. This method doesn't iterate up the prototype chain. The caller
@@ -234,6 +244,26 @@
   virtual uint32_t GetKeyForIndex(Handle<FixedArrayBase> backing_store,
                                   uint32_t index) = 0;

+  // TODO(ishell): Non-handlified versions, used only by accessors'
+  // implementations. To be removed once elements.cc is handlified.
+  MUST_USE_RESULT virtual MaybeObject* Get(
+      Object* receiver,
+      JSObject* holder,
+      uint32_t key,
+      FixedArrayBase* backing_store) = 0;
+
+  MUST_USE_RESULT virtual PropertyAttributes GetAttributes(
+      Object* receiver,
+      JSObject* holder,
+      uint32_t key,
+      FixedArrayBase* backing_store) = 0;
+
+  MUST_USE_RESULT virtual PropertyType GetType(
+      Object* receiver,
+      JSObject* holder,
+      uint32_t key,
+      FixedArrayBase* backing_store) = 0;
+
  private:
   static ElementsAccessor** elements_accessors_;
   const char* name_;
=======================================
--- /branches/bleeding_edge/src/objects.cc      Fri Apr  4 13:05:37 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Fri Apr  4 13:20:24 2014 UTC
@@ -4498,7 +4498,7 @@
     uint32_t index,
     bool continue_search) {
   PropertyAttributes attr = object->GetElementsAccessor()->GetAttributes(
-      *receiver, *object, index);
+      receiver, object, index);
   if (attr != ABSENT) return attr;

   // Handle [] on String objects.

--
--
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