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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 js_entry_sp_ = NULL; | 76 js_entry_sp_ = NULL; |
77 external_callback_scope_ = NULL; | 77 external_callback_scope_ = NULL; |
78 current_vm_state_ = EXTERNAL; | 78 current_vm_state_ = EXTERNAL; |
79 try_catch_handler_ = NULL; | 79 try_catch_handler_ = NULL; |
80 context_ = NULL; | 80 context_ = NULL; |
81 thread_id_ = ThreadId::Invalid(); | 81 thread_id_ = ThreadId::Invalid(); |
82 external_caught_exception_ = false; | 82 external_caught_exception_ = false; |
83 failed_access_check_callback_ = NULL; | 83 failed_access_check_callback_ = NULL; |
84 save_context_ = NULL; | 84 save_context_ = NULL; |
85 catcher_ = NULL; | 85 catcher_ = NULL; |
86 top_lookup_result_ = NULL; | |
87 promise_on_stack_ = NULL; | 86 promise_on_stack_ = NULL; |
88 | 87 |
89 // These members are re-initialized later after deserialization | 88 // These members are re-initialized later after deserialization |
90 // is complete. | 89 // is complete. |
91 pending_exception_ = NULL; | 90 pending_exception_ = NULL; |
92 has_pending_message_ = false; | 91 has_pending_message_ = false; |
93 rethrowing_message_ = false; | 92 rethrowing_message_ = false; |
94 pending_message_obj_ = NULL; | 93 pending_message_obj_ = NULL; |
95 pending_message_script_ = NULL; | 94 pending_message_script_ = NULL; |
96 scheduled_exception_ = NULL; | 95 scheduled_exception_ = NULL; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 block = block->next_) { | 199 block = block->next_) { |
201 v->VisitPointer(bit_cast<Object**>(&(block->exception_))); | 200 v->VisitPointer(bit_cast<Object**>(&(block->exception_))); |
202 v->VisitPointer(bit_cast<Object**>(&(block->message_obj_))); | 201 v->VisitPointer(bit_cast<Object**>(&(block->message_obj_))); |
203 v->VisitPointer(bit_cast<Object**>(&(block->message_script_))); | 202 v->VisitPointer(bit_cast<Object**>(&(block->message_script_))); |
204 } | 203 } |
205 | 204 |
206 // Iterate over pointers on native execution stack. | 205 // Iterate over pointers on native execution stack. |
207 for (StackFrameIterator it(this, thread); !it.done(); it.Advance()) { | 206 for (StackFrameIterator it(this, thread); !it.done(); it.Advance()) { |
208 it.frame()->Iterate(v); | 207 it.frame()->Iterate(v); |
209 } | 208 } |
210 | |
211 // Iterate pointers in live lookup results. | |
212 thread->top_lookup_result_->Iterate(v); | |
213 } | 209 } |
214 | 210 |
215 | 211 |
216 void Isolate::Iterate(ObjectVisitor* v) { | 212 void Isolate::Iterate(ObjectVisitor* v) { |
217 ThreadLocalTop* current_t = thread_local_top(); | 213 ThreadLocalTop* current_t = thread_local_top(); |
218 Iterate(v, current_t); | 214 Iterate(v, current_t); |
219 } | 215 } |
220 | 216 |
221 | 217 |
222 void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) { | 218 void Isolate::IterateDeferredHandles(ObjectVisitor* visitor) { |
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2591 int length = detached_contexts->length(); | 2587 int length = detached_contexts->length(); |
2592 if (length == 0) return; | 2588 if (length == 0) return; |
2593 int new_length = 0; | 2589 int new_length = 0; |
2594 for (int i = 0; i < length; i += 2) { | 2590 for (int i = 0; i < length; i += 2) { |
2595 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value(); | 2591 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value(); |
2596 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1)); | 2592 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1)); |
2597 if (!cell->cleared()) { | 2593 if (!cell->cleared()) { |
2598 detached_contexts->set(new_length, Smi::FromInt(mark_sweeps + 1)); | 2594 detached_contexts->set(new_length, Smi::FromInt(mark_sweeps + 1)); |
2599 detached_contexts->set(new_length + 1, cell); | 2595 detached_contexts->set(new_length + 1, cell); |
2600 new_length += 2; | 2596 new_length += 2; |
2601 } else { | |
2602 counters()->detached_context_age_in_gc()->AddSample(mark_sweeps); | |
2603 } | 2597 } |
| 2598 counters()->detached_context_age_in_gc()->AddSample(mark_sweeps + 1); |
2604 } | 2599 } |
2605 if (FLAG_trace_detached_contexts) { | 2600 if (FLAG_trace_detached_contexts) { |
2606 PrintF("%d detached contexts are collected out of %d\n", | 2601 PrintF("%d detached contexts are collected out of %d\n", |
2607 length - new_length, length); | 2602 length - new_length, length); |
2608 for (int i = 0; i < new_length; i += 2) { | 2603 for (int i = 0; i < new_length; i += 2) { |
2609 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value(); | 2604 int mark_sweeps = Smi::cast(detached_contexts->get(i))->value(); |
2610 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1)); | 2605 WeakCell* cell = WeakCell::cast(detached_contexts->get(i + 1)); |
2611 if (mark_sweeps > 3) { | 2606 if (mark_sweeps > 3) { |
2612 PrintF("detached context 0x%p\n survived %d GCs (leak?)\n", | 2607 PrintF("detached context 0x%p\n survived %d GCs (leak?)\n", |
2613 static_cast<void*>(cell->value()), mark_sweeps); | 2608 static_cast<void*>(cell->value()), mark_sweeps); |
(...skipping 26 matching lines...) Expand all Loading... |
2640 if (prev_ && prev_->Intercept(flag)) return true; | 2635 if (prev_ && prev_->Intercept(flag)) return true; |
2641 // Then check whether this scope intercepts. | 2636 // Then check whether this scope intercepts. |
2642 if ((flag & intercept_mask_)) { | 2637 if ((flag & intercept_mask_)) { |
2643 intercepted_flags_ |= flag; | 2638 intercepted_flags_ |= flag; |
2644 return true; | 2639 return true; |
2645 } | 2640 } |
2646 return false; | 2641 return false; |
2647 } | 2642 } |
2648 | 2643 |
2649 } } // namespace v8::internal | 2644 } } // namespace v8::internal |
OLD | NEW |