| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "code-stubs.h" | 32 #include "code-stubs.h" |
| 33 | 33 |
| 34 namespace v8 { | 34 namespace v8 { |
| 35 namespace internal { | 35 namespace internal { |
| 36 | 36 |
| 37 IncrementalMarking::State IncrementalMarking::state_ = STOPPED; | 37 IncrementalMarking::State IncrementalMarking::state_ = STOPPED; |
| 38 MarkingStack IncrementalMarking::marking_stack_; | 38 MarkingStack IncrementalMarking::marking_stack_; |
| 39 | 39 |
| 40 double IncrementalMarking::steps_took_ = 0; | 40 double IncrementalMarking::steps_took_ = 0; |
| 41 int IncrementalMarking::steps_count_ = 0; | 41 int IncrementalMarking::steps_count_ = 0; |
| 42 bool IncrementalMarking::should_hurry_ = false; |
| 42 | 43 |
| 43 static intptr_t allocated = 0; | 44 static intptr_t allocated = 0; |
| 44 | 45 |
| 45 class IncrementalMarkingMarkingVisitor : public ObjectVisitor { | 46 class IncrementalMarkingMarkingVisitor : public ObjectVisitor { |
| 46 public: | 47 public: |
| 47 void VisitPointer(Object** p) { | 48 void VisitPointer(Object** p) { |
| 48 MarkObjectByPointer(p); | 49 MarkObjectByPointer(p); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void VisitPointers(Object** start, Object** end) { | 52 void VisitPointers(Object** start, Object** end) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 VerifyMarkbitsAreClean(Heap::old_pointer_space()); | 139 VerifyMarkbitsAreClean(Heap::old_pointer_space()); |
| 139 VerifyMarkbitsAreClean(Heap::old_data_space()); | 140 VerifyMarkbitsAreClean(Heap::old_data_space()); |
| 140 VerifyMarkbitsAreClean(Heap::code_space()); | 141 VerifyMarkbitsAreClean(Heap::code_space()); |
| 141 VerifyMarkbitsAreClean(Heap::cell_space()); | 142 VerifyMarkbitsAreClean(Heap::cell_space()); |
| 142 VerifyMarkbitsAreClean(Heap::map_space()); | 143 VerifyMarkbitsAreClean(Heap::map_space()); |
| 143 } | 144 } |
| 144 #endif | 145 #endif |
| 145 | 146 |
| 146 bool IncrementalMarking::WorthActivating() { | 147 bool IncrementalMarking::WorthActivating() { |
| 147 #ifndef DEBUG | 148 #ifndef DEBUG |
| 148 static const intptr_t kActivationThreshold = 20*MB; | 149 static const intptr_t kActivationThreshold = 8 * MB; |
| 149 #else | 150 #else |
| 150 // TODO(gc) consider setting this to some low level so that some | 151 // TODO(gc) consider setting this to some low level so that some |
| 151 // debug tests run with incremental marking and some without. | 152 // debug tests run with incremental marking and some without. |
| 152 static const intptr_t kActivationThreshold = 0; | 153 static const intptr_t kActivationThreshold = 0; |
| 153 #endif | 154 #endif |
| 154 | 155 |
| 155 return FLAG_incremental_marking && | 156 return FLAG_incremental_marking && |
| 156 Heap::PromotedSpaceSize() > kActivationThreshold; | 157 Heap::PromotedSpaceSize() > kActivationThreshold; |
| 157 } | 158 } |
| 158 | 159 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 Hurry(); | 306 Hurry(); |
| 306 state_ = STOPPED; | 307 state_ = STOPPED; |
| 307 ResetStepCounters(); | 308 ResetStepCounters(); |
| 308 PatchIncrementalMarkingRecordWriteStubs(false); | 309 PatchIncrementalMarkingRecordWriteStubs(false); |
| 309 ASSERT(marking_stack_.is_empty()); | 310 ASSERT(marking_stack_.is_empty()); |
| 310 } | 311 } |
| 311 | 312 |
| 312 | 313 |
| 313 void IncrementalMarking::MarkingComplete() { | 314 void IncrementalMarking::MarkingComplete() { |
| 314 state_ = COMPLETE; | 315 state_ = COMPLETE; |
| 316 // We will set the stack guard to request a GC now. This will mean the rest |
| 317 // of the GC gets performed as soon as possible (we can't do a GC here in a |
| 318 // record-write context). If a few things get allocated between now and then |
| 319 // that shouldn't make us do a scavenge and keep being incremental, so we set |
| 320 // the should-hurry flag to indicate that there can't be much work left to do. |
| 321 set_should_hurry(true); |
| 315 if (FLAG_trace_incremental_marking) { | 322 if (FLAG_trace_incremental_marking) { |
| 316 PrintF("[IncrementalMarking] Complete (normal).\n"); | 323 PrintF("[IncrementalMarking] Complete (normal).\n"); |
| 317 } | 324 } |
| 318 StackGuard::RequestGC(); | 325 StackGuard::RequestGC(); |
| 319 } | 326 } |
| 320 | 327 |
| 321 | 328 |
| 322 void IncrementalMarking::Step(intptr_t allocated_bytes) { | 329 void IncrementalMarking::Step(intptr_t allocated_bytes) { |
| 323 if (state_ == MARKING && | 330 if (state_ == MARKING && |
| 324 Heap::gc_state() == Heap::NOT_IN_GC && | 331 Heap::gc_state() == Heap::NOT_IN_GC && |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 double end = OS::TimeCurrentMillis(); | 368 double end = OS::TimeCurrentMillis(); |
| 362 steps_took_ += (end - start); | 369 steps_took_ += (end - start); |
| 363 steps_count_++; | 370 steps_count_++; |
| 364 } | 371 } |
| 365 } | 372 } |
| 366 } | 373 } |
| 367 } | 374 } |
| 368 | 375 |
| 369 | 376 |
| 370 } } // namespace v8::internal | 377 } } // namespace v8::internal |
| OLD | NEW |