Revision: 20769
Author:   [email protected]
Date:     Tue Apr 15 13:42:41 2014 UTC
Log:      Use a wrapper for copying object.

[email protected]

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

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

=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Apr 15 11:51:34 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Tue Apr 15 13:42:41 2014 UTC
@@ -4788,21 +4788,6 @@
   FixedArray::cast(obj)->set_length(length);
   return obj;
 }
-
-
-MaybeObject* Heap::AllocateEmptyFixedDoubleArray() {
-  int size = FixedDoubleArray::SizeFor(0);
-  Object* result;
-  { MaybeObject* maybe_result =
-        AllocateRaw(size, OLD_DATA_SPACE, OLD_DATA_SPACE);
-    if (!maybe_result->ToObject(&result)) return maybe_result;
-  }
-  // Initialize the object.
-  reinterpret_cast<FixedDoubleArray*>(result)->set_map_no_write_barrier(
-      fixed_double_array_map());
-  reinterpret_cast<FixedDoubleArray*>(result)->set_length(0);
-  return result;
-}


 MaybeObject* Heap::AllocateUninitializedFixedDoubleArray(
=======================================
--- /branches/bleeding_edge/src/heap.h  Tue Apr 15 11:51:34 2014 UTC
+++ /branches/bleeding_edge/src/heap.h  Tue Apr 15 13:42:41 2014 UTC
@@ -2110,9 +2110,6 @@
   MUST_USE_RESULT MaybeObject* AllocateEmptyFixedTypedArray(
       ExternalArrayType array_type);

-  // Allocate empty fixed double array.
-  MUST_USE_RESULT MaybeObject* AllocateEmptyFixedDoubleArray();
-
   // Allocate empty constant pool array.
   MUST_USE_RESULT MaybeObject* AllocateEmptyConstantPoolArray();

=======================================
--- /branches/bleeding_edge/src/objects.cc      Tue Apr 15 13:25:17 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Tue Apr 15 13:42:41 2014 UTC
@@ -5820,12 +5820,24 @@
   }
   JSObject::MigrateToMap(object, new_map);
 }
+
+
+Handle<JSObject> JSObject::Copy(Handle<JSObject> object,
+                                Handle<AllocationSite> site) {
+  Isolate* isolate = object->GetIsolate();
+  CALL_HEAP_FUNCTION(isolate,
+                     isolate->heap()->CopyJSObject(
+                         *object,
+                         site.is_null() ? NULL : *site),
+                     JSObject);
+}


 Handle<JSObject> JSObject::Copy(Handle<JSObject> object) {
   Isolate* isolate = object->GetIsolate();
   CALL_HEAP_FUNCTION(isolate,
-                     isolate->heap()->CopyJSObject(*object), JSObject);
+                     isolate->heap()->CopyJSObject(*object, NULL),
+                     JSObject);
 }


@@ -5896,14 +5908,7 @@
     if (site_context()->ShouldCreateMemento(object)) {
       site_to_pass = site_context()->current();
     }
-    CALL_AND_RETRY_OR_DIE(isolate,
-                          isolate->heap()->CopyJSObject(*object,
- site_to_pass.is_null() ? NULL : *site_to_pass), - { copy = Handle<JSObject>(JSObject::cast(__object__),
-                                                    isolate);
-                            break;
-                          },
-                          return Handle<JSObject>());
+    copy = JSObject::Copy(object, site_to_pass);
   } else {
     copy = object;
   }
=======================================
--- /branches/bleeding_edge/src/objects.h       Tue Apr 15 12:11:39 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Tue Apr 15 13:42:41 2014 UTC
@@ -2147,6 +2147,10 @@
 // Forward declaration for JSObject::GetOrCreateHiddenPropertiesHashTable.
 class ObjectHashTable;

+// Forward declaration for JSObject::Copy.
+class AllocationSite;
+
+
 // The JSObject describes real heap allocated JavaScript objects with
 // properties.
 // Note that the map of JSObject changes during execution to enable inline
@@ -2655,6 +2659,8 @@
     kObjectIsShallowArray = 1
   };

+  static Handle<JSObject> Copy(Handle<JSObject> object,
+                               Handle<AllocationSite> site);
   static Handle<JSObject> Copy(Handle<JSObject> object);
   static Handle<JSObject> DeepCopy(Handle<JSObject> object,
AllocationSiteUsageContext* site_context,

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