| 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 24 matching lines...) Expand all Loading... |
| 35 #include "codegen.h" | 35 #include "codegen.h" |
| 36 #include "compilation-cache.h" | 36 #include "compilation-cache.h" |
| 37 #include "cpu-profiler.h" | 37 #include "cpu-profiler.h" |
| 38 #include "debug.h" | 38 #include "debug.h" |
| 39 #include "deoptimizer.h" | 39 #include "deoptimizer.h" |
| 40 #include "heap-profiler.h" | 40 #include "heap-profiler.h" |
| 41 #include "hydrogen.h" | 41 #include "hydrogen.h" |
| 42 #include "isolate-inl.h" | 42 #include "isolate-inl.h" |
| 43 #include "lithium-allocator.h" | 43 #include "lithium-allocator.h" |
| 44 #include "log.h" | 44 #include "log.h" |
| 45 #include "marking-thread.h" | |
| 46 #include "messages.h" | 45 #include "messages.h" |
| 47 #include "platform.h" | 46 #include "platform.h" |
| 48 #include "regexp-stack.h" | 47 #include "regexp-stack.h" |
| 49 #include "runtime-profiler.h" | 48 #include "runtime-profiler.h" |
| 50 #include "sampler.h" | 49 #include "sampler.h" |
| 51 #include "scopeinfo.h" | 50 #include "scopeinfo.h" |
| 52 #include "serialize.h" | 51 #include "serialize.h" |
| 53 #include "simulator.h" | 52 #include "simulator.h" |
| 54 #include "spaces.h" | 53 #include "spaces.h" |
| 55 #include "stub-cache.h" | 54 #include "stub-cache.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 ParallelSystemComponent type) { | 139 ParallelSystemComponent type) { |
| 141 int number_of_threads = Min(CPU::NumberOfProcessorsOnline(), kMaxThreads); | 140 int number_of_threads = Min(CPU::NumberOfProcessorsOnline(), kMaxThreads); |
| 142 ASSERT(number_of_threads > 0); | 141 ASSERT(number_of_threads > 0); |
| 143 if (number_of_threads == 1) { | 142 if (number_of_threads == 1) { |
| 144 return 0; | 143 return 0; |
| 145 } | 144 } |
| 146 if (type == PARALLEL_SWEEPING) { | 145 if (type == PARALLEL_SWEEPING) { |
| 147 return number_of_threads; | 146 return number_of_threads; |
| 148 } else if (type == CONCURRENT_SWEEPING) { | 147 } else if (type == CONCURRENT_SWEEPING) { |
| 149 return number_of_threads - 1; | 148 return number_of_threads - 1; |
| 150 } else if (type == PARALLEL_MARKING) { | |
| 151 return number_of_threads; | |
| 152 } | 149 } |
| 153 return 1; | 150 return 1; |
| 154 } | 151 } |
| 155 | 152 |
| 156 | 153 |
| 157 // Create a dummy thread that will wait forever on a semaphore. The only | 154 // Create a dummy thread that will wait forever on a semaphore. The only |
| 158 // purpose for this thread is to have some stack area to save essential data | 155 // purpose for this thread is to have some stack area to save essential data |
| 159 // into for use by a stacks only core dump (aka minidump). | 156 // into for use by a stacks only core dump (aka minidump). |
| 160 class PreallocatedMemoryThread: public Thread { | 157 class PreallocatedMemoryThread: public Thread { |
| 161 public: | 158 public: |
| (...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1793 // be fixed once the default isolate cleanup is done. | 1790 // be fixed once the default isolate cleanup is done. |
| 1794 random_number_generator_(NULL), | 1791 random_number_generator_(NULL), |
| 1795 has_fatal_error_(false), | 1792 has_fatal_error_(false), |
| 1796 use_crankshaft_(true), | 1793 use_crankshaft_(true), |
| 1797 initialized_from_snapshot_(false), | 1794 initialized_from_snapshot_(false), |
| 1798 cpu_profiler_(NULL), | 1795 cpu_profiler_(NULL), |
| 1799 heap_profiler_(NULL), | 1796 heap_profiler_(NULL), |
| 1800 function_entry_hook_(NULL), | 1797 function_entry_hook_(NULL), |
| 1801 deferred_handles_head_(NULL), | 1798 deferred_handles_head_(NULL), |
| 1802 optimizing_compiler_thread_(NULL), | 1799 optimizing_compiler_thread_(NULL), |
| 1803 marking_thread_(NULL), | |
| 1804 sweeper_thread_(NULL), | 1800 sweeper_thread_(NULL), |
| 1805 stress_deopt_count_(0) { | 1801 stress_deopt_count_(0) { |
| 1806 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1); | 1802 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1); |
| 1807 TRACE_ISOLATE(constructor); | 1803 TRACE_ISOLATE(constructor); |
| 1808 | 1804 |
| 1809 memset(isolate_addresses_, 0, | 1805 memset(isolate_addresses_, 0, |
| 1810 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); | 1806 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); |
| 1811 | 1807 |
| 1812 heap_.isolate_ = this; | 1808 heap_.isolate_ = this; |
| 1813 stack_guard_.isolate_ = this; | 1809 stack_guard_.isolate_ = this; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1900 } | 1896 } |
| 1901 | 1897 |
| 1902 if (FLAG_sweeper_threads > 0) { | 1898 if (FLAG_sweeper_threads > 0) { |
| 1903 for (int i = 0; i < FLAG_sweeper_threads; i++) { | 1899 for (int i = 0; i < FLAG_sweeper_threads; i++) { |
| 1904 sweeper_thread_[i]->Stop(); | 1900 sweeper_thread_[i]->Stop(); |
| 1905 delete sweeper_thread_[i]; | 1901 delete sweeper_thread_[i]; |
| 1906 } | 1902 } |
| 1907 delete[] sweeper_thread_; | 1903 delete[] sweeper_thread_; |
| 1908 } | 1904 } |
| 1909 | 1905 |
| 1910 if (FLAG_marking_threads > 0) { | |
| 1911 for (int i = 0; i < FLAG_marking_threads; i++) { | |
| 1912 marking_thread_[i]->Stop(); | |
| 1913 delete marking_thread_[i]; | |
| 1914 } | |
| 1915 delete[] marking_thread_; | |
| 1916 } | |
| 1917 | |
| 1918 if (FLAG_hydrogen_stats) GetHStatistics()->Print(); | 1906 if (FLAG_hydrogen_stats) GetHStatistics()->Print(); |
| 1919 | 1907 |
| 1920 if (FLAG_print_deopt_stress) { | 1908 if (FLAG_print_deopt_stress) { |
| 1921 PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_); | 1909 PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_); |
| 1922 } | 1910 } |
| 1923 | 1911 |
| 1924 // We must stop the logger before we tear down other components. | 1912 // We must stop the logger before we tear down other components. |
| 1925 Sampler* sampler = logger_->sampler(); | 1913 Sampler* sampler = logger_->sampler(); |
| 1926 if (sampler && sampler->IsActive()) sampler->Stop(); | 1914 if (sampler && sampler->IsActive()) sampler->Stop(); |
| 1927 | 1915 |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2341 DONT_TRACK_ALLOCATION_SITE, 0); | 2329 DONT_TRACK_ALLOCATION_SITE, 0); |
| 2342 stub.InitializeInterfaceDescriptor( | 2330 stub.InitializeInterfaceDescriptor( |
| 2343 this, code_stub_interface_descriptor(CodeStub::FastCloneShallowArray)); | 2331 this, code_stub_interface_descriptor(CodeStub::FastCloneShallowArray)); |
| 2344 CompareNilICStub::InitializeForIsolate(this); | 2332 CompareNilICStub::InitializeForIsolate(this); |
| 2345 ToBooleanStub::InitializeForIsolate(this); | 2333 ToBooleanStub::InitializeForIsolate(this); |
| 2346 ArrayConstructorStubBase::InstallDescriptors(this); | 2334 ArrayConstructorStubBase::InstallDescriptors(this); |
| 2347 InternalArrayConstructorStubBase::InstallDescriptors(this); | 2335 InternalArrayConstructorStubBase::InstallDescriptors(this); |
| 2348 FastNewClosureStub::InstallDescriptors(this); | 2336 FastNewClosureStub::InstallDescriptors(this); |
| 2349 } | 2337 } |
| 2350 | 2338 |
| 2351 if (FLAG_marking_threads > 0) { | |
| 2352 marking_thread_ = new MarkingThread*[FLAG_marking_threads]; | |
| 2353 for (int i = 0; i < FLAG_marking_threads; i++) { | |
| 2354 marking_thread_[i] = new MarkingThread(this); | |
| 2355 marking_thread_[i]->Start(); | |
| 2356 } | |
| 2357 } | |
| 2358 | |
| 2359 if (FLAG_sweeper_threads > 0) { | 2339 if (FLAG_sweeper_threads > 0) { |
| 2360 sweeper_thread_ = new SweeperThread*[FLAG_sweeper_threads]; | 2340 sweeper_thread_ = new SweeperThread*[FLAG_sweeper_threads]; |
| 2361 for (int i = 0; i < FLAG_sweeper_threads; i++) { | 2341 for (int i = 0; i < FLAG_sweeper_threads; i++) { |
| 2362 sweeper_thread_[i] = new SweeperThread(this); | 2342 sweeper_thread_[i] = new SweeperThread(this); |
| 2363 sweeper_thread_[i]->Start(); | 2343 sweeper_thread_[i]->Start(); |
| 2364 } | 2344 } |
| 2365 } | 2345 } |
| 2366 | 2346 |
| 2367 initialized_from_snapshot_ = (des != NULL); | 2347 initialized_from_snapshot_ = (des != NULL); |
| 2368 | 2348 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2542 | 2522 |
| 2543 #ifdef DEBUG | 2523 #ifdef DEBUG |
| 2544 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2524 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 2545 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2525 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 2546 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2526 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 2547 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2527 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 2548 #undef ISOLATE_FIELD_OFFSET | 2528 #undef ISOLATE_FIELD_OFFSET |
| 2549 #endif | 2529 #endif |
| 2550 | 2530 |
| 2551 } } // namespace v8::internal | 2531 } } // namespace v8::internal |
| OLD | NEW |