[log] Use v8_file_logger variable names more consistently

In preparation of renaming i::CodeEventDispatcher to i::Logger

Bug: v8:12795, chromium:1316443
Change-Id: I28e129130852d41cf5e464e083bc27cff97a0fff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3623543
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80427}
This commit is contained in:
Camillo Bruni 2022-05-09 15:16:17 +02:00 committed by V8 LUCI CQ
parent 46ca99766c
commit d60d36a89f
28 changed files with 95 additions and 87 deletions

View File

@ -9311,7 +9311,7 @@ void Isolate::SetJitCodeEventHandler(JitCodeEventOptions options,
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
// Ensure that logging is initialized for our isolate.
i_isolate->InitializeLoggingAndCounters();
i_isolate->logger()->SetCodeEventHandler(options, event_handler);
i_isolate->v8_file_logger()->SetCodeEventHandler(options, event_handler);
}
void Isolate::SetStackLimit(uintptr_t stack_limit) {

View File

@ -166,7 +166,7 @@ void ConsoleCall(
void LogTimerEvent(Isolate* isolate, BuiltinArguments args,
v8::LogEventStatus se) {
if (!isolate->logger()->is_logging()) return;
if (!isolate->v8_file_logger()->is_logging()) return;
HandleScope scope(isolate);
std::unique_ptr<char[]> name;
const char* raw_name = "default";

View File

@ -332,7 +332,7 @@ void Builtins::InitializeIsolateDataTables(Isolate* isolate) {
// static
void Builtins::EmitCodeCreateEvents(Isolate* isolate) {
if (!isolate->logger()->is_listening_to_code_events() &&
if (!isolate->v8_file_logger()->is_listening_to_code_events() &&
!isolate->is_profiling()) {
return; // No need to iterate the entire table in this case.
}

View File

@ -289,7 +289,7 @@ void Compiler::LogFunctionCompilation(Isolate* isolate,
// Log the code generation. If source information is available include
// script name and line number. Check explicitly whether logging is
// enabled as finding the line number is not free.
if (!isolate->logger()->is_listening_to_code_events() &&
if (!isolate->v8_file_logger()->is_listening_to_code_events() &&
!isolate->is_profiling() && !FLAG_log_function_events &&
!isolate->log_event_dispatcher()->is_listening_to_code_events()) {
return;

View File

@ -2100,18 +2100,18 @@ void Shell::LogGetAndStop(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
HandleScope handle_scope(isolate);
std::string file_name = i_isolate->logger()->file_name();
std::string file_name = i_isolate->v8_file_logger()->file_name();
if (!i::LogFile::IsLoggingToTemporaryFile(file_name)) {
isolate->ThrowError("Only capturing from temporary files is supported.");
return;
}
if (!i_isolate->logger()->is_logging()) {
if (!i_isolate->v8_file_logger()->is_logging()) {
isolate->ThrowError("Logging not enabled.");
return;
}
std::string raw_log;
FILE* log_file = i_isolate->logger()->TearDownAndGetLogFile();
FILE* log_file = i_isolate->v8_file_logger()->TearDownAndGetLogFile();
if (!log_file) {
isolate->ThrowError("Log file does not exist.");
return;

View File

@ -203,16 +203,16 @@ void BasicBlockProfilerData::Log(Isolate* isolate) {
for (size_t i = 0; i < n_blocks(); ++i) {
if (counts_[i] > 0) {
any_nonzero_counter = true;
isolate->logger()->BasicBlockCounterEvent(function_name_.c_str(),
block_ids_[i], counts_[i]);
isolate->v8_file_logger()->BasicBlockCounterEvent(
function_name_.c_str(), block_ids_[i], counts_[i]);
}
}
if (any_nonzero_counter) {
for (size_t i = 0; i < branches_.size(); ++i) {
isolate->logger()->BasicBlockBranchEvent(
isolate->v8_file_logger()->BasicBlockBranchEvent(
function_name_.c_str(), branches_[i].first, branches_[i].second);
}
isolate->logger()->BuiltinHashEvent(function_name_.c_str(), hash_);
isolate->v8_file_logger()->BuiltinHashEvent(function_name_.c_str(), hash_);
}
}

View File

@ -3320,8 +3320,8 @@ void Isolate::ClearSerializerData() {
}
bool Isolate::LogObjectRelocation() {
return FLAG_verify_predictable || logger()->is_logging() || is_profiling() ||
heap()->isolate()->logger()->is_listening_to_code_events() ||
return FLAG_verify_predictable || v8_file_logger()->is_logging() ||
is_profiling() || v8_file_logger()->is_listening_to_code_events() ||
(heap_profiler() != nullptr &&
heap_profiler()->is_tracking_object_moves()) ||
heap()->has_heap_object_allocation_tracker();

View File

@ -1125,7 +1125,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
}
TieringManager* tiering_manager() { return tiering_manager_; }
CompilationCache* compilation_cache() { return compilation_cache_; }
V8FileLogger* logger() {
V8FileLogger* v8_file_logger() {
// Call InitializeLoggingAndCounters() if logging is needed before
// the isolate is fully initialized.
DCHECK_NOT_NULL(v8_file_logger_);

View File

@ -76,7 +76,7 @@ class V8_EXPORT_PRIVATE LocalIsolate final : private HiddenLocalFactory {
V8FileLogger* main_thread_logger() {
// TODO(leszeks): This is needed for logging in ParseInfo. Figure out a way
// to use the LocalLogger for this instead.
return isolate_->logger();
return isolate_->v8_file_logger();
}
v8::internal::LocalFactory* factory() {
@ -108,7 +108,9 @@ class V8_EXPORT_PRIVATE LocalIsolate final : private HiddenLocalFactory {
bool is_collecting_type_profile() const;
LocalLogger* logger() const { return logger_.get(); }
// TODO(cbruni): rename this back to logger() once the V8FileLogger
// refactoring is completed.
LocalLogger* v8_file_logger() const { return logger_.get(); }
ThreadId thread_id() const { return thread_id_; }
Address stack_limit() const { return stack_limit_; }
#ifdef V8_RUNTIME_CALL_STATS

View File

@ -12,28 +12,28 @@ namespace internal {
// TODO(leszeks): Add support for logging from off-thread.
LocalLogger::LocalLogger(Isolate* isolate)
: logger_(isolate->logger()),
is_logging_(isolate->logger()->is_logging()),
: v8_file_logger_(isolate->v8_file_logger()),
is_logging_(v8_file_logger_->is_logging()),
is_listening_to_code_events_(
isolate->logger()->is_listening_to_code_events()) {}
v8_file_logger_->is_listening_to_code_events()) {}
void LocalLogger::ScriptDetails(Script script) {
logger_->ScriptDetails(script);
v8_file_logger_->ScriptDetails(script);
}
void LocalLogger::ScriptEvent(V8FileLogger::ScriptEventType type,
int script_id) {
logger_->ScriptEvent(type, script_id);
v8_file_logger_->ScriptEvent(type, script_id);
}
void LocalLogger::CodeLinePosInfoRecordEvent(Address code_start,
ByteArray source_position_table,
JitCodeEvent::CodeType code_type) {
logger_->CodeLinePosInfoRecordEvent(code_start, source_position_table,
code_type);
v8_file_logger_->CodeLinePosInfoRecordEvent(code_start, source_position_table,
code_type);
}
void LocalLogger::MapCreate(Map map) { logger_->MapCreate(map); }
void LocalLogger::MapCreate(Map map) { v8_file_logger_->MapCreate(map); }
void LocalLogger::MapDetails(Map map) { logger_->MapDetails(map); }
void LocalLogger::MapDetails(Map map) { v8_file_logger_->MapDetails(map); }
} // namespace internal
} // namespace v8

View File

@ -30,7 +30,7 @@ class LocalLogger {
void MapDetails(Map map);
private:
V8FileLogger* logger_;
V8FileLogger* v8_file_logger_;
bool is_logging_;
bool is_listening_to_code_events_;
};

View File

@ -1029,7 +1029,7 @@ void Profiler::Engage() {
CHECK(Start());
// Register to get ticks.
V8FileLogger* logger = isolate_->logger();
V8FileLogger* logger = isolate_->v8_file_logger();
logger->ticker_->SetProfiler(this);
LOG(isolate_, ProfilerBeginEvent());
@ -1037,7 +1037,7 @@ void Profiler::Engage() {
void Profiler::Disengage() {
// Stop receiving ticks.
isolate_->logger()->ticker_->ClearProfiler();
isolate_->v8_file_logger()->ticker_->ClearProfiler();
// Terminate the worker thread by setting running_ to false,
// inserting a fake element in the queue and then wait for

View File

@ -70,14 +70,14 @@ class SourcePosition;
class Ticker;
#undef LOG
#define LOG(isolate, Call) \
do { \
if (v8::internal::FLAG_log) (isolate)->logger()->Call; \
#define LOG(isolate, Call) \
do { \
if (v8::internal::FLAG_log) (isolate)->v8_file_logger()->Call; \
} while (false)
#define LOG_CODE_EVENT(isolate, Call) \
do { \
auto&& logger = (isolate)->logger(); \
auto&& logger = (isolate)->v8_file_logger(); \
if (logger->is_listening_to_code_events()) logger->Call; \
} while (false)

View File

@ -174,7 +174,7 @@ ReusableUnoptimizedCompileState::ReusableUnoptimizedCompileState(
Isolate* isolate)
: hash_seed_(HashSeed(isolate)),
allocator_(isolate->allocator()),
logger_(isolate->logger()),
v8_file_logger_(isolate->v8_file_logger()),
dispatcher_(isolate->lazy_compile_dispatcher()),
ast_string_constants_(isolate->ast_string_constants()),
ast_raw_string_zone_(allocator_,
@ -188,7 +188,7 @@ ReusableUnoptimizedCompileState::ReusableUnoptimizedCompileState(
LocalIsolate* isolate)
: hash_seed_(HashSeed(isolate)),
allocator_(isolate->allocator()),
logger_(isolate->main_thread_logger()),
v8_file_logger_(isolate->main_thread_logger()),
dispatcher_(isolate->lazy_compile_dispatcher()),
ast_string_constants_(isolate->ast_string_constants()),
ast_raw_string_zone_(allocator_,

View File

@ -205,13 +205,14 @@ class V8_EXPORT_PRIVATE ReusableUnoptimizedCompileState {
const AstStringConstants* ast_string_constants() const {
return ast_string_constants_;
}
V8FileLogger* logger() const { return logger_; }
// TODO(cbruni): Switch this back to the main logger.
V8FileLogger* v8_file_logger() const { return v8_file_logger_; }
LazyCompileDispatcher* dispatcher() const { return dispatcher_; }
private:
uint64_t hash_seed_;
AccountingAllocator* allocator_;
V8FileLogger* logger_;
V8FileLogger* v8_file_logger_;
LazyCompileDispatcher* dispatcher_;
const AstStringConstants* ast_string_constants_;
Zone ast_raw_string_zone_;
@ -251,7 +252,9 @@ class V8_EXPORT_PRIVATE ParseInfo {
const AstStringConstants* ast_string_constants() const {
return reusable_state_->ast_string_constants();
}
V8FileLogger* logger() const { return reusable_state_->logger(); }
V8FileLogger* v8_file_logger() const {
return reusable_state_->v8_file_logger();
}
LazyCompileDispatcher* dispatcher() const {
return reusable_state_->dispatcher();
}

View File

@ -246,7 +246,7 @@ class ParserBase {
ParserBase(Zone* zone, Scanner* scanner, uintptr_t stack_limit,
AstValueFactory* ast_value_factory,
PendingCompilationErrorHandler* pending_error_handler,
RuntimeCallStats* runtime_call_stats, V8FileLogger* logger,
RuntimeCallStats* runtime_call_stats, V8FileLogger* v8_file_logger,
UnoptimizedCompileFlags flags, bool parsing_on_main_thread)
: scope_(nullptr),
original_scope_(nullptr),
@ -255,7 +255,7 @@ class ParserBase {
ast_value_factory_(ast_value_factory),
ast_node_factory_(ast_value_factory, zone),
runtime_call_stats_(runtime_call_stats),
logger_(logger),
v8_file_logger_(v8_file_logger),
parsing_on_main_thread_(parsing_on_main_thread),
stack_limit_(stack_limit),
pending_error_handler_(pending_error_handler),
@ -1562,7 +1562,7 @@ class ParserBase {
AstValueFactory* ast_value_factory_; // Not owned.
typename Types::Factory ast_node_factory_;
RuntimeCallStats* runtime_call_stats_;
internal::V8FileLogger* logger_;
internal::V8FileLogger* v8_file_logger_;
bool parsing_on_main_thread_;
uintptr_t stack_limit_;
PendingCompilationErrorHandler* pending_error_handler_;
@ -4661,9 +4661,9 @@ ParserBase<Impl>::ParseArrowFunctionLiteral(
const char* event_name =
is_lazy_top_level_function ? "preparse-no-resolution" : "parse";
const char* name = "arrow function";
logger_->FunctionEvent(event_name, flags().script_id(), ms,
scope->start_position(), scope->end_position(), name,
strlen(name));
v8_file_logger_->FunctionEvent(event_name, flags().script_id(), ms,
scope->start_position(),
scope->end_position(), name, strlen(name));
}
return function_literal;

View File

@ -425,10 +425,11 @@ Expression* Parser::NewV8RuntimeFunctionForFuzzing(
Parser::Parser(LocalIsolate* local_isolate, ParseInfo* info,
Handle<Script> script)
: ParserBase<Parser>(
info->zone(), &scanner_, info->stack_limit(),
info->ast_value_factory(), info->pending_error_handler(),
info->runtime_call_stats(), info->logger(), info->flags(), true),
: ParserBase<Parser>(info->zone(), &scanner_, info->stack_limit(),
info->ast_value_factory(),
info->pending_error_handler(),
info->runtime_call_stats(), info->v8_file_logger(),
info->flags(), true),
local_isolate_(local_isolate),
info_(info),
script_(script),
@ -2761,7 +2762,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
should_preparse
? (is_top_level ? "preparse-no-resolution" : "preparse-resolution")
: "full-parse";
logger_->FunctionEvent(
v8_file_logger_->FunctionEvent(
event_name, flags().script_id(), ms, scope->start_position(),
scope->end_position(),
reinterpret_cast<const char*>(function_name->raw_data()),

View File

@ -268,8 +268,8 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
if (reusable_preparser_ == nullptr) {
reusable_preparser_ = new PreParser(
&preparser_zone_, &scanner_, stack_limit_, ast_value_factory(),
pending_error_handler(), runtime_call_stats_, logger_, flags(),
parsing_on_main_thread_);
pending_error_handler(), runtime_call_stats_, v8_file_logger_,
flags(), parsing_on_main_thread_);
reusable_preparser_->set_allow_eval_cache(allow_eval_cache());
preparse_data_buffer_.reserve(128);
}

View File

@ -354,7 +354,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
name_byte_length = string->byte_length();
is_one_byte = string->is_one_byte();
}
logger_->FunctionEvent(
v8_file_logger_->FunctionEvent(
event_name, flags().script_id(), ms, function_scope->start_position(),
function_scope->end_position(), name, name_byte_length, is_one_byte);
}

View File

@ -933,11 +933,11 @@ class PreParser : public ParserBase<PreParser> {
PreParser(Zone* zone, Scanner* scanner, uintptr_t stack_limit,
AstValueFactory* ast_value_factory,
PendingCompilationErrorHandler* pending_error_handler,
RuntimeCallStats* runtime_call_stats, V8FileLogger* logger,
RuntimeCallStats* runtime_call_stats, V8FileLogger* v8_file_logger,
UnoptimizedCompileFlags flags, bool parsing_on_main_thread = true)
: ParserBase<PreParser>(zone, scanner, stack_limit, ast_value_factory,
pending_error_handler, runtime_call_stats, logger,
flags, parsing_on_main_thread),
pending_error_handler, runtime_call_stats,
v8_file_logger, flags, parsing_on_main_thread),
use_counts_(nullptr),
preparse_data_builder_(nullptr),
preparse_data_builder_buffer_() {

View File

@ -81,7 +81,7 @@ ProfilingScope::ProfilingScope(Isolate* isolate, ProfilerListener* listener)
wasm::GetWasmEngine()->EnableCodeLogging(isolate_);
#endif // V8_ENABLE_WEBASSEMBLY
V8FileLogger* logger = isolate_->logger();
V8FileLogger* logger = isolate_->v8_file_logger();
logger->AddLogEventListener(listener_);
// Populate the ProfilerCodeObserver with the initial functions and
// callbacks on the heap.
@ -95,7 +95,7 @@ ProfilingScope::ProfilingScope(Isolate* isolate, ProfilerListener* listener)
}
ProfilingScope::~ProfilingScope() {
isolate_->logger()->RemoveLogEventListener(listener_);
isolate_->v8_file_logger()->RemoveLogEventListener(listener_);
size_t profiler_count = isolate_->num_cpu_profilers();
DCHECK_GT(profiler_count, 0);

View File

@ -354,7 +354,7 @@ void FinalizeDeserialization(Isolate* isolate,
Handle<SharedFunctionInfo> result,
const base::ElapsedTimer& timer) {
const bool log_code_creation =
isolate->logger()->is_listening_to_code_events() ||
isolate->v8_file_logger()->is_listening_to_code_events() ||
isolate->is_profiling() ||
isolate->log_event_dispatcher()->is_listening_to_code_events();

View File

@ -23,11 +23,11 @@ namespace internal {
class CodeAddressMap : public CodeEventLogger {
public:
explicit CodeAddressMap(Isolate* isolate) : CodeEventLogger(isolate) {
isolate->logger()->AddLogEventListener(this);
isolate->v8_file_logger()->AddLogEventListener(this);
}
~CodeAddressMap() override {
isolate_->logger()->RemoveLogEventListener(this);
isolate_->v8_file_logger()->RemoveLogEventListener(this);
}
void CodeMoveEvent(AbstractCode from, AbstractCode to) override {

View File

@ -246,7 +246,7 @@ Handle<Code> JSToWasmWrapperCompilationUnit::Finalize() {
CompilationJob::Status status = job_->FinalizeJob(isolate_);
CHECK_EQ(status, CompilationJob::SUCCEEDED);
Handle<Code> code = job_->compilation_info()->code();
if (isolate_->logger()->is_listening_to_code_events() ||
if (isolate_->v8_file_logger()->is_listening_to_code_events() ||
isolate_->is_profiling()) {
Handle<String> name = isolate_->factory()->NewStringFromAsciiChecked(
job_->compilation_info()->GetDebugName().get());

View File

@ -213,7 +213,7 @@ bool WasmCode::ShouldBeLogged(Isolate* isolate) {
// The return value is cached in {WasmEngine::IsolateData::log_codes}. Ensure
// to call {WasmEngine::EnableCodeLogging} if this return value would change
// for any isolate. Otherwise we might lose code events.
return isolate->logger()->is_listening_to_code_events() ||
return isolate->v8_file_logger()->is_listening_to_code_events() ||
isolate->log_event_dispatcher()->is_listening_to_code_events() ||
isolate->is_profiling();
}

View File

@ -187,7 +187,7 @@ TEST(CodeEvents) {
ProfilerListener profiler_listener(isolate, processor,
*code_observer.code_entries(),
*code_observer.weak_code_registry());
isolate->logger()->AddLogEventListener(&profiler_listener);
isolate->v8_file_logger()->AddLogEventListener(&profiler_listener);
// Enqueue code creation events.
const char* aaa_str = "aaa";
@ -203,7 +203,7 @@ TEST(CodeEvents) {
// Enqueue a tick event to enable code events processing.
EnqueueTickSampleEvent(processor, aaa_code->InstructionStart());
isolate->logger()->RemoveLogEventListener(&profiler_listener);
isolate->v8_file_logger()->RemoveLogEventListener(&profiler_listener);
processor->StopSynchronously();
// Check the state of the symbolizer.
@ -255,7 +255,7 @@ TEST(TickEvents) {
ProfilerListener profiler_listener(isolate, processor,
*code_observer->code_entries(),
*code_observer->weak_code_registry());
isolate->logger()->AddLogEventListener(&profiler_listener);
isolate->v8_file_logger()->AddLogEventListener(&profiler_listener);
profiler_listener.CodeCreateEvent(i::V8FileLogger::BUILTIN_TAG, frame1_code,
"bbb");
@ -274,7 +274,7 @@ TEST(TickEvents) {
frame2_code->raw_instruction_end() - 1,
frame1_code->raw_instruction_end() - 1);
isolate->logger()->RemoveLogEventListener(&profiler_listener);
isolate->v8_file_logger()->RemoveLogEventListener(&profiler_listener);
processor->StopSynchronously();
CpuProfile* profile = profiles->StopProfiling(id);
CHECK(profile);
@ -1296,7 +1296,7 @@ static void TickLines(bool optimize) {
// LogCompiledFunctions so that source positions are collected everywhere.
// This would normally happen automatically with CpuProfiler::StartProfiling
// but doesn't because it's constructed with a symbolizer and a processor.
isolate->logger()->LogCompiledFunctions();
isolate->v8_file_logger()->LogCompiledFunctions();
CHECK(processor->Start());
ProfilerListener profiler_listener(isolate, processor,
*code_observer->code_entries(),

View File

@ -678,7 +678,7 @@ TEST(ScanHTMLEndComments) {
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
i_isolate->counters()->runtime_call_stats(),
i_isolate->logger(), flags);
i_isolate->v8_file_logger(), flags);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseSuccess, result);
CHECK(!pending_error_handler.has_pending_error());
@ -696,7 +696,7 @@ TEST(ScanHTMLEndComments) {
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
i_isolate->counters()->runtime_call_stats(),
i_isolate->logger(), flags);
i_isolate->v8_file_logger(), flags);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
// Even in the case of a syntax error, kPreParseSuccess is returned.
CHECK_EQ(i::PreParser::kPreParseSuccess, result);
@ -774,7 +774,7 @@ TEST(StandAlonePreParser) {
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
i_isolate->counters()->runtime_call_stats(),
i_isolate->logger(), flags);
i_isolate->v8_file_logger(), flags);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseSuccess, result);
CHECK(!pending_error_handler.has_pending_error());
@ -806,7 +806,7 @@ TEST(StandAlonePreParserNoNatives) {
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
isolate->counters()->runtime_call_stats(),
isolate->logger(), flags);
isolate->v8_file_logger(), flags);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseSuccess, result);
CHECK(pending_error_handler.has_pending_error() ||
@ -839,7 +839,7 @@ TEST(RegressChromium62639) {
i::PreParser preparser(&zone, &scanner, isolate->stack_guard()->real_climit(),
&ast_value_factory, &pending_error_handler,
isolate->counters()->runtime_call_stats(),
isolate->logger(), flags);
isolate->v8_file_logger(), flags);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
// Even in the case of a syntax error, kPreParseSuccess is returned.
CHECK_EQ(i::PreParser::kPreParseSuccess, result);
@ -870,9 +870,10 @@ TEST(PreParseOverflow) {
i::AstValueFactory ast_value_factory(&zone, isolate->ast_string_constants(),
HashSeed(isolate));
i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(
&zone, &scanner, stack_limit, &ast_value_factory, &pending_error_handler,
isolate->counters()->runtime_call_stats(), isolate->logger(), flags);
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
isolate->counters()->runtime_call_stats(),
isolate->v8_file_logger(), flags);
i::PreParser::PreParseResult result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseStackOverflow, result);
}
@ -1652,7 +1653,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
isolate->counters()->runtime_call_stats(),
isolate->logger(), compile_flags);
isolate->v8_file_logger(), compile_flags);
scanner.Initialize();
i::PreParser::PreParseResult pre_parse_result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseSuccess, pre_parse_result);

View File

@ -84,13 +84,14 @@ class V8_NODISCARD ScopedLoggerInitializer {
isolate_scope_(isolate),
scope_(isolate),
env_(v8::Context::New(isolate)),
logger_(reinterpret_cast<i::Isolate*>(isolate)->logger()) {
v8_file_logger_(
reinterpret_cast<i::Isolate*>(isolate)->v8_file_logger()) {
env_->Enter();
}
~ScopedLoggerInitializer() {
env_->Exit();
FILE* log_file = logger_->TearDownAndGetLogFile();
FILE* log_file = v8_file_logger_->TearDownAndGetLogFile();
if (log_file != nullptr) fclose(log_file);
}
@ -103,7 +104,7 @@ class V8_NODISCARD ScopedLoggerInitializer {
i::Isolate* i_isolate() { return reinterpret_cast<i::Isolate*>(isolate()); }
V8FileLogger* logger() { return logger_; }
V8FileLogger* v8_file_logger() { return v8_file_logger_; }
v8::Local<v8::String> GetLogString() {
int length = static_cast<int>(raw_log_.size());
@ -202,16 +203,16 @@ class V8_NODISCARD ScopedLoggerInitializer {
return result;
}
void LogCodeObjects() { logger_->LogCodeObjects(); }
void LogCompiledFunctions() { logger_->LogCompiledFunctions(); }
void LogCodeObjects() { v8_file_logger_->LogCodeObjects(); }
void LogCompiledFunctions() { v8_file_logger_->LogCompiledFunctions(); }
void StringEvent(const char* name, const char* value) {
logger_->StringEvent(name, value);
v8_file_logger_->StringEvent(name, value);
}
private:
FILE* StopLoggingGetTempFile() {
temp_file_ = logger_->TearDownAndGetLogFile();
temp_file_ = v8_file_logger_->TearDownAndGetLogFile();
CHECK(temp_file_);
rewind(temp_file_);
return temp_file_;
@ -222,7 +223,7 @@ class V8_NODISCARD ScopedLoggerInitializer {
v8::Isolate::Scope isolate_scope_;
v8::HandleScope scope_;
v8::Local<v8::Context> env_;
V8FileLogger* logger_;
V8FileLogger* v8_file_logger_;
std::string raw_log_;
std::vector<std::string> log_;
@ -323,7 +324,7 @@ TEST_F(TestWithIsolate, Issue23768) {
i_source->SetResource(i_isolate(), nullptr);
// Must not crash.
i_isolate()->logger()->LogCompiledFunctions();
i_isolate()->v8_file_logger()->LogCompiledFunctions();
}
static void ObjMethod1(const v8::FunctionCallbackInfo<v8::Value>& args) {}
@ -385,7 +386,7 @@ TEST_F(LogTest, LogAccessorCallbacks) {
inst->SetAccessor(NewString("prop1"), Prop1Getter, Prop1Setter);
inst->SetAccessor(NewString("prop2"), Prop2Getter);
logger.logger()->LogAccessorCallbacks();
logger.v8_file_logger()->LogAccessorCallbacks();
logger.StopLogging();
@ -462,7 +463,7 @@ TEST_F(LogTest, Issue539892) {
{
ScopedLoggerInitializer logger(isolate());
logger.logger()->AddLogEventListener(&code_event_logger);
logger.v8_file_logger()->AddLogEventListener(&code_event_logger);
// Function with a really large name.
const char* source_text =
@ -490,7 +491,7 @@ TEST_F(LogTest, Issue539892) {
// Must not crash.
logger.LogCompiledFunctions();
logger.logger()->RemoveLogEventListener(&code_event_logger);
logger.v8_file_logger()->RemoveLogEventListener(&code_event_logger);
}
}