| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 #include "incremental-marking.h" | 30 #include "incremental-marking.h" |
| 31 | 31 |
| 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 const char* IncrementalMarking::kWhiteBitPattern = "00"; |
| 40 const char* IncrementalMarking::kBlackBitPattern = "10"; |
| 41 const char* IncrementalMarking::kGreyBitPattern = "11"; |
| 42 const char* IncrementalMarking::kImpossibleBitPattern = "01"; |
| 39 | 43 |
| 40 double IncrementalMarking::steps_took_ = 0; | 44 double IncrementalMarking::steps_took_ = 0; |
| 41 int IncrementalMarking::steps_count_ = 0; | 45 int IncrementalMarking::steps_count_ = 0; |
| 42 bool IncrementalMarking::should_hurry_ = false; | 46 bool IncrementalMarking::should_hurry_ = false; |
| 43 intptr_t IncrementalMarking::allocation_marking_factor_ = 0; | 47 intptr_t IncrementalMarking::allocation_marking_factor_ = 0; |
| 44 | 48 |
| 45 static intptr_t allocated = 0; | 49 static intptr_t allocated = 0; |
| 46 | 50 |
| 47 class IncrementalMarkingMarkingVisitor : public ObjectVisitor { | 51 class IncrementalMarkingMarkingVisitor : public ObjectVisitor { |
| 48 public: | 52 public: |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 307 } |
| 304 | 308 |
| 305 | 309 |
| 306 void IncrementalMarking::Finalize() { | 310 void IncrementalMarking::Finalize() { |
| 307 Hurry(); | 311 Hurry(); |
| 308 state_ = STOPPED; | 312 state_ = STOPPED; |
| 309 IncrementalMarking::set_should_hurry(false); | 313 IncrementalMarking::set_should_hurry(false); |
| 310 ResetStepCounters(); | 314 ResetStepCounters(); |
| 311 PatchIncrementalMarkingRecordWriteStubs(false); | 315 PatchIncrementalMarkingRecordWriteStubs(false); |
| 312 ASSERT(marking_stack_.is_empty()); | 316 ASSERT(marking_stack_.is_empty()); |
| 317 StackGuard::Continue(GC_REQUEST); |
| 313 } | 318 } |
| 314 | 319 |
| 315 | 320 |
| 316 void IncrementalMarking::MarkingComplete() { | 321 void IncrementalMarking::MarkingComplete() { |
| 317 state_ = COMPLETE; | 322 state_ = COMPLETE; |
| 318 // We will set the stack guard to request a GC now. This will mean the rest | 323 // We will set the stack guard to request a GC now. This will mean the rest |
| 319 // of the GC gets performed as soon as possible (we can't do a GC here in a | 324 // of the GC gets performed as soon as possible (we can't do a GC here in a |
| 320 // record-write context). If a few things get allocated between now and then | 325 // record-write context). If a few things get allocated between now and then |
| 321 // that shouldn't make us do a scavenge and keep being incremental, so we set | 326 // that shouldn't make us do a scavenge and keep being incremental, so we set |
| 322 // the should-hurry flag to indicate that there can't be much work left to do. | 327 // the should-hurry flag to indicate that there can't be much work left to do. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 380 |
| 376 if ((steps_count_ % kAllocationMarkingFactorSpeedupInterval) == 0) { | 381 if ((steps_count_ % kAllocationMarkingFactorSpeedupInterval) == 0) { |
| 377 allocation_marking_factor_ += kAllocationMarkingFactorSpeedup; | 382 allocation_marking_factor_ += kAllocationMarkingFactorSpeedup; |
| 378 } | 383 } |
| 379 } | 384 } |
| 380 } | 385 } |
| 381 } | 386 } |
| 382 | 387 |
| 383 | 388 |
| 384 } } // namespace v8::internal | 389 } } // namespace v8::internal |
| OLD | NEW |