| Index: src/heap.cc
|
| diff --git a/src/heap.cc b/src/heap.cc
|
| index 909e7605b0f3094bec5a69472e8a38ed7eed4f5b..ddb3529491ab001a3f8e1da1acb5ca22185a03d8 100644
|
| --- a/src/heap.cc
|
| +++ b/src/heap.cc
|
| @@ -4055,7 +4055,6 @@ MaybeObject* Heap::AllocateJSObjectFromMap(Map* map, PretenureFlag pretenure) {
|
| InitializeJSObjectFromMap(JSObject::cast(obj),
|
| FixedArray::cast(properties),
|
| map);
|
| - ASSERT(JSObject::cast(obj)->HasFastSmiOrObjectElements());
|
| return obj;
|
| }
|
|
|
| @@ -4120,7 +4119,7 @@ MaybeObject* Heap::AllocateJSArrayAndStorage(
|
|
|
| FixedArrayBase* elms;
|
| MaybeObject* maybe_elms = NULL;
|
| - if (elements_kind == FAST_DOUBLE_ELEMENTS) {
|
| + if (IsFastDoubleElementsKind(elements_kind)) {
|
| if (mode == DONT_INITIALIZE_ARRAY_ELEMENTS) {
|
| maybe_elms = AllocateUninitializedFixedDoubleArray(capacity);
|
| } else {
|
| @@ -4273,7 +4272,8 @@ MaybeObject* Heap::AllocateGlobalObject(JSFunction* constructor) {
|
| }
|
|
|
|
|
| -MaybeObject* Heap::CopyJSObject(JSObject* source) {
|
| +MaybeObject* Heap::CopyJSObject(JSObject* source,
|
| + AllocationOriginTrackMode mode) {
|
| // Never used to copy functions. If functions need to be copied we
|
| // have to be careful to clear the literals array.
|
| SLOW_ASSERT(!source->IsJSFunction());
|
| @@ -4292,6 +4292,7 @@ MaybeObject* Heap::CopyJSObject(JSObject* source) {
|
| AllocateRaw(object_size, NEW_SPACE, OLD_POINTER_SPACE);
|
| if (!maybe_clone->ToObject(&clone)) return maybe_clone;
|
| }
|
| +
|
| Address clone_address = HeapObject::cast(clone)->address();
|
| CopyBlock(clone_address,
|
| source->address(),
|
| @@ -4300,9 +4301,27 @@ MaybeObject* Heap::CopyJSObject(JSObject* source) {
|
| RecordWrites(clone_address,
|
| JSObject::kHeaderSize,
|
| (object_size - JSObject::kHeaderSize) / kPointerSize);
|
| +
|
| + // Track allocation site information.
|
| + if (mode == TRACK_ALLOCATION_ORIGIN && InNewSpace(clone) && false) {
|
| + MaybeObject* maybe_alloc_info =
|
| + AllocateStruct(ALLOCATION_SITE_INFO_TYPE);
|
| + AllocationSiteInfo* alloc_info;
|
| + // If the tracking info allocation fails, just don't track the block.
|
| + if (maybe_alloc_info->To(&alloc_info)) {
|
| + alloc_info->set_map(allocation_site_info_map());
|
| + alloc_info->set_payload(source);
|
| + }
|
| + }
|
| } else {
|
| wb_mode = SKIP_WRITE_BARRIER;
|
| - { MaybeObject* maybe_clone = new_space_.AllocateRaw(object_size);
|
| +
|
| + int adjusted_object_size = object_size;
|
| + if (mode == TRACK_ALLOCATION_ORIGIN && false) {
|
| + adjusted_object_size += AllocationSiteInfo::kSize;
|
| + }
|
| +
|
| + { MaybeObject* maybe_clone = new_space_.AllocateRaw(adjusted_object_size);
|
| if (!maybe_clone->ToObject(&clone)) return maybe_clone;
|
| }
|
| SLOW_ASSERT(InNewSpace(clone));
|
| @@ -4311,7 +4330,15 @@ MaybeObject* Heap::CopyJSObject(JSObject* source) {
|
| CopyBlock(HeapObject::cast(clone)->address(),
|
| source->address(),
|
| object_size);
|
| - }
|
| +
|
| + if (mode == TRACK_ALLOCATION_ORIGIN && false) {
|
| + AllocationSiteInfo* alloc_info =
|
| + reinterpret_cast<AllocationSiteInfo*>(
|
| + reinterpret_cast<Address>(clone) + object_size);
|
| + alloc_info->set_map(allocation_site_info_map());
|
| + alloc_info->set_payload(source);
|
| + }
|
| +}
|
|
|
| SLOW_ASSERT(
|
| JSObject::cast(clone)->GetElementsKind() == source->GetElementsKind());
|
|
|