| 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/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 #endif | 613 #endif |
| 614 | 614 |
| 615 AllowHeapAllocation for_the_rest_of_the_epilogue; | 615 AllowHeapAllocation for_the_rest_of_the_epilogue; |
| 616 | 616 |
| 617 #ifdef DEBUG | 617 #ifdef DEBUG |
| 618 if (FLAG_print_global_handles) isolate_->global_handles()->Print(); | 618 if (FLAG_print_global_handles) isolate_->global_handles()->Print(); |
| 619 if (FLAG_print_handles) PrintHandles(); | 619 if (FLAG_print_handles) PrintHandles(); |
| 620 if (FLAG_gc_verbose) Print(); | 620 if (FLAG_gc_verbose) Print(); |
| 621 if (FLAG_code_stats) ReportCodeStatistics("After GC"); | 621 if (FLAG_code_stats) ReportCodeStatistics("After GC"); |
| 622 #endif | 622 #endif |
| 623 if (FLAG_check_handle_count) CheckHandleCount(); |
| 623 if (FLAG_deopt_every_n_garbage_collections > 0) { | 624 if (FLAG_deopt_every_n_garbage_collections > 0) { |
| 624 // TODO(jkummerow/ulan/jarin): This is not safe! We can't assume that | 625 // TODO(jkummerow/ulan/jarin): This is not safe! We can't assume that |
| 625 // the topmost optimized frame can be deoptimized safely, because it | 626 // the topmost optimized frame can be deoptimized safely, because it |
| 626 // might not have a lazy bailout point right after its current PC. | 627 // might not have a lazy bailout point right after its current PC. |
| 627 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) { | 628 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) { |
| 628 Deoptimizer::DeoptimizeAll(isolate()); | 629 Deoptimizer::DeoptimizeAll(isolate()); |
| 629 gcs_since_last_deopt_ = 0; | 630 gcs_since_last_deopt_ = 0; |
| 630 } | 631 } |
| 631 } | 632 } |
| 632 | 633 |
| (...skipping 5058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5691 | 5692 |
| 5692 | 5693 |
| 5693 void Heap::PrintHandles() { | 5694 void Heap::PrintHandles() { |
| 5694 PrintF("Handles:\n"); | 5695 PrintF("Handles:\n"); |
| 5695 PrintHandleVisitor v; | 5696 PrintHandleVisitor v; |
| 5696 isolate_->handle_scope_implementer()->Iterate(&v); | 5697 isolate_->handle_scope_implementer()->Iterate(&v); |
| 5697 } | 5698 } |
| 5698 | 5699 |
| 5699 #endif | 5700 #endif |
| 5700 | 5701 |
| 5702 class CheckHandleCountVisitor : public ObjectVisitor { |
| 5703 public: |
| 5704 CheckHandleCountVisitor() : handle_count_(0) {} |
| 5705 ~CheckHandleCountVisitor() { CHECK(handle_count_ < 2000); } |
| 5706 void VisitPointers(Object** start, Object** end) { |
| 5707 handle_count_ += end - start; |
| 5708 } |
| 5709 |
| 5710 private: |
| 5711 ptrdiff_t handle_count_; |
| 5712 }; |
| 5713 |
| 5714 |
| 5715 void Heap::CheckHandleCount() { |
| 5716 CheckHandleCountVisitor v; |
| 5717 isolate_->handle_scope_implementer()->Iterate(&v); |
| 5718 } |
| 5719 |
| 5701 | 5720 |
| 5702 Space* AllSpaces::next() { | 5721 Space* AllSpaces::next() { |
| 5703 switch (counter_++) { | 5722 switch (counter_++) { |
| 5704 case NEW_SPACE: | 5723 case NEW_SPACE: |
| 5705 return heap_->new_space(); | 5724 return heap_->new_space(); |
| 5706 case OLD_POINTER_SPACE: | 5725 case OLD_POINTER_SPACE: |
| 5707 return heap_->old_pointer_space(); | 5726 return heap_->old_pointer_space(); |
| 5708 case OLD_DATA_SPACE: | 5727 case OLD_DATA_SPACE: |
| 5709 return heap_->old_data_space(); | 5728 return heap_->old_data_space(); |
| 5710 case CODE_SPACE: | 5729 case CODE_SPACE: |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6443 static_cast<int>(object_sizes_last_time_[index])); | 6462 static_cast<int>(object_sizes_last_time_[index])); |
| 6444 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6463 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 6445 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6464 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 6446 | 6465 |
| 6447 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6466 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 6448 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6467 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 6449 ClearObjectStats(); | 6468 ClearObjectStats(); |
| 6450 } | 6469 } |
| 6451 } | 6470 } |
| 6452 } // namespace v8::internal | 6471 } // namespace v8::internal |
| OLD | NEW |