Commit c1e1a6a4 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[test] Do not reset log flags

Avoid resetting log flags as this could cause data races with
allocating background threads.

Bug: v8:10315
Change-Id: I7be01ff54e349652f182b944ed3f3366d1239ad7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2421814
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70036}
parent e9fb6f9c
......@@ -49,8 +49,6 @@ using v8::internal::Logger;
namespace {
#define SETUP_FLAGS() \
bool saved_log = i::FLAG_log; \
bool saved_prof = i::FLAG_prof; \
i::FLAG_log = true; \
i::FLAG_prof = true; \
i::FLAG_log_code = true; \
......@@ -69,10 +67,8 @@ static std::vector<std::string> Split(const std::string& s, char delimiter) {
class ScopedLoggerInitializer {
public:
ScopedLoggerInitializer(bool saved_log, bool saved_prof, v8::Isolate* isolate)
: saved_log_(saved_log),
saved_prof_(saved_prof),
temp_file_(nullptr),
explicit ScopedLoggerInitializer(v8::Isolate* isolate)
: temp_file_(nullptr),
isolate_(isolate),
isolate_scope_(isolate),
scope_(isolate),
......@@ -85,8 +81,6 @@ class ScopedLoggerInitializer {
env_->Exit();
FILE* log_file = logger_->TearDownAndGetLogFile();
if (log_file != nullptr) fclose(log_file);
i::FLAG_prof = saved_prof_;
i::FLAG_log = saved_log_;
}
v8::Local<v8::Context>& env() { return env_; }
......@@ -209,8 +203,6 @@ class ScopedLoggerInitializer {
return temp_file_;
}
const bool saved_log_;
const bool saved_prof_;
FILE* temp_file_;
v8::Isolate* isolate_;
v8::Isolate::Scope isolate_scope_;
......@@ -330,7 +322,7 @@ UNINITIALIZED_TEST(LogCallbacks) {
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
v8::Local<v8::FunctionTemplate> obj = v8::Local<v8::FunctionTemplate>::New(
isolate, v8::FunctionTemplate::New(isolate));
......@@ -383,7 +375,7 @@ UNINITIALIZED_TEST(LogAccessorCallbacks) {
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
v8::Local<v8::FunctionTemplate> obj = v8::Local<v8::FunctionTemplate>::New(
isolate, v8::FunctionTemplate::New(isolate));
......@@ -435,7 +427,7 @@ UNINITIALIZED_TEST(LogVersion) {
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
logger.StopLogging();
i::EmbeddedVector<char, 100> line_buffer;
......@@ -476,7 +468,7 @@ UNINITIALIZED_TEST(Issue539892) {
FakeCodeEventLogger code_event_logger(reinterpret_cast<i::Isolate*>(isolate));
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
logger.logger()->AddCodeEventListener(&code_event_logger);
// Function with a really large name.
......@@ -521,7 +513,7 @@ UNINITIALIZED_TEST(LogAll) {
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
const char* source_text = R"(
function testAddFn(a,b) {
......@@ -575,7 +567,7 @@ UNINITIALIZED_TEST(LogInterpretedFramesNativeStack) {
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
const char* source_text =
"function testLogInterpretedFramesNativeStack(a,b) { return a + b };"
......@@ -609,7 +601,7 @@ UNINITIALIZED_TEST(LogInterpretedFramesNativeStackWithSerialization) {
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
has_cache = cache != nullptr;
v8::ScriptCompiler::CompileOptions options =
......@@ -815,7 +807,7 @@ UNINITIALIZED_TEST(TraceMaps) {
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
// Try to create many different kind of maps to make sure the logging won't
// crash. More detailed tests are implemented separately.
const char* source_text = R"(
......@@ -908,7 +900,7 @@ UNINITIALIZED_TEST(LogMapsDetailsStartup) {
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
logger.StopLogging();
ValidateMapDetailsLogging(isolate, &logger);
}
......@@ -1004,7 +996,7 @@ UNINITIALIZED_TEST(LogMapsDetailsCode) {
[1,2,3].helper();
)";
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
CompileRunChecked(isolate, source);
logger.StopLogging();
ValidateMapDetailsLogging(isolate, &logger);
......@@ -1028,7 +1020,7 @@ UNINITIALIZED_TEST(LogMapsDetailsContexts) {
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
// Use the default context.
CompileRunChecked(isolate, "{a:1}");
// Create additional contexts.
......@@ -1056,7 +1048,7 @@ UNINITIALIZED_TEST(ConsoleTimeEvents) {
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
// Test that console time events are properly logged
const char* source_text =
"console.time();"
......@@ -1092,7 +1084,7 @@ UNINITIALIZED_TEST(LogFunctionEvents) {
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
// Run some warmup code to help ignoring existing log entries.
CompileRun(
......@@ -1176,7 +1168,7 @@ UNINITIALIZED_TEST(BuiltinsNotLoggedAsLazyCompile) {
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
ScopedLoggerInitializer logger(isolate);
logger.LogCodeObjects();
logger.LogCompiledFunctions();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment