Chromium Code Reviews| 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 <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 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2591 int length = detached_contexts->length(); | 2591 int length = detached_contexts->length(); |
| 2592 if (length == 0) return; | 2592 if (length == 0) return; |
| 2593 int new_length = 0; | 2593 int new_length = 0; |
| 2594 for (int i = 0; i < length; i += 2) { | 2594 for (int i = 0; i < length; i += 2) { |
| 2595 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value(); | 2595 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value(); |
| 2596 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1)); | 2596 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1)); |
| 2597 if (!cell->cleared()) { | 2597 if (!cell->cleared()) { |
| 2598 detached_contexts->set(new_length, Smi::FromInt(mark_sweeps + 1)); | 2598 detached_contexts->set(new_length, Smi::FromInt(mark_sweeps + 1)); |
| 2599 detached_contexts->set(new_length + 1, cell); | 2599 detached_contexts->set(new_length + 1, cell); |
| 2600 new_length += 2; | 2600 new_length += 2; |
| 2601 } else { | |
| 2602 counters()->detached_context_age_in_gc()->AddSample(mark_sweeps); | |
|
ulan
2015/02/18 13:14:33
We need to sample all detached contexts, not only
| |
| 2603 } | 2601 } |
| 2602 counters()->detached_context_age_in_gc()->AddSample(mark_sweeps + 1); | |
| 2604 } | 2603 } |
| 2605 if (FLAG_trace_detached_contexts) { | 2604 if (FLAG_trace_detached_contexts) { |
| 2606 PrintF("%d detached contexts are collected out of %d\n", | 2605 PrintF("%d detached contexts are collected out of %d\n", |
| 2607 length - new_length, length); | 2606 length - new_length, length); |
| 2608 for (int i = 0; i < new_length; i += 2) { | 2607 for (int i = 0; i < new_length; i += 2) { |
| 2609 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value(); | 2608 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value(); |
| 2610 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1)); | 2609 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1)); |
| 2611 if (mark_sweeps > 3) { | 2610 if (mark_sweeps > 3) { |
| 2612 PrintF("detached context 0x%p\n survived %d GCs (leak?)\n", | 2611 PrintF("detached context 0x%p\n survived %d GCs (leak?)\n", |
| 2613 static_cast<void*>(cell->value()), mark_sweeps); | 2612 static_cast<void*>(cell->value()), mark_sweeps); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 2640 if (prev_ && prev_->Intercept(flag)) return true; | 2639 if (prev_ && prev_->Intercept(flag)) return true; |
| 2641 // Then check whether this scope intercepts. | 2640 // Then check whether this scope intercepts. |
| 2642 if ((flag & intercept_mask_)) { | 2641 if ((flag & intercept_mask_)) { |
| 2643 intercepted_flags_ |= flag; | 2642 intercepted_flags_ |= flag; |
| 2644 return true; | 2643 return true; |
| 2645 } | 2644 } |
| 2646 return false; | 2645 return false; |
| 2647 } | 2646 } |
| 2648 | 2647 |
| 2649 } } // namespace v8::internal | 2648 } } // namespace v8::internal |
| OLD | NEW |