Use a wrapper for copying object.
R=mvstanton@chromium.org Review URL: https://codereview.chromium.org/238113003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20769 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
b4932fc2a2
commit
6ff4f1d361
15
src/heap.cc
15
src/heap.cc
@ -4790,21 +4790,6 @@ MaybeObject* Heap::AllocateUninitializedFixedArray(int length) {
|
||||
}
|
||||
|
||||
|
||||
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(
|
||||
int length,
|
||||
PretenureFlag pretenure) {
|
||||
|
@ -2110,9 +2110,6 @@ class Heap {
|
||||
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();
|
||||
|
||||
|
@ -5822,10 +5822,22 @@ void JSObject::SetObserved(Handle<JSObject> object) {
|
||||
}
|
||||
|
||||
|
||||
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 @@ Handle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
|
||||
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;
|
||||
}
|
||||
|
@ -2147,6 +2147,10 @@ class JSReceiver: public HeapObject {
|
||||
// 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 @@ class JSObject: public JSReceiver {
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user