diff options
author | Michaël Zasso <targos@protonmail.com> | 2017-10-18 15:03:02 -0700 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2017-10-18 17:01:41 -0700 |
commit | 3d1b3df9486c0e7708065257f7311902f6b7b366 (patch) | |
tree | cb051bdeaead11e06dcd97725783e0f113afb1bf /deps/v8/src/interpreter/interpreter.cc | |
parent | e2cddbb8ccdb7b3c4a40c8acc630f68703bc77b5 (diff) | |
download | node-new-3d1b3df9486c0e7708065257f7311902f6b7b366.tar.gz |
deps: update V8 to 6.2.414.32
PR-URL: https://github.com/nodejs/node/pull/15362
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/v8/src/interpreter/interpreter.cc')
-rw-r--r-- | deps/v8/src/interpreter/interpreter.cc | 79 |
1 files changed, 43 insertions, 36 deletions
diff --git a/deps/v8/src/interpreter/interpreter.cc b/deps/v8/src/interpreter/interpreter.cc index cd0dfd9854..0509facc3c 100644 --- a/deps/v8/src/interpreter/interpreter.cc +++ b/deps/v8/src/interpreter/interpreter.cc @@ -24,7 +24,8 @@ namespace interpreter { class InterpreterCompilationJob final : public CompilationJob { public: - explicit InterpreterCompilationJob(CompilationInfo* info); + InterpreterCompilationJob(ParseInfo* parse_info, FunctionLiteral* literal, + Isolate* isolate); protected: Status PrepareJobImpl() final; @@ -34,36 +35,30 @@ class InterpreterCompilationJob final : public CompilationJob { private: class TimerScope final { public: - TimerScope(RuntimeCallStats* stats, RuntimeCallStats::CounterId counter_id) - : stats_(stats) { - if (V8_UNLIKELY(FLAG_runtime_stats)) { - RuntimeCallStats::Enter(stats_, &timer_, counter_id); - } - } - - explicit TimerScope(RuntimeCallCounter* counter) : stats_(nullptr) { - if (V8_UNLIKELY(FLAG_runtime_stats)) { + explicit TimerScope(RuntimeCallCounter* counter) + : runtime_stats_enabled_(FLAG_runtime_stats) { + if (V8_UNLIKELY(runtime_stats_enabled_ && counter != nullptr)) { timer_.Start(counter, nullptr); } } ~TimerScope() { - if (V8_UNLIKELY(FLAG_runtime_stats)) { - if (stats_) { - RuntimeCallStats::Leave(stats_, &timer_); - } else { - timer_.Stop(); - } + if (V8_UNLIKELY(runtime_stats_enabled_)) { + timer_.Stop(); } } private: - RuntimeCallStats* stats_; RuntimeCallTimer timer_; + bool runtime_stats_enabled_; + + DISALLOW_COPY_AND_ASSIGN(TimerScope); }; BytecodeGenerator* generator() { return &generator_; } + Zone zone_; + CompilationInfo compilation_info_; BytecodeGenerator generator_; RuntimeCallStats* runtime_call_stats_; RuntimeCallCounter background_execute_counter_; @@ -143,22 +138,30 @@ bool ShouldPrintBytecode(Handle<SharedFunctionInfo> shared) { } // namespace -InterpreterCompilationJob::InterpreterCompilationJob(CompilationInfo* info) - : CompilationJob(info->isolate(), info, "Ignition"), - generator_(info), - runtime_call_stats_(info->isolate()->counters()->runtime_call_stats()), +InterpreterCompilationJob::InterpreterCompilationJob(ParseInfo* parse_info, + FunctionLiteral* literal, + Isolate* isolate) + : CompilationJob(isolate, parse_info, &compilation_info_, "Ignition"), + zone_(isolate->allocator(), ZONE_NAME), + compilation_info_(&zone_, isolate, parse_info, literal), + generator_(&compilation_info_), + runtime_call_stats_(isolate->counters()->runtime_call_stats()), background_execute_counter_("CompileBackgroundIgnition") {} InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() { - CodeGenerator::MakeCodePrologue(info(), "interpreter"); + // TODO(5203): Move code out of codegen.cc once FCG goes away. + CodeGenerator::MakeCodePrologue(parse_info(), compilation_info(), + "interpreter"); return SUCCEEDED; } InterpreterCompilationJob::Status InterpreterCompilationJob::ExecuteJobImpl() { - TimerScope runtimeTimer = - executed_on_background_thread() - ? TimerScope(&background_execute_counter_) - : TimerScope(runtime_call_stats_, &RuntimeCallStats::CompileIgnition); + TimerScope runtimeTimer( + executed_on_background_thread() ? &background_execute_counter_ : nullptr); + RuntimeCallTimerScope runtimeTimerScope( + !executed_on_background_thread() ? runtime_call_stats_ : nullptr, + &RuntimeCallStats::CompileIgnition); + // TODO(lpy): add support for background compilation RCS trace. TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileIgnition"); @@ -177,30 +180,34 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl() { &background_execute_counter_); } - RuntimeCallTimerScope runtimeTimer( - runtime_call_stats_, &RuntimeCallStats::CompileIgnitionFinalization); + RuntimeCallTimerScope runtimeTimerScope( + !executed_on_background_thread() ? runtime_call_stats_ : nullptr, + &RuntimeCallStats::CompileIgnitionFinalization); Handle<BytecodeArray> bytecodes = generator()->FinalizeBytecode(isolate()); if (generator()->HasStackOverflow()) { return FAILED; } - if (ShouldPrintBytecode(info()->shared_info())) { + if (ShouldPrintBytecode(compilation_info()->shared_info())) { OFStream os(stdout); - std::unique_ptr<char[]> name = info()->GetDebugName(); - os << "[generating bytecode for function: " << info()->GetDebugName().get() - << "]" << std::endl; + std::unique_ptr<char[]> name = compilation_info()->GetDebugName(); + os << "[generating bytecode for function: " + << compilation_info()->GetDebugName().get() << "]" << std::endl; bytecodes->Disassemble(os); os << std::flush; } - info()->SetBytecodeArray(bytecodes); - info()->SetCode(info()->isolate()->builtins()->InterpreterEntryTrampoline()); + compilation_info()->SetBytecodeArray(bytecodes); + compilation_info()->SetCode( + BUILTIN_CODE(compilation_info()->isolate(), InterpreterEntryTrampoline)); return SUCCEEDED; } -CompilationJob* Interpreter::NewCompilationJob(CompilationInfo* info) { - return new InterpreterCompilationJob(info); +CompilationJob* Interpreter::NewCompilationJob(ParseInfo* parse_info, + FunctionLiteral* literal, + Isolate* isolate) { + return new InterpreterCompilationJob(parse_info, literal, isolate); } bool Interpreter::IsDispatchTableInitialized() { |