OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 int allocation_mementos_found = 0; | 490 int allocation_mementos_found = 0; |
491 int allocation_sites = 0; | 491 int allocation_sites = 0; |
492 int active_allocation_sites = 0; | 492 int active_allocation_sites = 0; |
493 | 493 |
494 // If the scratchpad overflowed, we have to iterate over the allocation | 494 // If the scratchpad overflowed, we have to iterate over the allocation |
495 // sites list. | 495 // sites list. |
496 // TODO(hpayer): We iterate over the whole list of allocation sites when | 496 // TODO(hpayer): We iterate over the whole list of allocation sites when |
497 // we grew to the maximum semi-space size to deopt maybe tenured | 497 // we grew to the maximum semi-space size to deopt maybe tenured |
498 // allocation sites. We could hold the maybe tenured allocation sites | 498 // allocation sites. We could hold the maybe tenured allocation sites |
499 // in a seperate data structure if this is a performance problem. | 499 // in a seperate data structure if this is a performance problem. |
| 500 bool deopt_maybe_tenured = DeoptMaybeTenuredAllocationSites(); |
500 bool use_scratchpad = | 501 bool use_scratchpad = |
501 allocation_sites_scratchpad_length_ < kAllocationSiteScratchpadSize && | 502 allocation_sites_scratchpad_length_ < kAllocationSiteScratchpadSize && |
502 new_space_.IsAtMaximumCapacity() && | 503 !deopt_maybe_tenured; |
503 maximum_size_scavenges_ == 0; | |
504 | 504 |
505 int i = 0; | 505 int i = 0; |
506 Object* list_element = allocation_sites_list(); | 506 Object* list_element = allocation_sites_list(); |
507 bool trigger_deoptimization = false; | 507 bool trigger_deoptimization = false; |
508 bool maximum_size_scavenge = MaximumSizeScavenge(); | 508 bool maximum_size_scavenge = MaximumSizeScavenge(); |
509 while (use_scratchpad ? | 509 while (use_scratchpad ? |
510 i < allocation_sites_scratchpad_length_ : | 510 i < allocation_sites_scratchpad_length_ : |
511 list_element->IsAllocationSite()) { | 511 list_element->IsAllocationSite()) { |
512 AllocationSite* site = use_scratchpad ? | 512 AllocationSite* site = use_scratchpad ? |
513 AllocationSite::cast(allocation_sites_scratchpad()->get(i)) : | 513 AllocationSite::cast(allocation_sites_scratchpad()->get(i)) : |
514 AllocationSite::cast(list_element); | 514 AllocationSite::cast(list_element); |
515 allocation_mementos_found += site->memento_found_count(); | 515 allocation_mementos_found += site->memento_found_count(); |
516 if (site->memento_found_count() > 0) { | 516 if (site->memento_found_count() > 0) { |
517 active_allocation_sites++; | 517 active_allocation_sites++; |
518 if (site->DigestPretenuringFeedback(maximum_size_scavenge)) { | 518 if (site->DigestPretenuringFeedback(maximum_size_scavenge)) { |
519 trigger_deoptimization = true; | 519 trigger_deoptimization = true; |
520 } | 520 } |
521 if (site->GetPretenureMode() == TENURED) { | 521 if (site->GetPretenureMode() == TENURED) { |
522 tenure_decisions++; | 522 tenure_decisions++; |
523 } else { | 523 } else { |
524 dont_tenure_decisions++; | 524 dont_tenure_decisions++; |
525 } | 525 } |
526 allocation_sites++; | 526 allocation_sites++; |
527 } | 527 } |
528 | 528 |
| 529 if (deopt_maybe_tenured && site->IsMaybeTenure()) { |
| 530 site->set_deopt_dependent_code(true); |
| 531 trigger_deoptimization = true; |
| 532 } |
| 533 |
529 if (use_scratchpad) { | 534 if (use_scratchpad) { |
530 i++; | 535 i++; |
531 } else { | 536 } else { |
532 list_element = site->weak_next(); | 537 list_element = site->weak_next(); |
533 } | 538 } |
534 } | 539 } |
535 | 540 |
536 if (trigger_deoptimization) { | 541 if (trigger_deoptimization) { |
537 isolate_->stack_guard()->RequestDeoptMarkedAllocationSites(); | 542 isolate_->stack_guard()->RequestDeoptMarkedAllocationSites(); |
538 } | 543 } |
(...skipping 5885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6424 static_cast<int>(object_sizes_last_time_[index])); | 6429 static_cast<int>(object_sizes_last_time_[index])); |
6425 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6430 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6426 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6431 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6427 | 6432 |
6428 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6433 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6429 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6434 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6430 ClearObjectStats(); | 6435 ClearObjectStats(); |
6431 } | 6436 } |
6432 | 6437 |
6433 } } // namespace v8::internal | 6438 } } // namespace v8::internal |
OLD | NEW |