| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 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 const char* IncrementalMarking::kWhiteBitPattern = "00"; |
| 38 const char* IncrementalMarking::kBlackBitPattern = "10"; |
| 39 const char* IncrementalMarking::kGreyBitPattern = "11"; |
| 40 const char* IncrementalMarking::kImpossibleBitPattern = "01"; |
| 37 | 41 |
| 38 IncrementalMarking::IncrementalMarking(Heap* heap) | 42 IncrementalMarking::IncrementalMarking(Heap* heap) |
| 39 : heap_(heap), | 43 : heap_(heap), |
| 40 state_(STOPPED), | 44 state_(STOPPED), |
| 41 steps_count_(0), | 45 steps_count_(0), |
| 42 steps_took_(0), | 46 steps_took_(0), |
| 43 should_hurry_(false), | 47 should_hurry_(false), |
| 44 allocation_marking_factor_(0), | 48 allocation_marking_factor_(0), |
| 45 allocated_(0) { | 49 allocated_(0) { |
| 46 } | 50 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 337 } |
| 334 | 338 |
| 335 | 339 |
| 336 void IncrementalMarking::Finalize() { | 340 void IncrementalMarking::Finalize() { |
| 337 Hurry(); | 341 Hurry(); |
| 338 state_ = STOPPED; | 342 state_ = STOPPED; |
| 339 IncrementalMarking::set_should_hurry(false); | 343 IncrementalMarking::set_should_hurry(false); |
| 340 ResetStepCounters(); | 344 ResetStepCounters(); |
| 341 PatchIncrementalMarkingRecordWriteStubs(false); | 345 PatchIncrementalMarkingRecordWriteStubs(false); |
| 342 ASSERT(marking_stack_.is_empty()); | 346 ASSERT(marking_stack_.is_empty()); |
| 347 ISOLATE->stack_guard()->Continue(GC_REQUEST); |
| 343 } | 348 } |
| 344 | 349 |
| 345 | 350 |
| 346 void IncrementalMarking::MarkingComplete() { | 351 void IncrementalMarking::MarkingComplete() { |
| 347 state_ = COMPLETE; | 352 state_ = COMPLETE; |
| 348 // We will set the stack guard to request a GC now. This will mean the rest | 353 // We will set the stack guard to request a GC now. This will mean the rest |
| 349 // of the GC gets performed as soon as possible (we can't do a GC here in a | 354 // of the GC gets performed as soon as possible (we can't do a GC here in a |
| 350 // record-write context). If a few things get allocated between now and then | 355 // record-write context). If a few things get allocated between now and then |
| 351 // that shouldn't make us do a scavenge and keep being incremental, so we set | 356 // that shouldn't make us do a scavenge and keep being incremental, so we set |
| 352 // the should-hurry flag to indicate that there can't be much work left to do. | 357 // the should-hurry flag to indicate that there can't be much work left to do. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 413 |
| 409 if ((steps_count_ % kAllocationMarkingFactorSpeedupInterval) == 0) { | 414 if ((steps_count_ % kAllocationMarkingFactorSpeedupInterval) == 0) { |
| 410 allocation_marking_factor_ += kAllocationMarkingFactorSpeedup; | 415 allocation_marking_factor_ += kAllocationMarkingFactorSpeedup; |
| 411 } | 416 } |
| 412 } | 417 } |
| 413 } | 418 } |
| 414 } | 419 } |
| 415 | 420 |
| 416 | 421 |
| 417 } } // namespace v8::internal | 422 } } // namespace v8::internal |
| OLD | NEW |