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

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

Issue 1052593002: Revert of Fix JSON parser Handle leak (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/heap/heap.h ('k') | src/json-parser.h » ('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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 #endif 611 #endif
612 612
613 AllowHeapAllocation for_the_rest_of_the_epilogue; 613 AllowHeapAllocation for_the_rest_of_the_epilogue;
614 614
615 #ifdef DEBUG 615 #ifdef DEBUG
616 if (FLAG_print_global_handles) isolate_->global_handles()->Print(); 616 if (FLAG_print_global_handles) isolate_->global_handles()->Print();
617 if (FLAG_print_handles) PrintHandles(); 617 if (FLAG_print_handles) PrintHandles();
618 if (FLAG_gc_verbose) Print(); 618 if (FLAG_gc_verbose) Print();
619 if (FLAG_code_stats) ReportCodeStatistics("After GC"); 619 if (FLAG_code_stats) ReportCodeStatistics("After GC");
620 #endif 620 #endif
621 if (FLAG_check_handle_count) CheckHandleCount();
622 if (FLAG_deopt_every_n_garbage_collections > 0) { 621 if (FLAG_deopt_every_n_garbage_collections > 0) {
623 // TODO(jkummerow/ulan/jarin): This is not safe! We can't assume that 622 // TODO(jkummerow/ulan/jarin): This is not safe! We can't assume that
624 // the topmost optimized frame can be deoptimized safely, because it 623 // the topmost optimized frame can be deoptimized safely, because it
625 // might not have a lazy bailout point right after its current PC. 624 // might not have a lazy bailout point right after its current PC.
626 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) { 625 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) {
627 Deoptimizer::DeoptimizeAll(isolate()); 626 Deoptimizer::DeoptimizeAll(isolate());
628 gcs_since_last_deopt_ = 0; 627 gcs_since_last_deopt_ = 0;
629 } 628 }
630 } 629 }
631 630
(...skipping 5011 matching lines...) Expand 10 before | Expand all | Expand 10 after
5643 5642
5644 5643
5645 void Heap::PrintHandles() { 5644 void Heap::PrintHandles() {
5646 PrintF("Handles:\n"); 5645 PrintF("Handles:\n");
5647 PrintHandleVisitor v; 5646 PrintHandleVisitor v;
5648 isolate_->handle_scope_implementer()->Iterate(&v); 5647 isolate_->handle_scope_implementer()->Iterate(&v);
5649 } 5648 }
5650 5649
5651 #endif 5650 #endif
5652 5651
5653 class CheckHandleCountVisitor : public ObjectVisitor {
5654 public:
5655 CheckHandleCountVisitor() : handle_count_(0) {}
5656 ~CheckHandleCountVisitor() { CHECK(handle_count_ < 1000); }
5657 void VisitPointers(Object** start, Object** end) {
5658 handle_count_ += end - start;
5659 }
5660
5661 private:
5662 ptrdiff_t handle_count_;
5663 };
5664
5665
5666 void Heap::CheckHandleCount() {
5667 CheckHandleCountVisitor v;
5668 isolate_->handle_scope_implementer()->Iterate(&v);
5669 }
5670
5671 5652
5672 Space* AllSpaces::next() { 5653 Space* AllSpaces::next() {
5673 switch (counter_++) { 5654 switch (counter_++) {
5674 case NEW_SPACE: 5655 case NEW_SPACE:
5675 return heap_->new_space(); 5656 return heap_->new_space();
5676 case OLD_POINTER_SPACE: 5657 case OLD_POINTER_SPACE:
5677 return heap_->old_pointer_space(); 5658 return heap_->old_pointer_space();
5678 case OLD_DATA_SPACE: 5659 case OLD_DATA_SPACE:
5679 return heap_->old_data_space(); 5660 return heap_->old_data_space();
5680 case CODE_SPACE: 5661 case CODE_SPACE:
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
6413 static_cast<int>(object_sizes_last_time_[index])); 6394 static_cast<int>(object_sizes_last_time_[index]));
6414 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6395 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6415 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6396 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6416 6397
6417 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6398 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6418 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6399 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6419 ClearObjectStats(); 6400 ClearObjectStats();
6420 } 6401 }
6421 } 6402 }
6422 } // namespace v8::internal 6403 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/json-parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698