| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/compiler-dispatcher/compiler-dispatcher-job.h" | 5 #include "src/compiler-dispatcher/compiler-dispatcher-job.h" |
| 6 | 6 |
| 7 #include "src/assert-scope.h" | 7 #include "src/assert-scope.h" |
| 8 #include "src/compilation-info.h" | 8 #include "src/compilation-info.h" |
| 9 #include "src/compiler-dispatcher/compiler-dispatcher-tracer.h" | 9 #include "src/compiler-dispatcher/compiler-dispatcher-tracer.h" |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 bool CompilerDispatcherJob::PrepareToCompileOnMainThread() { | 285 bool CompilerDispatcherJob::PrepareToCompileOnMainThread() { |
| 286 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); | 286 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); |
| 287 DCHECK(status() == CompileJobStatus::kReadyToAnalyse); | 287 DCHECK(status() == CompileJobStatus::kReadyToAnalyse); |
| 288 COMPILER_DISPATCHER_TRACE_SCOPE(tracer_, kPrepareToCompile); | 288 COMPILER_DISPATCHER_TRACE_SCOPE(tracer_, kPrepareToCompile); |
| 289 if (trace_compiler_dispatcher_jobs_) { | 289 if (trace_compiler_dispatcher_jobs_) { |
| 290 PrintF("CompilerDispatcherJob[%p]: Preparing to compile\n", | 290 PrintF("CompilerDispatcherJob[%p]: Preparing to compile\n", |
| 291 static_cast<void*>(this)); | 291 static_cast<void*>(this)); |
| 292 } | 292 } |
| 293 | 293 |
| 294 compile_info_.reset( | 294 compile_zone_.reset(new Zone(isolate_->allocator(), ZONE_NAME)); |
| 295 new CompilationInfo(parse_info_.get(), Handle<JSFunction>::null())); | 295 compile_info_.reset(new CompilationInfo( |
| 296 compile_zone_.get(), parse_info_.get(), Handle<JSFunction>::null())); |
| 296 | 297 |
| 297 DeferredHandleScope scope(isolate_); | 298 DeferredHandleScope scope(isolate_); |
| 298 if (Compiler::Analyze(parse_info_.get())) { | 299 if (Compiler::Analyze(parse_info_.get())) { |
| 299 compile_job_.reset( | 300 compile_job_.reset( |
| 300 Compiler::PrepareUnoptimizedCompilationJob(compile_info_.get())); | 301 Compiler::PrepareUnoptimizedCompilationJob(compile_info_.get())); |
| 301 } | 302 } |
| 302 compile_info_->set_deferred_handles(scope.Detach()); | 303 compile_info_->set_deferred_handles(scope.Detach()); |
| 303 | 304 |
| 304 if (!compile_job_.get()) { | 305 if (!compile_job_.get()) { |
| 305 if (!isolate_->has_pending_exception()) isolate_->StackOverflow(); | 306 if (!isolate_->has_pending_exception()) isolate_->StackOverflow(); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 | 346 |
| 346 if (compile_job_->state() == CompilationJob::State::kFailed || | 347 if (compile_job_->state() == CompilationJob::State::kFailed || |
| 347 !Compiler::FinalizeCompilationJob(compile_job_.release())) { | 348 !Compiler::FinalizeCompilationJob(compile_job_.release())) { |
| 348 if (!isolate_->has_pending_exception()) isolate_->StackOverflow(); | 349 if (!isolate_->has_pending_exception()) isolate_->StackOverflow(); |
| 349 status_ = CompileJobStatus::kFailed; | 350 status_ = CompileJobStatus::kFailed; |
| 350 return false; | 351 return false; |
| 351 } | 352 } |
| 352 | 353 |
| 353 compile_job_.reset(); | 354 compile_job_.reset(); |
| 354 compile_info_.reset(); | 355 compile_info_.reset(); |
| 356 compile_zone_.reset(); |
| 355 handles_from_parsing_.reset(); | 357 handles_from_parsing_.reset(); |
| 356 parse_info_.reset(); | 358 parse_info_.reset(); |
| 357 | 359 |
| 358 status_ = CompileJobStatus::kDone; | 360 status_ = CompileJobStatus::kDone; |
| 359 return true; | 361 return true; |
| 360 } | 362 } |
| 361 | 363 |
| 362 void CompilerDispatcherJob::ResetOnMainThread() { | 364 void CompilerDispatcherJob::ResetOnMainThread() { |
| 363 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); | 365 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); |
| 364 | 366 |
| 365 if (trace_compiler_dispatcher_jobs_) { | 367 if (trace_compiler_dispatcher_jobs_) { |
| 366 PrintF("CompilerDispatcherJob[%p]: Resetting\n", static_cast<void*>(this)); | 368 PrintF("CompilerDispatcherJob[%p]: Resetting\n", static_cast<void*>(this)); |
| 367 } | 369 } |
| 368 | 370 |
| 369 compile_job_.reset(); | 371 compile_job_.reset(); |
| 370 compile_info_.reset(); | 372 compile_info_.reset(); |
| 373 compile_zone_.reset(); |
| 371 parser_.reset(); | 374 parser_.reset(); |
| 372 unicode_cache_.reset(); | 375 unicode_cache_.reset(); |
| 373 character_stream_.reset(); | 376 character_stream_.reset(); |
| 374 handles_from_parsing_.reset(); | 377 handles_from_parsing_.reset(); |
| 375 parse_info_.reset(); | 378 parse_info_.reset(); |
| 376 | 379 |
| 377 if (!source_.is_null()) { | 380 if (!source_.is_null()) { |
| 378 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location()); | 381 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location()); |
| 379 source_ = Handle<String>::null(); | 382 source_ = Handle<String>::null(); |
| 380 } | 383 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 return 0.0; | 420 return 0.0; |
| 418 } | 421 } |
| 419 | 422 |
| 420 void CompilerDispatcherJob::ShortPrint() { | 423 void CompilerDispatcherJob::ShortPrint() { |
| 421 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); | 424 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); |
| 422 shared_->ShortPrint(); | 425 shared_->ShortPrint(); |
| 423 } | 426 } |
| 424 | 427 |
| 425 } // namespace internal | 428 } // namespace internal |
| 426 } // namespace v8 | 429 } // namespace v8 |
| OLD | NEW |