| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 int allocation_sites = 0; | 514 int allocation_sites = 0; |
| 515 int active_allocation_sites = 0; | 515 int active_allocation_sites = 0; |
| 516 | 516 |
| 517 // If the scratchpad overflowed, we have to iterate over the allocation | 517 // If the scratchpad overflowed, we have to iterate over the allocation |
| 518 // sites list. | 518 // sites list. |
| 519 bool use_scratchpad = | 519 bool use_scratchpad = |
| 520 allocation_sites_scratchpad_length < kAllocationSiteScratchpadSize; | 520 allocation_sites_scratchpad_length < kAllocationSiteScratchpadSize; |
| 521 | 521 |
| 522 int i = 0; | 522 int i = 0; |
| 523 Object* list_element = allocation_sites_list(); | 523 Object* list_element = allocation_sites_list(); |
| 524 bool trigger_deoptimization = false; |
| 524 while (use_scratchpad ? | 525 while (use_scratchpad ? |
| 525 i < allocation_sites_scratchpad_length : | 526 i < allocation_sites_scratchpad_length : |
| 526 list_element->IsAllocationSite()) { | 527 list_element->IsAllocationSite()) { |
| 527 AllocationSite* site = use_scratchpad ? | 528 AllocationSite* site = use_scratchpad ? |
| 528 allocation_sites_scratchpad[i] : AllocationSite::cast(list_element); | 529 allocation_sites_scratchpad[i] : AllocationSite::cast(list_element); |
| 529 allocation_mementos_found += site->memento_found_count(); | 530 allocation_mementos_found += site->memento_found_count(); |
| 530 if (site->memento_found_count() > 0) { | 531 if (site->memento_found_count() > 0) { |
| 531 active_allocation_sites++; | 532 active_allocation_sites++; |
| 532 } | 533 } |
| 533 if (site->DigestPretenuringFeedback()) { | 534 if (site->DigestPretenuringFeedback()) trigger_deoptimization = true; |
| 534 if (site->GetPretenureMode() == TENURED) { | 535 if (site->GetPretenureMode() == TENURED) { |
| 535 tenure_decisions++; | 536 tenure_decisions++; |
| 536 } else { | 537 } else { |
| 537 dont_tenure_decisions++; | 538 dont_tenure_decisions++; |
| 538 } | |
| 539 } | 539 } |
| 540 allocation_sites++; | 540 allocation_sites++; |
| 541 if (use_scratchpad) { | 541 if (use_scratchpad) { |
| 542 i++; | 542 i++; |
| 543 } else { | 543 } else { |
| 544 list_element = site->weak_next(); | 544 list_element = site->weak_next(); |
| 545 } | 545 } |
| 546 } | 546 } |
| 547 |
| 548 if (trigger_deoptimization) isolate_->stack_guard()->DeoptMarkedCode(); |
| 549 |
| 547 allocation_sites_scratchpad_length = 0; | 550 allocation_sites_scratchpad_length = 0; |
| 548 | 551 |
| 549 // TODO(mvstanton): Pretenure decisions are only made once for an allocation | 552 // TODO(mvstanton): Pretenure decisions are only made once for an allocation |
| 550 // site. Find a sane way to decide about revisiting the decision later. | 553 // site. Find a sane way to decide about revisiting the decision later. |
| 551 | 554 |
| 552 if (FLAG_trace_track_allocation_sites && | 555 if (FLAG_trace_track_allocation_sites && |
| 553 (allocation_mementos_found > 0 || | 556 (allocation_mementos_found > 0 || |
| 554 tenure_decisions > 0 || | 557 tenure_decisions > 0 || |
| 555 dont_tenure_decisions > 0)) { | 558 dont_tenure_decisions > 0)) { |
| 556 PrintF("GC: (mode, #visited allocation sites, #active allocation sites, " | 559 PrintF("GC: (mode, #visited allocation sites, #active allocation sites, " |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1976 bool record_slots) { | 1979 bool record_slots) { |
| 1977 Object* allocation_site_obj = | 1980 Object* allocation_site_obj = |
| 1978 VisitWeakList<AllocationSite>(this, | 1981 VisitWeakList<AllocationSite>(this, |
| 1979 allocation_sites_list(), | 1982 allocation_sites_list(), |
| 1980 retainer, record_slots); | 1983 retainer, record_slots); |
| 1981 set_allocation_sites_list(allocation_site_obj); | 1984 set_allocation_sites_list(allocation_site_obj); |
| 1982 } | 1985 } |
| 1983 | 1986 |
| 1984 | 1987 |
| 1985 void Heap::ResetAllAllocationSitesDependentCode(PretenureFlag flag) { | 1988 void Heap::ResetAllAllocationSitesDependentCode(PretenureFlag flag) { |
| 1989 ASSERT(AllowCodeDependencyChange::IsAllowed()); |
| 1990 DisallowHeapAllocation no_allocation_scope; |
| 1986 Object* cur = allocation_sites_list(); | 1991 Object* cur = allocation_sites_list(); |
| 1992 bool marked = false; |
| 1987 while (cur->IsAllocationSite()) { | 1993 while (cur->IsAllocationSite()) { |
| 1988 AllocationSite* casted = AllocationSite::cast(cur); | 1994 AllocationSite* casted = AllocationSite::cast(cur); |
| 1989 if (casted->GetPretenureMode() == flag) { | 1995 if (casted->GetPretenureMode() == flag) { |
| 1990 casted->ResetPretenureDecision(); | 1996 casted->ResetPretenureDecision(); |
| 1997 bool got_marked = casted->dependent_code()->MarkCodeForDeoptimization( |
| 1998 isolate_, |
| 1999 DependentCode::kAllocationSiteTenuringChangedGroup); |
| 2000 if (got_marked) marked = true; |
| 1991 } | 2001 } |
| 1992 cur = casted->weak_next(); | 2002 cur = casted->weak_next(); |
| 1993 } | 2003 } |
| 2004 if (marked) isolate_->stack_guard()->DeoptMarkedCode(); |
| 1994 } | 2005 } |
| 1995 | 2006 |
| 1996 | 2007 |
| 1997 void Heap::EvaluateOldSpaceLocalPretenuring( | 2008 void Heap::EvaluateOldSpaceLocalPretenuring( |
| 1998 uint64_t size_of_objects_before_gc) { | 2009 uint64_t size_of_objects_before_gc) { |
| 1999 uint64_t size_of_objects_after_gc = SizeOfObjects(); | 2010 uint64_t size_of_objects_after_gc = SizeOfObjects(); |
| 2000 double old_generation_survival_rate = | 2011 double old_generation_survival_rate = |
| 2001 (static_cast<double>(size_of_objects_after_gc) * 100) / | 2012 (static_cast<double>(size_of_objects_after_gc) * 100) / |
| 2002 static_cast<double>(size_of_objects_before_gc); | 2013 static_cast<double>(size_of_objects_before_gc); |
| 2003 | 2014 |
| (...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3397 if (!maybe_obj->ToObject(&obj)) return false; | 3408 if (!maybe_obj->ToObject(&obj)) return false; |
| 3398 } | 3409 } |
| 3399 set_regexp_multiple_cache(FixedArray::cast(obj)); | 3410 set_regexp_multiple_cache(FixedArray::cast(obj)); |
| 3400 | 3411 |
| 3401 // Allocate cache for external strings pointing to native source code. | 3412 // Allocate cache for external strings pointing to native source code. |
| 3402 { MaybeObject* maybe_obj = AllocateFixedArray(Natives::GetBuiltinsCount()); | 3413 { MaybeObject* maybe_obj = AllocateFixedArray(Natives::GetBuiltinsCount()); |
| 3403 if (!maybe_obj->ToObject(&obj)) return false; | 3414 if (!maybe_obj->ToObject(&obj)) return false; |
| 3404 } | 3415 } |
| 3405 set_natives_source_cache(FixedArray::cast(obj)); | 3416 set_natives_source_cache(FixedArray::cast(obj)); |
| 3406 | 3417 |
| 3418 { MaybeObject* maybe_obj = AllocateCell(undefined_value()); |
| 3419 if (!maybe_obj->ToObject(&obj)) return false; |
| 3420 } |
| 3421 set_undefined_cell(Cell::cast(obj)); |
| 3422 |
| 3407 // Allocate object to hold object observation state. | 3423 // Allocate object to hold object observation state. |
| 3408 { MaybeObject* maybe_obj = AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); | 3424 { MaybeObject* maybe_obj = AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
| 3409 if (!maybe_obj->ToObject(&obj)) return false; | 3425 if (!maybe_obj->ToObject(&obj)) return false; |
| 3410 } | 3426 } |
| 3411 { MaybeObject* maybe_obj = AllocateJSObjectFromMap(Map::cast(obj)); | 3427 { MaybeObject* maybe_obj = AllocateJSObjectFromMap(Map::cast(obj)); |
| 3412 if (!maybe_obj->ToObject(&obj)) return false; | 3428 if (!maybe_obj->ToObject(&obj)) return false; |
| 3413 } | 3429 } |
| 3414 set_observation_state(JSObject::cast(obj)); | 3430 set_observation_state(JSObject::cast(obj)); |
| 3415 | 3431 |
| 3416 { MaybeObject* maybe_obj = AllocateSymbol(); | 3432 { MaybeObject* maybe_obj = AllocateSymbol(); |
| (...skipping 4372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7789 static_cast<int>(object_sizes_last_time_[index])); | 7805 static_cast<int>(object_sizes_last_time_[index])); |
| 7790 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7806 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7791 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7807 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7792 | 7808 |
| 7793 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7809 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7794 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7810 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7795 ClearObjectStats(); | 7811 ClearObjectStats(); |
| 7796 } | 7812 } |
| 7797 | 7813 |
| 7798 } } // namespace v8::internal | 7814 } } // namespace v8::internal |
| OLD | NEW |