| 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/compilation-cache.h" | 9 #include "src/compilation-cache.h" |
| 10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 } | 606 } |
| 607 | 607 |
| 608 | 608 |
| 609 bool MarkCompactCollector::IsSweepingCompleted() { | 609 bool MarkCompactCollector::IsSweepingCompleted() { |
| 610 for (int i = 0; i < isolate()->num_sweeper_threads(); i++) { | 610 for (int i = 0; i < isolate()->num_sweeper_threads(); i++) { |
| 611 if (!isolate()->sweeper_threads()[i]->SweepingCompleted()) { | 611 if (!isolate()->sweeper_threads()[i]->SweepingCompleted()) { |
| 612 return false; | 612 return false; |
| 613 } | 613 } |
| 614 } | 614 } |
| 615 if (FLAG_job_based_sweeping) { | 615 if (FLAG_job_based_sweeping) { |
| 616 if (!pending_sweeper_jobs_semaphore_.WaitFor(TimeDelta::FromSeconds(0))) { | 616 if (!pending_sweeper_jobs_semaphore_.WaitFor( |
| 617 base::TimeDelta::FromSeconds(0))) { |
| 617 return false; | 618 return false; |
| 618 } | 619 } |
| 619 pending_sweeper_jobs_semaphore_.Signal(); | 620 pending_sweeper_jobs_semaphore_.Signal(); |
| 620 } | 621 } |
| 621 return true; | 622 return true; |
| 622 } | 623 } |
| 623 | 624 |
| 624 | 625 |
| 625 void MarkCompactCollector::RefillFreeList(PagedSpace* space) { | 626 void MarkCompactCollector::RefillFreeList(PagedSpace* space) { |
| 626 FreeList* free_list; | 627 FreeList* free_list; |
| (...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3232 static void SweepPrecisely(PagedSpace* space, | 3233 static void SweepPrecisely(PagedSpace* space, |
| 3233 Page* p, | 3234 Page* p, |
| 3234 ObjectVisitor* v) { | 3235 ObjectVisitor* v) { |
| 3235 ASSERT(!p->IsEvacuationCandidate() && !p->WasSwept()); | 3236 ASSERT(!p->IsEvacuationCandidate() && !p->WasSwept()); |
| 3236 ASSERT_EQ(skip_list_mode == REBUILD_SKIP_LIST, | 3237 ASSERT_EQ(skip_list_mode == REBUILD_SKIP_LIST, |
| 3237 space->identity() == CODE_SPACE); | 3238 space->identity() == CODE_SPACE); |
| 3238 ASSERT((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); | 3239 ASSERT((p->skip_list() == NULL) || (skip_list_mode == REBUILD_SKIP_LIST)); |
| 3239 | 3240 |
| 3240 double start_time = 0.0; | 3241 double start_time = 0.0; |
| 3241 if (FLAG_print_cumulative_gc_stat) { | 3242 if (FLAG_print_cumulative_gc_stat) { |
| 3242 start_time = OS::TimeCurrentMillis(); | 3243 start_time = base::OS::TimeCurrentMillis(); |
| 3243 } | 3244 } |
| 3244 | 3245 |
| 3245 p->MarkSweptPrecisely(); | 3246 p->MarkSweptPrecisely(); |
| 3246 | 3247 |
| 3247 Address free_start = p->area_start(); | 3248 Address free_start = p->area_start(); |
| 3248 ASSERT(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); | 3249 ASSERT(reinterpret_cast<intptr_t>(free_start) % (32 * kPointerSize) == 0); |
| 3249 int offsets[16]; | 3250 int offsets[16]; |
| 3250 | 3251 |
| 3251 SkipList* skip_list = p->skip_list(); | 3252 SkipList* skip_list = p->skip_list(); |
| 3252 int curr_region = -1; | 3253 int curr_region = -1; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3301 } | 3302 } |
| 3302 space->Free(free_start, static_cast<int>(p->area_end() - free_start)); | 3303 space->Free(free_start, static_cast<int>(p->area_end() - free_start)); |
| 3303 #ifdef ENABLE_GDB_JIT_INTERFACE | 3304 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 3304 if (FLAG_gdbjit && space->identity() == CODE_SPACE) { | 3305 if (FLAG_gdbjit && space->identity() == CODE_SPACE) { |
| 3305 GDBJITInterface::RemoveCodeRange(free_start, p->area_end()); | 3306 GDBJITInterface::RemoveCodeRange(free_start, p->area_end()); |
| 3306 } | 3307 } |
| 3307 #endif | 3308 #endif |
| 3308 } | 3309 } |
| 3309 p->ResetLiveBytes(); | 3310 p->ResetLiveBytes(); |
| 3310 if (FLAG_print_cumulative_gc_stat) { | 3311 if (FLAG_print_cumulative_gc_stat) { |
| 3311 space->heap()->AddSweepingTime(OS::TimeCurrentMillis() - start_time); | 3312 space->heap()->AddSweepingTime(base::OS::TimeCurrentMillis() - start_time); |
| 3312 } | 3313 } |
| 3313 } | 3314 } |
| 3314 | 3315 |
| 3315 | 3316 |
| 3316 static bool SetMarkBitsUnderInvalidatedCode(Code* code, bool value) { | 3317 static bool SetMarkBitsUnderInvalidatedCode(Code* code, bool value) { |
| 3317 Page* p = Page::FromAddress(code->address()); | 3318 Page* p = Page::FromAddress(code->address()); |
| 3318 | 3319 |
| 3319 if (p->IsEvacuationCandidate() || | 3320 if (p->IsEvacuationCandidate() || |
| 3320 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { | 3321 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { |
| 3321 return false; | 3322 return false; |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4488 while (buffer != NULL) { | 4489 while (buffer != NULL) { |
| 4489 SlotsBuffer* next_buffer = buffer->next(); | 4490 SlotsBuffer* next_buffer = buffer->next(); |
| 4490 DeallocateBuffer(buffer); | 4491 DeallocateBuffer(buffer); |
| 4491 buffer = next_buffer; | 4492 buffer = next_buffer; |
| 4492 } | 4493 } |
| 4493 *buffer_address = NULL; | 4494 *buffer_address = NULL; |
| 4494 } | 4495 } |
| 4495 | 4496 |
| 4496 | 4497 |
| 4497 } } // namespace v8::internal | 4498 } } // namespace v8::internal |
| OLD | NEW |