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

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

Issue 1041483004: Fix JSON parser Handle leak (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix int width issue 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();
621 if (FLAG_deopt_every_n_garbage_collections > 0) { 622 if (FLAG_deopt_every_n_garbage_collections > 0) {
622 // TODO(jkummerow/ulan/jarin): This is not safe! We can't assume that 623 // TODO(jkummerow/ulan/jarin): This is not safe! We can't assume that
623 // the topmost optimized frame can be deoptimized safely, because it 624 // the topmost optimized frame can be deoptimized safely, because it
624 // might not have a lazy bailout point right after its current PC. 625 // might not have a lazy bailout point right after its current PC.
625 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) { 626 if (++gcs_since_last_deopt_ == FLAG_deopt_every_n_garbage_collections) {
626 Deoptimizer::DeoptimizeAll(isolate()); 627 Deoptimizer::DeoptimizeAll(isolate());
627 gcs_since_last_deopt_ = 0; 628 gcs_since_last_deopt_ = 0;
628 } 629 }
629 } 630 }
630 631
(...skipping 5011 matching lines...) Expand 10 before | Expand all | Expand 10 after
5642 5643
5643 5644
5644 void Heap::PrintHandles() { 5645 void Heap::PrintHandles() {
5645 PrintF("Handles:\n"); 5646 PrintF("Handles:\n");
5646 PrintHandleVisitor v; 5647 PrintHandleVisitor v;
5647 isolate_->handle_scope_implementer()->Iterate(&v); 5648 isolate_->handle_scope_implementer()->Iterate(&v);
5648 } 5649 }
5649 5650
5650 #endif 5651 #endif
5651 5652
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
5652 5671
5653 Space* AllSpaces::next() { 5672 Space* AllSpaces::next() {
5654 switch (counter_++) { 5673 switch (counter_++) {
5655 case NEW_SPACE: 5674 case NEW_SPACE:
5656 return heap_->new_space(); 5675 return heap_->new_space();
5657 case OLD_POINTER_SPACE: 5676 case OLD_POINTER_SPACE:
5658 return heap_->old_pointer_space(); 5677 return heap_->old_pointer_space();
5659 case OLD_DATA_SPACE: 5678 case OLD_DATA_SPACE:
5660 return heap_->old_data_space(); 5679 return heap_->old_data_space();
5661 case CODE_SPACE: 5680 case CODE_SPACE:
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
6394 static_cast<int>(object_sizes_last_time_[index])); 6413 static_cast<int>(object_sizes_last_time_[index]));
6395 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6414 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6396 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6415 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6397 6416
6398 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6417 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6399 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6418 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6400 ClearObjectStats(); 6419 ClearObjectStats();
6401 } 6420 }
6402 } 6421 }
6403 } // namespace v8::internal 6422 } // 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