Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: src/heap/heap.cc

Issue 1185633002: Additional HandleScopes to limit Handle consumption. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Refine comment. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/handles-inl.h ('k') | src/runtime/runtime-literals.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 } 641 }
642 #endif 642 #endif
643 643
644 AllowHeapAllocation for_the_rest_of_the_epilogue; 644 AllowHeapAllocation for_the_rest_of_the_epilogue;
645 645
646 #ifdef DEBUG 646 #ifdef DEBUG
647 if (FLAG_print_global_handles) isolate_->global_handles()->Print(); 647 if (FLAG_print_global_handles) isolate_->global_handles()->Print();
648 if (FLAG_print_handles) PrintHandles(); 648 if (FLAG_print_handles) PrintHandles();
649 if (FLAG_gc_verbose) Print(); 649 if (FLAG_gc_verbose) Print();
650 if (FLAG_code_stats) ReportCodeStatistics("After GC"); 650 if (FLAG_code_stats) ReportCodeStatistics("After GC");
651 if (FLAG_check_handle_count) CheckHandleCount();
651 #endif 652 #endif
652 if (FLAG_check_handle_count) CheckHandleCount();
653 if (FLAG_deopt_every_n_garbage_collections > 0) { 653 if (FLAG_deopt_every_n_garbage_collections > 0) {
654 // TODO(jkummerow/ulan/jarin): This is not safe! We can't assume that 654 // TODO(jkummerow/ulan/jarin): This is not safe! We can't assume that
655 // the topmost optimized frame can be deoptimized safely, because it 655 // the topmost optimized frame can be deoptimized safely, because it
656 // might not have a lazy bailout point right after its current PC. 656 // might not have a lazy bailout point right after its current PC.
657 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) { 657 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) {
658 Deoptimizer::DeoptimizeAll(isolate()); 658 Deoptimizer::DeoptimizeAll(isolate());
659 gcs_since_last_deopt_ = 0; 659 gcs_since_last_deopt_ = 0;
660 } 660 }
661 } 661 }
662 662
(...skipping 5181 matching lines...) Expand 10 before | Expand all | Expand 10 after
5844 PrintF("Handles:\n"); 5844 PrintF("Handles:\n");
5845 PrintHandleVisitor v; 5845 PrintHandleVisitor v;
5846 isolate_->handle_scope_implementer()->Iterate(&v); 5846 isolate_->handle_scope_implementer()->Iterate(&v);
5847 } 5847 }
5848 5848
5849 #endif 5849 #endif
5850 5850
5851 class CheckHandleCountVisitor : public ObjectVisitor { 5851 class CheckHandleCountVisitor : public ObjectVisitor {
5852 public: 5852 public:
5853 CheckHandleCountVisitor() : handle_count_(0) {} 5853 CheckHandleCountVisitor() : handle_count_(0) {}
5854 ~CheckHandleCountVisitor() { CHECK(handle_count_ < 2000); } 5854 ~CheckHandleCountVisitor() {
5855 CHECK(handle_count_ < HandleScope::kCheckHandleThreshold);
5856 }
5855 void VisitPointers(Object** start, Object** end) { 5857 void VisitPointers(Object** start, Object** end) {
5856 handle_count_ += end - start; 5858 handle_count_ += end - start;
5857 } 5859 }
5858 5860
5859 private: 5861 private:
5860 ptrdiff_t handle_count_; 5862 ptrdiff_t handle_count_;
5861 }; 5863 };
5862 5864
5863 5865
5864 void Heap::CheckHandleCount() { 5866 void Heap::CheckHandleCount() {
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
6706 *object_type = "CODE_TYPE"; \ 6708 *object_type = "CODE_TYPE"; \
6707 *object_sub_type = "CODE_AGE/" #name; \ 6709 *object_sub_type = "CODE_AGE/" #name; \
6708 return true; 6710 return true;
6709 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6711 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6710 #undef COMPARE_AND_RETURN_NAME 6712 #undef COMPARE_AND_RETURN_NAME
6711 } 6713 }
6712 return false; 6714 return false;
6713 } 6715 }
6714 } // namespace internal 6716 } // namespace internal
6715 } // namespace v8 6717 } // namespace v8
OLDNEW
« no previous file with comments | « src/handles-inl.h ('k') | src/runtime/runtime-literals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698