Index: src/compiler.cc |
diff --git a/src/compiler.cc b/src/compiler.cc |
index 299b1d49fc0ecc8c3ab94b77b39683a268726a28..a98edf1113b84c7652fd253a0146d70ea6f38c93 100644 |
--- a/src/compiler.cc |
+++ b/src/compiler.cc |
@@ -70,6 +70,15 @@ struct ScopedTimer { |
// ---------------------------------------------------------------------------- |
// Implementation of CompilationJob |
+CompilationJob::CompilationJob(Isolate* isolate, CompilationInfo* info, |
+ const char* compiler_name, State initial_state) |
+ : info_(info), |
+ isolate_thread_id_(isolate->thread_id()), |
+ compiler_name_(compiler_name), |
+ state_(initial_state), |
+ stack_limit_(isolate->stack_guard()->real_climit()), |
+ executed_on_background_thread_(false) {} |
+ |
CompilationJob::Status CompilationJob::PrepareJob() { |
DCHECK(ThreadId::Current().Equals(info()->isolate()->thread_id())); |
DisallowJavascriptExecution no_js(isolate()); |
@@ -98,8 +107,10 @@ CompilationJob::Status CompilationJob::ExecuteJob() { |
no_handles.reset(new DisallowHandleAllocation()); |
no_deref.reset(new DisallowHandleDereference()); |
no_dependency_change.reset(new DisallowCodeDependencyChange()); |
+ executed_on_background_thread_ = |
+ !ThreadId::Current().Equals(isolate_thread_id_); |
} else { |
- DCHECK(ThreadId::Current().Equals(info()->isolate()->thread_id())); |
+ DCHECK(ThreadId::Current().Equals(isolate_thread_id_)); |
} |
// Delegate to the underlying implementation. |
@@ -477,6 +488,8 @@ void EnsureSharedFunctionInfosArrayOnScript(ParseInfo* info) { |
} |
MUST_USE_RESULT MaybeHandle<Code> GetUnoptimizedCode(CompilationInfo* info) { |
+ RuntimeCallTimerScope runtimeTimer( |
+ info->isolate(), &RuntimeCallStats::CompileGetUnoptimizedCode); |
VMState<COMPILER> state(info->isolate()); |
PostponeInterruptsScope postpone(info->isolate()); |
@@ -499,6 +512,9 @@ MUST_USE_RESULT MaybeHandle<Code> GetUnoptimizedCode(CompilationInfo* info) { |
MUST_USE_RESULT MaybeHandle<Code> GetCodeFromOptimizedCodeMap( |
Handle<JSFunction> function, BailoutId osr_ast_id) { |
+ RuntimeCallTimerScope runtimeTimer( |
+ function->GetIsolate(), |
+ &RuntimeCallStats::CompileGetFromOptimizedCodeMap); |
Handle<SharedFunctionInfo> shared(function->shared()); |
DisallowHeapAllocation no_gc; |
CodeAndLiterals cached = shared->SearchOptimizedCodeMap( |
@@ -882,8 +898,6 @@ MaybeHandle<Code> GetLazyCode(Handle<JSFunction> function) { |
DCHECK(!isolate->has_pending_exception()); |
DCHECK(!function->is_compiled()); |
TimerEventScope<TimerEventCompileCode> compile_timer(isolate); |
- RuntimeCallTimerScope runtimeTimer(isolate, |
- &RuntimeCallStats::CompileCodeLazy); |
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileCode"); |
AggregatedHistogramTimerScope timer(isolate->counters()->compile_lazy()); |
@@ -1045,6 +1059,8 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) { |
bool Compiler::Analyze(ParseInfo* info) { |
DCHECK_NOT_NULL(info->literal()); |
+ RuntimeCallTimerScope runtimeTimer(info->isolate(), |
+ &RuntimeCallStats::CompileAnalyse); |
if (!Rewriter::Rewrite(info)) return false; |
DeclarationScope::Analyze(info, AnalyzeMode::kRegular); |
if (!Renumber(info)) return false; |