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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 } | 639 } |
640 #endif | 640 #endif |
641 | 641 |
642 AllowHeapAllocation for_the_rest_of_the_epilogue; | 642 AllowHeapAllocation for_the_rest_of_the_epilogue; |
643 | 643 |
644 #ifdef DEBUG | 644 #ifdef DEBUG |
645 if (FLAG_print_global_handles) isolate_->global_handles()->Print(); | 645 if (FLAG_print_global_handles) isolate_->global_handles()->Print(); |
646 if (FLAG_print_handles) PrintHandles(); | 646 if (FLAG_print_handles) PrintHandles(); |
647 if (FLAG_gc_verbose) Print(); | 647 if (FLAG_gc_verbose) Print(); |
648 if (FLAG_code_stats) ReportCodeStatistics("After GC"); | 648 if (FLAG_code_stats) ReportCodeStatistics("After GC"); |
| 649 if (FLAG_check_handle_count) CheckHandleCount(); |
649 #endif | 650 #endif |
650 if (FLAG_check_handle_count) CheckHandleCount(); | |
651 if (FLAG_deopt_every_n_garbage_collections > 0) { | 651 if (FLAG_deopt_every_n_garbage_collections > 0) { |
652 // TODO(jkummerow/ulan/jarin): This is not safe! We can't assume that | 652 // TODO(jkummerow/ulan/jarin): This is not safe! We can't assume that |
653 // the topmost optimized frame can be deoptimized safely, because it | 653 // the topmost optimized frame can be deoptimized safely, because it |
654 // might not have a lazy bailout point right after its current PC. | 654 // might not have a lazy bailout point right after its current PC. |
655 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) { | 655 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) { |
656 Deoptimizer::DeoptimizeAll(isolate()); | 656 Deoptimizer::DeoptimizeAll(isolate()); |
657 gcs_since_last_deopt_ = 0; | 657 gcs_since_last_deopt_ = 0; |
658 } | 658 } |
659 } | 659 } |
660 | 660 |
(...skipping 5323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5984 PrintF("Handles:\n"); | 5984 PrintF("Handles:\n"); |
5985 PrintHandleVisitor v; | 5985 PrintHandleVisitor v; |
5986 isolate_->handle_scope_implementer()->Iterate(&v); | 5986 isolate_->handle_scope_implementer()->Iterate(&v); |
5987 } | 5987 } |
5988 | 5988 |
5989 #endif | 5989 #endif |
5990 | 5990 |
5991 class CheckHandleCountVisitor : public ObjectVisitor { | 5991 class CheckHandleCountVisitor : public ObjectVisitor { |
5992 public: | 5992 public: |
5993 CheckHandleCountVisitor() : handle_count_(0) {} | 5993 CheckHandleCountVisitor() : handle_count_(0) {} |
5994 ~CheckHandleCountVisitor() { CHECK_LT(handle_count_, 2000); } | 5994 ~CheckHandleCountVisitor() { |
| 5995 CHECK(handle_count_ < HandleScope::kCheckHandleThreshold); |
| 5996 } |
5995 void VisitPointers(Object** start, Object** end) { | 5997 void VisitPointers(Object** start, Object** end) { |
5996 handle_count_ += end - start; | 5998 handle_count_ += end - start; |
5997 } | 5999 } |
5998 | 6000 |
5999 private: | 6001 private: |
6000 ptrdiff_t handle_count_; | 6002 ptrdiff_t handle_count_; |
6001 }; | 6003 }; |
6002 | 6004 |
6003 | 6005 |
6004 void Heap::CheckHandleCount() { | 6006 void Heap::CheckHandleCount() { |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6846 *object_type = "CODE_TYPE"; \ | 6848 *object_type = "CODE_TYPE"; \ |
6847 *object_sub_type = "CODE_AGE/" #name; \ | 6849 *object_sub_type = "CODE_AGE/" #name; \ |
6848 return true; | 6850 return true; |
6849 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) | 6851 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) |
6850 #undef COMPARE_AND_RETURN_NAME | 6852 #undef COMPARE_AND_RETURN_NAME |
6851 } | 6853 } |
6852 return false; | 6854 return false; |
6853 } | 6855 } |
6854 } // namespace internal | 6856 } // namespace internal |
6855 } // namespace v8 | 6857 } // namespace v8 |
OLD | NEW |