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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 v8::TryCatch* ThreadLocalTop::TryCatchHandler() { | 129 v8::TryCatch* ThreadLocalTop::TryCatchHandler() { |
130 return TRY_CATCH_FROM_ADDRESS(try_catch_handler_address()); | 130 return TRY_CATCH_FROM_ADDRESS(try_catch_handler_address()); |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 int SystemThreadManager::NumberOfParallelSystemThreads( | 134 int SystemThreadManager::NumberOfParallelSystemThreads( |
135 ParallelSystemComponent type) { | 135 ParallelSystemComponent type) { |
136 int number_of_threads = Min(OS::NumberOfCores(), kMaxThreads); | 136 int number_of_threads = Min(OS::NumberOfCores(), kMaxThreads); |
137 ASSERT(number_of_threads > 0); | 137 ASSERT(number_of_threads > 0); |
138 if (number_of_threads == 1) { | 138 if (number_of_threads == 1) { |
139 return 1; | 139 return 0; |
140 } | 140 } |
141 if (type == PARALLEL_SWEEPING) { | 141 if (type == PARALLEL_SWEEPING) { |
142 return number_of_threads; | 142 return number_of_threads; |
143 } else if (type == CONCURRENT_SWEEPING) { | 143 } else if (type == CONCURRENT_SWEEPING) { |
144 return number_of_threads - 1; | 144 return number_of_threads - 1; |
145 } else if (type == PARALLEL_MARKING) { | 145 } else if (type == PARALLEL_MARKING) { |
146 return number_of_threads; | 146 return number_of_threads; |
147 } | 147 } |
148 return 1; | 148 return 1; |
149 } | 149 } |
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2166 FLAG_marking_threads = SystemThreadManager:: | 2166 FLAG_marking_threads = SystemThreadManager:: |
2167 NumberOfParallelSystemThreads( | 2167 NumberOfParallelSystemThreads( |
2168 SystemThreadManager::PARALLEL_MARKING); | 2168 SystemThreadManager::PARALLEL_MARKING); |
2169 } | 2169 } |
2170 if (FLAG_marking_threads > 0) { | 2170 if (FLAG_marking_threads > 0) { |
2171 marking_thread_ = new MarkingThread*[FLAG_marking_threads]; | 2171 marking_thread_ = new MarkingThread*[FLAG_marking_threads]; |
2172 for (int i = 0; i < FLAG_marking_threads; i++) { | 2172 for (int i = 0; i < FLAG_marking_threads; i++) { |
2173 marking_thread_[i] = new MarkingThread(this); | 2173 marking_thread_[i] = new MarkingThread(this); |
2174 marking_thread_[i]->Start(); | 2174 marking_thread_[i]->Start(); |
2175 } | 2175 } |
| 2176 } else { |
| 2177 FLAG_parallel_marking = false; |
2176 } | 2178 } |
2177 | 2179 |
2178 if (FLAG_sweeper_threads == 0) { | 2180 if (FLAG_sweeper_threads == 0) { |
2179 if (FLAG_concurrent_sweeping) { | 2181 if (FLAG_concurrent_sweeping) { |
2180 FLAG_sweeper_threads = SystemThreadManager:: | 2182 FLAG_sweeper_threads = SystemThreadManager:: |
2181 NumberOfParallelSystemThreads( | 2183 NumberOfParallelSystemThreads( |
2182 SystemThreadManager::CONCURRENT_SWEEPING); | 2184 SystemThreadManager::CONCURRENT_SWEEPING); |
2183 } else if (FLAG_parallel_sweeping) { | 2185 } else if (FLAG_parallel_sweeping) { |
2184 FLAG_sweeper_threads = SystemThreadManager:: | 2186 FLAG_sweeper_threads = SystemThreadManager:: |
2185 NumberOfParallelSystemThreads( | 2187 NumberOfParallelSystemThreads( |
2186 SystemThreadManager::PARALLEL_SWEEPING); | 2188 SystemThreadManager::PARALLEL_SWEEPING); |
2187 } | 2189 } |
2188 } | 2190 } |
2189 if (FLAG_sweeper_threads > 0) { | 2191 if (FLAG_sweeper_threads > 0) { |
2190 sweeper_thread_ = new SweeperThread*[FLAG_sweeper_threads]; | 2192 sweeper_thread_ = new SweeperThread*[FLAG_sweeper_threads]; |
2191 for (int i = 0; i < FLAG_sweeper_threads; i++) { | 2193 for (int i = 0; i < FLAG_sweeper_threads; i++) { |
2192 sweeper_thread_[i] = new SweeperThread(this); | 2194 sweeper_thread_[i] = new SweeperThread(this); |
2193 sweeper_thread_[i]->Start(); | 2195 sweeper_thread_[i]->Start(); |
2194 } | 2196 } |
| 2197 } else { |
| 2198 FLAG_concurrent_sweeping = false; |
| 2199 FLAG_parallel_sweeping = false; |
2195 } | 2200 } |
2196 return true; | 2201 return true; |
2197 } | 2202 } |
2198 | 2203 |
2199 | 2204 |
2200 // Initialized lazily to allow early | 2205 // Initialized lazily to allow early |
2201 // v8::V8::SetAddHistogramSampleFunction calls. | 2206 // v8::V8::SetAddHistogramSampleFunction calls. |
2202 StatsTable* Isolate::stats_table() { | 2207 StatsTable* Isolate::stats_table() { |
2203 if (stats_table_ == NULL) { | 2208 if (stats_table_ == NULL) { |
2204 stats_table_ = new StatsTable; | 2209 stats_table_ = new StatsTable; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2314 | 2319 |
2315 #ifdef DEBUG | 2320 #ifdef DEBUG |
2316 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2321 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2317 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2322 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2318 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2323 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2319 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2324 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2320 #undef ISOLATE_FIELD_OFFSET | 2325 #undef ISOLATE_FIELD_OFFSET |
2321 #endif | 2326 #endif |
2322 | 2327 |
2323 } } // namespace v8::internal | 2328 } } // namespace v8::internal |
OLD | NEW |