Chromium Code Reviews| Index: src/objects.cc |
| diff --git a/src/objects.cc b/src/objects.cc |
| index 1d95a5c15271ab3d955e2cbd3f2b6ad1b270cc25..1201c8b0793cec2b1a29b2bae591b36b6eea79e1 100644 |
| --- a/src/objects.cc |
| +++ b/src/objects.cc |
| @@ -10637,6 +10637,32 @@ MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) { |
| if (from_kind == to_kind) return this; |
| + // Are we in new space? |
| + if (FLAG_use_allocation_site_info && GetHeap()->InNewSpace(this)) { |
|
danno
2012/12/26 10:32:01
The machinery that checks/gets an AllocationSiteIn
mvstanton
2013/01/03 14:40:43
Done.
|
| + // Are we below the top of the heap? |
| + Address ptr_end = (reinterpret_cast<Address>(this) - 1) + Size(); |
| + if ((ptr_end + AllocationSiteInfo::kSize) <= GetHeap()->NewSpaceTop()) { |
| + // There is room for allocation info. Do we have some? |
| + Map** possible_allocation_map = reinterpret_cast<Map**>(ptr_end); |
| + if (*possible_allocation_map == GetHeap()->allocation_site_info_map()) { |
| + AllocationSiteInfo* info = AllocationSiteInfo::cast( |
| + reinterpret_cast<Object*>(ptr_end + 1)); |
| + JSObject* payload = JSObject::cast(info->payload()); |
| + if (payload->GetElementsKind() != to_kind) { |
| + if (IsMoreGeneralElementsKindTransition( |
| + payload->GetElementsKind(), |
| + to_kind)) { |
| + PrintF("Transitioning array to %s\n", |
| + ElementsKindToString(to_kind)); |
| + MaybeObject* maybe_result = |
| + payload->TransitionElementsKind(to_kind); |
| + if (maybe_result->IsFailure()) return maybe_result; |
| + } |
| + } |
| + } |
| + } |
| + } |
| + |
| Isolate* isolate = GetIsolate(); |
| if (elements() == isolate->heap()->empty_fixed_array() || |
| (IsFastSmiOrObjectElementsKind(from_kind) && |