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

Side by Side Diff: src/isolate.cc

Issue 934773002: Add historgram for number of GC needed to collect a detached context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make tracking default, add tracing, and fix a bug. Created 5 years, 10 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/flag-definitions.h ('k') | no next file » | 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 2577 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 int length = detached_contexts->length(); 2588 int length = detached_contexts->length();
2589 if (length == 0) return; 2589 if (length == 0) return;
2590 int new_length = 0; 2590 int new_length = 0;
2591 for (int i = 0; i < length; i += 2) { 2591 for (int i = 0; i < length; i += 2) {
2592 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value(); 2592 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value();
2593 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1)); 2593 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1));
2594 if (!cell->cleared()) { 2594 if (!cell->cleared()) {
2595 detached_contexts->set(new_length, Smi::FromInt(mark_sweeps + 1)); 2595 detached_contexts->set(new_length, Smi::FromInt(mark_sweeps + 1));
2596 detached_contexts->set(new_length + 1, cell); 2596 detached_contexts->set(new_length + 1, cell);
2597 new_length += 2; 2597 new_length += 2;
2598 } else {
2599 counters()->detached_context_age_in_gc()->AddSample(mark_sweeps);
2598 } 2600 }
2599 } 2601 }
2600 PrintF("%d detached contexts are collected out of %d\n", length - new_length, 2602 if (FLAG_trace_detached_contexts) {
2601 length); 2603 PrintF("%d detached contexts are collected out of %d\n",
2602 for (int i = 0; i < new_length; i += 2) { 2604 length - new_length, length);
2603 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value(); 2605 for (int i = 0; i < new_length; i += 2) {
2604 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1)); 2606 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value();
2605 if (mark_sweeps > 3) { 2607 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1));
2606 PrintF("detached context 0x%p\n survived %d GCs (leak?)\n", 2608 if (mark_sweeps > 3) {
2607 static_cast<void*>(cell->value()), mark_sweeps); 2609 PrintF("detached context 0x%p\n survived %d GCs (leak?)\n",
2610 static_cast<void*>(cell->value()), mark_sweeps);
2611 }
2608 } 2612 }
2609 } 2613 }
2610 if (length == new_length) { 2614 if (new_length == 0) {
2611 heap()->set_detached_contexts(heap()->empty_fixed_array()); 2615 heap()->set_detached_contexts(heap()->empty_fixed_array());
2612 } else { 2616 } else if (new_length < length) {
2613 heap()->RightTrimFixedArray<Heap::FROM_GC>(*detached_contexts, 2617 heap()->RightTrimFixedArray<Heap::FROM_GC>(*detached_contexts,
2614 length - new_length); 2618 length - new_length);
2615 } 2619 }
2616 } 2620 }
2617 2621
2618 2622
2619 bool StackLimitCheck::JsHasOverflowed() const { 2623 bool StackLimitCheck::JsHasOverflowed() const {
2620 StackGuard* stack_guard = isolate_->stack_guard(); 2624 StackGuard* stack_guard = isolate_->stack_guard();
2621 #ifdef USE_SIMULATOR 2625 #ifdef USE_SIMULATOR
2622 // The simulator uses a separate JS stack. 2626 // The simulator uses a separate JS stack.
(...skipping 10 matching lines...) Expand all
2633 if (prev_ && prev_->Intercept(flag)) return true; 2637 if (prev_ && prev_->Intercept(flag)) return true;
2634 // Then check whether this scope intercepts. 2638 // Then check whether this scope intercepts.
2635 if ((flag & intercept_mask_)) { 2639 if ((flag & intercept_mask_)) {
2636 intercepted_flags_ |= flag; 2640 intercepted_flags_ |= flag;
2637 return true; 2641 return true;
2638 } 2642 }
2639 return false; 2643 return false;
2640 } 2644 }
2641 2645
2642 } } // namespace v8::internal 2646 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698