| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
| 10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
| (...skipping 12578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12589 return true; | 12589 return true; |
| 12590 } | 12590 } |
| 12591 current = current_site->weak_next(); | 12591 current = current_site->weak_next(); |
| 12592 } | 12592 } |
| 12593 return false; | 12593 return false; |
| 12594 } | 12594 } |
| 12595 | 12595 |
| 12596 | 12596 |
| 12597 void AllocationSite::DigestTransitionFeedback(Handle<AllocationSite> site, | 12597 void AllocationSite::DigestTransitionFeedback(Handle<AllocationSite> site, |
| 12598 ElementsKind to_kind) { | 12598 ElementsKind to_kind) { |
| 12599 DCHECK(FLAG_allocation_site_transitioning); |
| 12599 Isolate* isolate = site->GetIsolate(); | 12600 Isolate* isolate = site->GetIsolate(); |
| 12600 | 12601 |
| 12601 if (site->SitePointsToLiteral() && site->transition_info()->IsJSArray()) { | 12602 if (site->SitePointsToLiteral() && site->transition_info()->IsJSArray()) { |
| 12602 Handle<JSArray> transition_info = | 12603 Handle<JSArray> transition_info = |
| 12603 handle(JSArray::cast(site->transition_info())); | 12604 handle(JSArray::cast(site->transition_info())); |
| 12604 ElementsKind kind = transition_info->GetElementsKind(); | 12605 ElementsKind kind = transition_info->GetElementsKind(); |
| 12605 // if kind is holey ensure that to_kind is as well. | 12606 // if kind is holey ensure that to_kind is as well. |
| 12606 if (IsHoleyElementsKind(kind)) { | 12607 if (IsHoleyElementsKind(kind)) { |
| 12607 to_kind = GetHoleyElementsKind(to_kind); | 12608 to_kind = GetHoleyElementsKind(to_kind); |
| 12608 } | 12609 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12644 isolate, DependentCode::kAllocationSiteTransitionChangedGroup); | 12645 isolate, DependentCode::kAllocationSiteTransitionChangedGroup); |
| 12645 } | 12646 } |
| 12646 } | 12647 } |
| 12647 } | 12648 } |
| 12648 | 12649 |
| 12649 | 12650 |
| 12650 // static | 12651 // static |
| 12651 void AllocationSite::AddDependentCompilationInfo(Handle<AllocationSite> site, | 12652 void AllocationSite::AddDependentCompilationInfo(Handle<AllocationSite> site, |
| 12652 Reason reason, | 12653 Reason reason, |
| 12653 CompilationInfo* info) { | 12654 CompilationInfo* info) { |
| 12655 if ((!FLAG_allocation_site_pretenuring && reason == TENURING) || |
| 12656 (!FLAG_allocation_site_transitioning && reason == TRANSITIONS)) { |
| 12657 return; |
| 12658 } |
| 12659 |
| 12654 DependentCode::DependencyGroup group = site->ToDependencyGroup(reason); | 12660 DependentCode::DependencyGroup group = site->ToDependencyGroup(reason); |
| 12655 Handle<DependentCode> dep(site->dependent_code()); | 12661 Handle<DependentCode> dep(site->dependent_code()); |
| 12656 Handle<DependentCode> codes = | 12662 Handle<DependentCode> codes = |
| 12657 DependentCode::Insert(dep, group, info->object_wrapper()); | 12663 DependentCode::Insert(dep, group, info->object_wrapper()); |
| 12658 if (*codes != site->dependent_code()) site->set_dependent_code(*codes); | 12664 if (*codes != site->dependent_code()) site->set_dependent_code(*codes); |
| 12659 info->dependencies(group)->Add(Handle<HeapObject>(*site), info->zone()); | 12665 info->dependencies(group)->Add(Handle<HeapObject>(*site), info->zone()); |
| 12660 } | 12666 } |
| 12661 | 12667 |
| 12662 | 12668 |
| 12663 const char* AllocationSite::PretenureDecisionName(PretenureDecision decision) { | 12669 const char* AllocationSite::PretenureDecisionName(PretenureDecision decision) { |
| 12664 switch (decision) { | 12670 switch (decision) { |
| 12665 case kUndecided: return "undecided"; | 12671 case kUndecided: return "undecided"; |
| 12666 case kDontTenure: return "don't tenure"; | 12672 case kDontTenure: return "don't tenure"; |
| 12667 case kMaybeTenure: return "maybe tenure"; | 12673 case kMaybeTenure: return "maybe tenure"; |
| 12668 case kTenure: return "tenure"; | 12674 case kTenure: return "tenure"; |
| 12669 case kZombie: return "zombie"; | 12675 case kZombie: return "zombie"; |
| 12670 default: UNREACHABLE(); | 12676 default: UNREACHABLE(); |
| 12671 } | 12677 } |
| 12672 return NULL; | 12678 return NULL; |
| 12673 } | 12679 } |
| 12674 | 12680 |
| 12675 | 12681 |
| 12676 void JSObject::UpdateAllocationSite(Handle<JSObject> object, | 12682 void JSObject::UpdateAllocationSite(Handle<JSObject> object, |
| 12677 ElementsKind to_kind) { | 12683 ElementsKind to_kind) { |
| 12684 if (!FLAG_allocation_site_transitioning) return; |
| 12678 if (!object->IsJSArray()) return; | 12685 if (!object->IsJSArray()) return; |
| 12679 | 12686 |
| 12680 Heap* heap = object->GetHeap(); | 12687 Heap* heap = object->GetHeap(); |
| 12681 if (!heap->InNewSpace(*object)) return; | 12688 if (!heap->InNewSpace(*object)) return; |
| 12682 | 12689 |
| 12683 Handle<AllocationSite> site; | 12690 Handle<AllocationSite> site; |
| 12684 { | 12691 { |
| 12685 DisallowHeapAllocation no_allocation; | 12692 DisallowHeapAllocation no_allocation; |
| 12686 | 12693 |
| 12687 AllocationMemento* memento = heap->FindAllocationMemento(*object); | 12694 AllocationMemento* memento = heap->FindAllocationMemento(*object); |
| (...skipping 3683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16371 Handle<DependentCode> codes = | 16378 Handle<DependentCode> codes = |
| 16372 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16379 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
| 16373 DependentCode::kPropertyCellChangedGroup, | 16380 DependentCode::kPropertyCellChangedGroup, |
| 16374 info->object_wrapper()); | 16381 info->object_wrapper()); |
| 16375 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16382 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
| 16376 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16383 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
| 16377 cell, info->zone()); | 16384 cell, info->zone()); |
| 16378 } | 16385 } |
| 16379 | 16386 |
| 16380 } } // namespace v8::internal | 16387 } } // namespace v8::internal |
| OLD | NEW |