| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 17 matching lines...) Expand all Loading... |
| 28 #include "sweeper-thread.h" | 28 #include "sweeper-thread.h" |
| 29 | 29 |
| 30 #include "v8.h" | 30 #include "v8.h" |
| 31 | 31 |
| 32 #include "isolate.h" | 32 #include "isolate.h" |
| 33 #include "v8threads.h" | 33 #include "v8threads.h" |
| 34 | 34 |
| 35 namespace v8 { | 35 namespace v8 { |
| 36 namespace internal { | 36 namespace internal { |
| 37 | 37 |
| 38 static const int kSweeperThreadStackSize = 64 * KB; |
| 39 |
| 38 SweeperThread::SweeperThread(Isolate* isolate) | 40 SweeperThread::SweeperThread(Isolate* isolate) |
| 39 : Thread("SweeperThread"), | 41 : Thread(Thread::Options("v8:SweeperThread", kSweeperThreadStackSize)), |
| 40 isolate_(isolate), | 42 isolate_(isolate), |
| 41 heap_(isolate->heap()), | 43 heap_(isolate->heap()), |
| 42 collector_(heap_->mark_compact_collector()), | 44 collector_(heap_->mark_compact_collector()), |
| 43 start_sweeping_semaphore_(OS::CreateSemaphore(0)), | 45 start_sweeping_semaphore_(OS::CreateSemaphore(0)), |
| 44 end_sweeping_semaphore_(OS::CreateSemaphore(0)), | 46 end_sweeping_semaphore_(OS::CreateSemaphore(0)), |
| 45 stop_semaphore_(OS::CreateSemaphore(0)), | 47 stop_semaphore_(OS::CreateSemaphore(0)), |
| 46 free_list_old_data_space_(heap_->paged_space(OLD_DATA_SPACE)), | 48 free_list_old_data_space_(heap_->paged_space(OLD_DATA_SPACE)), |
| 47 free_list_old_pointer_space_(heap_->paged_space(OLD_POINTER_SPACE)), | 49 free_list_old_pointer_space_(heap_->paged_space(OLD_POINTER_SPACE)), |
| 48 private_free_list_old_data_space_(heap_->paged_space(OLD_DATA_SPACE)), | 50 private_free_list_old_data_space_(heap_->paged_space(OLD_DATA_SPACE)), |
| 49 private_free_list_old_pointer_space_( | 51 private_free_list_old_pointer_space_( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 98 |
| 97 void SweeperThread::StartSweeping() { | 99 void SweeperThread::StartSweeping() { |
| 98 start_sweeping_semaphore_->Signal(); | 100 start_sweeping_semaphore_->Signal(); |
| 99 } | 101 } |
| 100 | 102 |
| 101 | 103 |
| 102 void SweeperThread::WaitForSweeperThread() { | 104 void SweeperThread::WaitForSweeperThread() { |
| 103 end_sweeping_semaphore_->Wait(); | 105 end_sweeping_semaphore_->Wait(); |
| 104 } | 106 } |
| 105 } } // namespace v8::internal | 107 } } // namespace v8::internal |
| OLD | NEW |