Revision: 20765
Author:   [email protected]
Date:     Tue Apr 15 12:11:39 2014 UTC
Log:      Handlify JSObject::FastPropertyAt.

[email protected]

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

Modified:
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Tue Apr 15 07:36:47 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h   Tue Apr 15 12:11:39 2014 UTC
@@ -294,16 +294,17 @@
 }


-MaybeObject* Object::AllocateNewStorageFor(Heap* heap,
-                                           Representation representation) {
-  if (representation.IsSmi() && IsUninitialized()) {
-    return Smi::FromInt(0);
+Handle<Object> Object::NewStorageFor(Isolate* isolate,
+                                     Handle<Object> object,
+                                     Representation representation) {
+  if (representation.IsSmi() && object->IsUninitialized()) {
+    return handle(Smi::FromInt(0), isolate);
   }
-  if (!representation.IsDouble()) return this;
-  if (IsUninitialized()) {
-    return heap->AllocateHeapNumber(0);
+  if (!representation.IsDouble()) return object;
+  if (object->IsUninitialized()) {
+    return isolate->factory()->NewHeapNumber(0);
   }
-  return heap->AllocateHeapNumber(Number());
+  return isolate->factory()->NewHeapNumber(object->Number());
 }


@@ -1986,13 +1987,6 @@
   int offset = GetHeaderSize() + (kPointerSize * index);
   WRITE_FIELD(this, offset, value);
 }
-
-
-MaybeObject* JSObject::FastPropertyAt(Representation representation,
-                                      int index) {
-  Object* raw_value = RawFastPropertyAt(index);
-  return raw_value->AllocateNewStorageFor(GetHeap(), representation);
-}


 // Access fast-case object properties at index. The use of these routines
=======================================
--- /branches/bleeding_edge/src/objects.cc      Tue Apr 15 10:37:12 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Tue Apr 15 12:11:39 2014 UTC
@@ -1822,17 +1822,6 @@
 String* JSReceiver::constructor_name() {
   return map()->constructor_name();
 }
-
-
-// TODO(mstarzinger): Temporary wrapper until handlified.
-static Handle<Object> NewStorageFor(Isolate* isolate,
-                                    Handle<Object> object,
-                                    Representation representation) {
-  Heap* heap = isolate->heap();
-  CALL_HEAP_FUNCTION(isolate,
-                     object->AllocateNewStorageFor(heap, representation),
-                     Object);
-}


 void JSObject::AddFastProperty(Handle<JSObject> object,
@@ -2247,7 +2236,7 @@
       if (old_details.representation().IsNone()) {
         value = handle(Smi::FromInt(0), isolate);
       }
-      value = NewStorageFor(isolate, value, details.representation());
+ value = Object::NewStorageFor(isolate, value, details.representation());
     }
     ASSERT(!(details.representation().IsDouble() && value->IsSmi()));
     int target_index = new_descriptors->GetFieldIndex(i) - inobject;
@@ -5846,8 +5835,8 @@
                                         Representation representation,
                                         int index) {
   Isolate* isolate = object->GetIsolate();
-  CALL_HEAP_FUNCTION(isolate,
- object->FastPropertyAt(representation, index), Object);
+  Handle<Object> raw_value(object->RawFastPropertyAt(index), isolate);
+  return Object::NewStorageFor(isolate, raw_value, representation);
 }


@@ -5947,7 +5936,7 @@
           RETURN_IF_EMPTY_HANDLE_VALUE(isolate, value, Handle<JSObject>());
         } else {
           Representation representation = details.representation();
-          value = NewStorageFor(isolate, value, representation);
+          value = Object::NewStorageFor(isolate, value, representation);
         }
         if (copying) {
           copy->FastPropertyAtPut(index, *value);
=======================================
--- /branches/bleeding_edge/src/objects.h       Tue Apr 15 10:37:12 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Tue Apr 15 12:11:39 2014 UTC
@@ -1511,8 +1511,9 @@

Handle<HeapType> OptimalType(Isolate* isolate, Representation representation);

-  inline MaybeObject* AllocateNewStorageFor(Heap* heap,
-                                            Representation representation);
+  inline static Handle<Object> NewStorageFor(Isolate* isolate,
+                                             Handle<Object> object,
+ Representation representation);

   // Returns true if the object is of the correct type to be used as a
   // implementation of a JSObject's elements.
@@ -2608,9 +2609,6 @@
                                         int unused_property_fields);

   // Access fast-case object properties at index.
-  MUST_USE_RESULT inline MaybeObject* FastPropertyAt(
-      Representation representation,
-      int index);
   static Handle<Object> FastPropertyAt(Handle<JSObject> object,
                                        Representation representation,
                                        int index);
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Tue Apr 15 11:16:02 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Tue Apr 15 12:11:39 2014 UTC
@@ -5023,7 +5023,9 @@
           if (!result.representation().IsDouble()) {
             keyed_lookup_cache->Update(receiver_map, key, offset);
           }
-          return receiver->FastPropertyAt(result.representation(), offset);
+          HandleScope scope(isolate);
+          return *JSObject::FastPropertyAt(
+              handle(receiver, isolate), result.representation(), offset);
         }
       } else {
         // Attempt dictionary lookup.

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