Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: src/optimizing-compiler-thread.cc

Issue 938683002: Add --single-threaded flag that disables background threads. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/isolate.cc ('k') | test/mjsunit/single-threaded.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/optimizing-compiler-thread.h" 5 #include "src/optimizing-compiler-thread.h"
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/base/atomicops.h" 9 #include "src/base/atomicops.h"
10 #include "src/full-codegen.h" 10 #include "src/full-codegen.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } else { 365 } else {
366 // Add job to the back of the input queue. 366 // Add job to the back of the input queue.
367 base::LockGuard<base::Mutex> access_input_queue(&input_queue_mutex_); 367 base::LockGuard<base::Mutex> access_input_queue(&input_queue_mutex_);
368 DCHECK_LT(input_queue_length_, input_queue_capacity_); 368 DCHECK_LT(input_queue_length_, input_queue_capacity_);
369 input_queue_[InputQueueIndex(input_queue_length_)] = job; 369 input_queue_[InputQueueIndex(input_queue_length_)] = job;
370 input_queue_length_++; 370 input_queue_length_++;
371 } 371 }
372 if (FLAG_block_concurrent_recompilation) { 372 if (FLAG_block_concurrent_recompilation) {
373 blocked_jobs_++; 373 blocked_jobs_++;
374 } else if (job_based_recompilation_) { 374 } else if (job_based_recompilation_) {
375 DCHECK(!FLAG_single_threaded);
375 base::LockGuard<base::RecursiveMutex> lock(&task_count_mutex_); 376 base::LockGuard<base::RecursiveMutex> lock(&task_count_mutex_);
376 ++task_count_; 377 ++task_count_;
377 V8::GetCurrentPlatform()->CallOnBackgroundThread( 378 V8::GetCurrentPlatform()->CallOnBackgroundThread(
378 new CompileTask(isolate_), v8::Platform::kShortRunningTask); 379 new CompileTask(isolate_), v8::Platform::kShortRunningTask);
379 } else { 380 } else {
380 input_queue_semaphore_.Signal(); 381 input_queue_semaphore_.Signal();
381 } 382 }
382 } 383 }
383 384
384 385
385 void OptimizingCompilerThread::Unblock() { 386 void OptimizingCompilerThread::Unblock() {
386 DCHECK(!IsOptimizerThread()); 387 DCHECK(!IsOptimizerThread());
387 { 388 {
388 base::LockGuard<base::RecursiveMutex> lock(&task_count_mutex_); 389 base::LockGuard<base::RecursiveMutex> lock(&task_count_mutex_);
389 task_count_ += blocked_jobs_; 390 task_count_ += blocked_jobs_;
390 } 391 }
391 while (blocked_jobs_ > 0) { 392 while (blocked_jobs_ > 0) {
392 if (job_based_recompilation_) { 393 if (job_based_recompilation_) {
394 DCHECK(!FLAG_single_threaded);
393 V8::GetCurrentPlatform()->CallOnBackgroundThread( 395 V8::GetCurrentPlatform()->CallOnBackgroundThread(
394 new CompileTask(isolate_), v8::Platform::kShortRunningTask); 396 new CompileTask(isolate_), v8::Platform::kShortRunningTask);
395 } else { 397 } else {
396 input_queue_semaphore_.Signal(); 398 input_queue_semaphore_.Signal();
397 } 399 }
398 blocked_jobs_--; 400 blocked_jobs_--;
399 } 401 }
400 } 402 }
401 403
402 404
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 479
478 480
479 bool OptimizingCompilerThread::IsOptimizerThread() { 481 bool OptimizingCompilerThread::IsOptimizerThread() {
480 base::LockGuard<base::Mutex> lock_guard(&thread_id_mutex_); 482 base::LockGuard<base::Mutex> lock_guard(&thread_id_mutex_);
481 return ThreadId::Current().ToInteger() == thread_id_; 483 return ThreadId::Current().ToInteger() == thread_id_;
482 } 484 }
483 #endif 485 #endif
484 486
485 487
486 } } // namespace v8::internal 488 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | test/mjsunit/single-threaded.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698