summaryrefslogtreecommitdiff
path: root/deps/v8/src/interpreter/interpreter.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2020-05-05 09:19:02 +0200
committerMichaël Zasso <targos@protonmail.com>2020-05-12 16:12:13 +0200
commit1d6adf7432defeb39b751a19c68335e8afb0d8ee (patch)
tree7ab67931110b8d9db770d774c7a6d0d14c976c15 /deps/v8/src/interpreter/interpreter.cc
parentaee36a04475a20c13663d1037aa6f175ff368bc7 (diff)
downloadnode-new-1d6adf7432defeb39b751a19c68335e8afb0d8ee.tar.gz
deps: update V8 to 8.3.110.9
PR-URL: https://github.com/nodejs/node/pull/32831 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps/v8/src/interpreter/interpreter.cc')
-rw-r--r--deps/v8/src/interpreter/interpreter.cc51
1 files changed, 34 insertions, 17 deletions
diff --git a/deps/v8/src/interpreter/interpreter.cc b/deps/v8/src/interpreter/interpreter.cc
index a7afb8263e..54f4a3caa3 100644
--- a/deps/v8/src/interpreter/interpreter.cc
+++ b/deps/v8/src/interpreter/interpreter.cc
@@ -12,6 +12,7 @@
#include "src/ast/scopes.h"
#include "src/codegen/compiler.h"
#include "src/codegen/unoptimized-compilation-info.h"
+#include "src/heap/off-thread-factory-inl.h"
#include "src/init/bootstrapper.h"
#include "src/init/setup-isolate.h"
#include "src/interpreter/bytecode-generator.h"
@@ -40,12 +41,20 @@ class InterpreterCompilationJob final : public UnoptimizedCompilationJob {
Status ExecuteJobImpl() final;
Status FinalizeJobImpl(Handle<SharedFunctionInfo> shared_info,
Isolate* isolate) final;
+ Status FinalizeJobImpl(Handle<SharedFunctionInfo> shared_info,
+ OffThreadIsolate* isolate) final;
private:
BytecodeGenerator* generator() { return &generator_; }
- void CheckAndPrintBytecodeMismatch(Isolate* isolate, Handle<Script> script,
+ template <typename LocalIsolate>
+ void CheckAndPrintBytecodeMismatch(LocalIsolate* isolate,
+ Handle<Script> script,
Handle<BytecodeArray> bytecode);
+ template <typename LocalIsolate>
+ Status DoFinalizeJobImpl(Handle<SharedFunctionInfo> shared_info,
+ LocalIsolate* isolate);
+
Zone zone_;
UnoptimizedCompilationInfo compilation_info_;
BytecodeGenerator generator_;
@@ -104,10 +113,6 @@ size_t Interpreter::GetDispatchTableIndex(Bytecode bytecode,
kEntriesPerOperandScale;
}
-int Interpreter::InterruptBudget() {
- return FLAG_interrupt_budget;
-}
-
namespace {
void MaybePrintAst(ParseInfo* parse_info,
@@ -171,11 +176,13 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::ExecuteJobImpl() {
}
#ifdef DEBUG
+template <typename LocalIsolate>
void InterpreterCompilationJob::CheckAndPrintBytecodeMismatch(
- Isolate* isolate, Handle<Script> script, Handle<BytecodeArray> bytecode) {
- int first_mismatch = generator()->CheckBytecodeMatches(bytecode);
+ LocalIsolate* isolate, Handle<Script> script,
+ Handle<BytecodeArray> bytecode) {
+ int first_mismatch = generator()->CheckBytecodeMatches(*bytecode);
if (first_mismatch >= 0) {
- parse_info()->ast_value_factory()->Internalize(isolate->factory());
+ parse_info()->ast_value_factory()->Internalize(isolate);
DeclarationScope::AllocateScopeInfos(parse_info(), isolate);
Handle<BytecodeArray> new_bytecode =
@@ -184,8 +191,7 @@ void InterpreterCompilationJob::CheckAndPrintBytecodeMismatch(
std::cerr << "Bytecode mismatch";
#ifdef OBJECT_PRINT
std::cerr << " found for function: ";
- Handle<String> name =
- parse_info()->function_name()->string().get<Factory>();
+ Handle<String> name = parse_info()->function_name()->string();
if (name->length() == 0) {
std::cerr << "anonymous";
} else {
@@ -214,7 +220,22 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl(
RuntimeCallCounterId::kCompileIgnitionFinalization);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.CompileIgnitionFinalization");
+ return DoFinalizeJobImpl(shared_info, isolate);
+}
+
+InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl(
+ Handle<SharedFunctionInfo> shared_info, OffThreadIsolate* isolate) {
+ RuntimeCallTimerScope runtimeTimerScope(
+ parse_info()->runtime_call_stats(),
+ RuntimeCallCounterId::kCompileBackgroundIgnitionFinalization);
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
+ "V8.CompileIgnitionFinalization");
+ return DoFinalizeJobImpl(shared_info, isolate);
+}
+template <typename LocalIsolate>
+InterpreterCompilationJob::Status InterpreterCompilationJob::DoFinalizeJobImpl(
+ Handle<SharedFunctionInfo> shared_info, LocalIsolate* isolate) {
Handle<BytecodeArray> bytecodes = compilation_info_.bytecode_array();
if (bytecodes.is_null()) {
bytecodes = generator()->FinalizeBytecode(
@@ -265,7 +286,7 @@ Interpreter::NewSourcePositionCollectionJob(
auto job = std::make_unique<InterpreterCompilationJob>(parse_info, literal,
allocator, nullptr);
job->compilation_info()->SetBytecodeArray(existing_bytecode);
- return std::unique_ptr<UnoptimizedCompilationJob> { static_cast<UnoptimizedCompilationJob*>(job.release()) };
+ return job;
}
void Interpreter::ForEachBytecode(
@@ -361,9 +382,7 @@ Local<v8::Object> Interpreter::GetDispatchCountersObject() {
if (counter > 0) {
std::string to_name = Bytecodes::ToString(to_bytecode);
Local<v8::String> to_name_object =
- v8::String::NewFromUtf8(isolate, to_name.c_str(),
- NewStringType::kNormal)
- .ToLocalChecked();
+ v8::String::NewFromUtf8(isolate, to_name.c_str()).ToLocalChecked();
Local<v8::Number> counter_object = v8::Number::New(isolate, counter);
CHECK(counters_row
->DefineOwnProperty(context, to_name_object, counter_object)
@@ -373,9 +392,7 @@ Local<v8::Object> Interpreter::GetDispatchCountersObject() {
std::string from_name = Bytecodes::ToString(from_bytecode);
Local<v8::String> from_name_object =
- v8::String::NewFromUtf8(isolate, from_name.c_str(),
- NewStringType::kNormal)
- .ToLocalChecked();
+ v8::String::NewFromUtf8(isolate, from_name.c_str()).ToLocalChecked();
CHECK(
counters_map->DefineOwnProperty(context, from_name_object, counters_row)