Commit 1df05d5d authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[snapshot] Use v8_flags for accessing flag values

Avoid the deprecated FLAG_* syntax, access flag values via the
{v8_flags} struct instead.

R=jgruber@chromium.org

Bug: v8:12887
Change-Id: Id293b260c1d84c2f9bd7f5c3c826f374ac6a68b1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3875086
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarJakob Linke <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82990}
parent ca2a9683
......@@ -57,9 +57,9 @@ ScriptCompiler::CachedData* CodeSerializer::Serialize(
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), "V8.CompileSerialize");
base::ElapsedTimer timer;
if (FLAG_profile_deserialization) timer.Start();
if (v8_flags.profile_deserialization) timer.Start();
Handle<Script> script(Script::cast(info->script()), isolate);
if (FLAG_trace_serializer) {
if (v8_flags.trace_serializer) {
PrintF("[Serializing from");
script->name().ShortPrint();
PrintF("]\n");
......@@ -79,7 +79,7 @@ ScriptCompiler::CachedData* CodeSerializer::Serialize(
cs.reference_map()->AddAttachedReference(*source);
AlignedCachedData* cached_data = cs.SerializeSharedFunctionInfo(info);
if (FLAG_profile_deserialization) {
if (v8_flags.profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
int length = cached_data->length();
PrintF("[Serializing to %d bytes took %0.3f ms]\n", length, ms);
......@@ -241,7 +241,7 @@ void CodeSerializer::SerializeObjectImpl(Handle<HeapObject> obj) {
// bytecode array stored within the InterpreterData, which is the important
// information. On deserialization we'll create our code objects again, if
// --interpreted-frames-native-stack is on. See v8:9122 for more context
if (V8_UNLIKELY(FLAG_interpreted_frames_native_stack) &&
if (V8_UNLIKELY(v8_flags.interpreted_frames_native_stack) &&
obj->IsInterpreterData()) {
obj = handle(InterpreterData::cast(*obj).bytecode_array(), isolate());
}
......@@ -269,8 +269,8 @@ void CodeSerializer::SerializeGeneric(Handle<HeapObject> heap_object) {
namespace {
// NOTE(mmarchini): when FLAG_interpreted_frames_native_stack is on, we want to
// create duplicates of InterpreterEntryTrampoline for the deserialized
// NOTE(mmarchini): when v8_flags.interpreted_frames_native_stack is on, we want
// to create duplicates of InterpreterEntryTrampoline for the deserialized
// functions, otherwise we'll call the builtin IET for those functions (which
// is not what a user of this flag wants).
void CreateInterpreterDataForDeserializedCode(Isolate* isolate,
......@@ -355,21 +355,21 @@ void FinalizeDeserialization(Isolate* isolate,
isolate->is_profiling() ||
isolate->logger()->is_listening_to_code_events();
if (V8_UNLIKELY(FLAG_interpreted_frames_native_stack)) {
if (V8_UNLIKELY(v8_flags.interpreted_frames_native_stack)) {
CreateInterpreterDataForDeserializedCode(isolate, result,
log_code_creation);
}
bool needs_source_positions = isolate->NeedsSourcePositionsForProfiling();
if (log_code_creation || FLAG_log_function_events) {
if (log_code_creation || v8_flags.log_function_events) {
Handle<Script> script(Script::cast(result->script()), isolate);
Handle<String> name(script->name().IsString()
? String::cast(script->name())
: ReadOnlyRoots(isolate).empty_string(),
isolate);
if (FLAG_log_function_events) {
if (v8_flags.log_function_events) {
LOG(isolate,
FunctionEvent("deserialize", script->id(),
timer.Elapsed().InMillisecondsF(),
......@@ -414,7 +414,7 @@ void BaselineBatchCompileIfSparkplugCompiled(Isolate* isolate, Script script) {
// Here is main thread, we trigger early baseline compilation only in
// concurrent sparkplug and baseline batch compilation mode which consumes
// little main thread execution time.
if (FLAG_concurrent_sparkplug && FLAG_baseline_batch_compilation) {
if (v8_flags.concurrent_sparkplug && v8_flags.baseline_batch_compilation) {
SharedFunctionInfo::ScriptIterator iter(isolate, script);
for (SharedFunctionInfo info = iter.Next(); !info.is_null();
info = iter.Next()) {
......@@ -430,7 +430,7 @@ void BaselineBatchCompileIfSparkplugCompiled(Isolate* isolate, Script script) {
MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
Isolate* isolate, AlignedCachedData* cached_data, Handle<String> source,
ScriptOriginOptions origin_options) {
if (FLAG_stress_background_compile) {
if (v8_flags.stress_background_compile) {
StressOffThreadDeserializeThread thread(isolate, cached_data);
CHECK(thread.Start());
thread.Join();
......@@ -439,7 +439,8 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
}
base::ElapsedTimer timer;
if (FLAG_profile_deserialization || FLAG_log_function_events) timer.Start();
if (v8_flags.profile_deserialization || v8_flags.log_function_events)
timer.Start();
HandleScope scope(isolate);
......@@ -449,7 +450,8 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
cached_data, SerializedCodeData::SourceHash(source, origin_options),
&sanity_check_result);
if (sanity_check_result != SerializedCodeSanityCheckResult::kSuccess) {
if (FLAG_profile_deserialization) PrintF("[Cached code failed check]\n");
if (v8_flags.profile_deserialization)
PrintF("[Cached code failed check]\n");
DCHECK(cached_data->rejected());
isolate->counters()->code_cache_reject_reason()->AddSample(
static_cast<int>(sanity_check_result));
......@@ -463,12 +465,12 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
Handle<SharedFunctionInfo> result;
if (!maybe_result.ToHandle(&result)) {
// Deserializing may fail if the reservations cannot be fulfilled.
if (FLAG_profile_deserialization) PrintF("[Deserializing failed]\n");
if (v8_flags.profile_deserialization) PrintF("[Deserializing failed]\n");
return MaybeHandle<SharedFunctionInfo>();
}
BaselineBatchCompileIfSparkplugCompiled(isolate,
Script::cast(result->script()));
if (FLAG_profile_deserialization) {
if (v8_flags.profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
int length = cached_data->length();
PrintF("[Deserializing from %d bytes took %0.3f ms]\n", length, ms);
......@@ -532,7 +534,8 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize(
ScriptOriginOptions origin_options,
BackgroundMergeTask* background_merge_task) {
base::ElapsedTimer timer;
if (FLAG_profile_deserialization || FLAG_log_function_events) timer.Start();
if (v8_flags.profile_deserialization || v8_flags.log_function_events)
timer.Start();
HandleScope scope(isolate);
......@@ -557,7 +560,8 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize(
DCHECK_IMPLIES(sanity_check_result != data.sanity_check_result,
sanity_check_result ==
SerializedCodeSanityCheckResult::kSourceMismatch);
if (FLAG_profile_deserialization) PrintF("[Cached code failed check]\n");
if (v8_flags.profile_deserialization)
PrintF("[Cached code failed check]\n");
DCHECK(cached_data->rejected());
isolate->counters()->code_cache_reject_reason()->AddSample(
static_cast<int>(sanity_check_result));
......@@ -567,7 +571,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize(
Handle<SharedFunctionInfo> result;
if (!data.maybe_result.ToHandle(&result)) {
// Deserializing may fail if the reservations cannot be fulfilled.
if (FLAG_profile_deserialization) {
if (v8_flags.profile_deserialization) {
PrintF("[Off-thread deserializing failed]\n");
}
return MaybeHandle<SharedFunctionInfo>();
......@@ -605,7 +609,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::FinishOffThreadDeserialize(
isolate->heap()->SetRootScriptList(*list);
}
if (FLAG_profile_deserialization) {
if (v8_flags.profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
int length = cached_data->length();
PrintF("[Finishing off-thread deserialize from %d bytes took %0.3f ms]\n",
......@@ -645,7 +649,7 @@ SerializedCodeData::SerializedCodeData(const std::vector<byte>* payload,
CopyBytes(data_ + kHeaderSize, payload->data(),
static_cast<size_t>(payload->size()));
uint32_t checksum =
FLAG_verify_snapshot_checksum ? Checksum(ChecksummedContent()) : 0;
v8_flags.verify_snapshot_checksum ? Checksum(ChecksummedContent()) : 0;
SetHeaderValue(kChecksumOffset, checksum);
}
......@@ -687,7 +691,7 @@ SerializedCodeSanityCheckResult SerializedCodeData::SanityCheckWithoutSource()
if (payload_length > max_payload_length) {
return SerializedCodeSanityCheckResult::kLengthMismatch;
}
if (FLAG_verify_snapshot_checksum) {
if (v8_flags.verify_snapshot_checksum) {
uint32_t checksum = GetHeaderValue(kChecksumOffset);
if (Checksum(ChecksummedContent()) != checksum) {
return SerializedCodeSanityCheckResult::kChecksumMismatch;
......
......@@ -216,7 +216,7 @@ bool ContextSerializer::ShouldBeInTheStartupObjectCache(HeapObject o) {
}
bool ContextSerializer::ShouldBeInTheSharedObjectCache(HeapObject o) {
// FLAG_shared_string_table may be true during deserialization, so put
// v8_flags.shared_string_table may be true during deserialization, so put
// internalized strings into the shared object snapshot.
return o.IsInternalizedString();
}
......
......@@ -196,7 +196,7 @@ Deserializer<IsolateT>::Deserializer(IsolateT* isolate,
source_(payload),
magic_number_(magic_number),
deserializing_user_code_(deserializing_user_code),
should_rehash_((FLAG_rehash_snapshot && can_rehash) ||
should_rehash_((v8_flags.rehash_snapshot && can_rehash) ||
deserializing_user_code) {
DCHECK_NOT_NULL(isolate);
isolate->RegisterDeserializerStarted();
......@@ -261,10 +261,10 @@ void Deserializer<IsolateT>::DeserializeDeferredObjects() {
template <typename IsolateT>
void Deserializer<IsolateT>::LogNewMapEvents() {
if (V8_LIKELY(!FLAG_log_maps)) return;
if (V8_LIKELY(!v8_flags.log_maps)) return;
DisallowGarbageCollection no_gc;
for (Handle<Map> map : new_maps_) {
DCHECK(FLAG_log_maps);
DCHECK(v8_flags.log_maps);
LOG(isolate(), MapCreate(*map));
LOG(isolate(), MapDetails(*map));
}
......@@ -501,7 +501,7 @@ void Deserializer<IsolateT>::PostProcessNewObject(Handle<Map> map,
}
#endif
} else if (InstanceTypeChecker::IsMap(instance_type)) {
if (FLAG_log_maps) {
if (v8_flags.log_maps) {
// Keep track of all seen Maps to log them later since they might be only
// partially initialized at this point.
new_maps_.push_back(Handle<Map>::cast(obj));
......@@ -597,7 +597,7 @@ Handle<HeapObject> Deserializer<IsolateT>::ReadObject(SnapshotSpace space) {
// strings internalized strings are allocated in the shared heap.
//
// TODO(12007): When shipping, add a new SharedOld SnapshotSpace.
if (FLAG_shared_string_table) {
if (v8_flags.shared_string_table) {
InstanceType instance_type = map->instance_type();
if (InstanceTypeChecker::IsInternalizedString(instance_type) ||
String::IsInPlaceInternalizable(instance_type)) {
......
......@@ -149,7 +149,7 @@ void OffHeapInstructionStream::CreateOffHeapOffHeapInstructionStream(
// in the binary) and what we are currently setting up here (where the blob is
// on the native heap).
std::memcpy(allocated_code_bytes, d.code(), d.code_size());
if (FLAG_experimental_flush_embedded_blob_icache) {
if (v8_flags.experimental_flush_embedded_blob_icache) {
FlushInstructionCache(allocated_code_bytes, d.code_size());
}
CHECK(SetPermissions(page_allocator, allocated_code_bytes,
......@@ -440,11 +440,11 @@ EmbeddedData EmbeddedData::FromIsolate(Isolate* isolate) {
}
}
// Ensure that InterpreterEntryTrampolineForProfiling is relocatable.
// See FLAG_interpreted_frames_native_stack for details.
// See v8_flags.interpreted_frames_native_stack for details.
EnsureRelocatable(
builtins->code(Builtin::kInterpreterEntryTrampolineForProfiling));
if (FLAG_serialization_statistics) d.PrintStatistics();
if (v8_flags.serialization_statistics) d.PrintStatistics();
return d;
}
......@@ -463,13 +463,13 @@ size_t EmbeddedData::CreateEmbeddedBlobDataHash() const {
}
size_t EmbeddedData::CreateEmbeddedBlobCodeHash() const {
CHECK(FLAG_text_is_readable);
CHECK(v8_flags.text_is_readable);
base::Vector<const byte> payload(code_, code_size_);
return Checksum(payload);
}
void EmbeddedData::PrintStatistics() const {
DCHECK(FLAG_serialization_statistics);
DCHECK(v8_flags.serialization_statistics);
constexpr int kCount = Builtins::kBuiltinCount;
int sizes[kCount];
......
......@@ -161,7 +161,7 @@ v8::StartupData CreateSnapshotDataBlob(v8::Isolate* isolate,
v8::SnapshotCreator::FunctionCodeHandling::kClear, embedded_source,
isolate);
if (i::FLAG_profile_deserialization) {
if (i::v8_flags.profile_deserialization) {
i::PrintF("[Creating snapshot took %0.3f ms]\n",
timer.Elapsed().InMillisecondsF());
}
......@@ -178,7 +178,7 @@ v8::StartupData WarmUpSnapshotDataBlob(v8::StartupData cold_snapshot_blob,
v8::StartupData result =
i::WarmUpSnapshotDataBlobInternal(cold_snapshot_blob, warmup_source);
if (i::FLAG_profile_deserialization) {
if (i::v8_flags.profile_deserialization) {
i::PrintF("Warming up snapshot took %0.3f ms\n",
timer.Elapsed().InMillisecondsF());
}
......@@ -204,7 +204,7 @@ void MaybeSetCounterFunction(v8::Isolate* isolate) {
// distinguish between them. In theory it should be okay to just return an
// incremented int value each time this function is called, but we play it
// safe and return a real distinct memory location tied to every counter name.
if (i::FLAG_native_code_counters) {
if (i::v8_flags.native_code_counters) {
counter_map_ = new CounterMap();
isolate->SetCounterFunction([](const char* name) -> int* {
auto map_entry = counter_map_->find(name);
......@@ -222,7 +222,7 @@ int main(int argc, char** argv) {
v8::base::EnsureConsoleOutput();
// Make mksnapshot runs predictable to create reproducible snapshots.
i::FLAG_predictable = true;
i::v8_flags.predictable = true;
// Print the usage if an error occurs when parsing the command line
// flags or if the help flag is set.
......@@ -247,14 +247,14 @@ int main(int argc, char** argv) {
{
SnapshotFileWriter snapshot_writer;
snapshot_writer.SetSnapshotFile(i::FLAG_startup_src);
snapshot_writer.SetStartupBlobFile(i::FLAG_startup_blob);
snapshot_writer.SetSnapshotFile(i::v8_flags.startup_src);
snapshot_writer.SetStartupBlobFile(i::v8_flags.startup_blob);
i::EmbeddedFileWriter embedded_writer;
embedded_writer.SetEmbeddedFile(i::FLAG_embedded_src);
embedded_writer.SetEmbeddedVariant(i::FLAG_embedded_variant);
embedded_writer.SetTargetArch(i::FLAG_target_arch);
embedded_writer.SetTargetOs(i::FLAG_target_os);
embedded_writer.SetEmbeddedFile(i::v8_flags.embedded_src);
embedded_writer.SetEmbeddedVariant(i::v8_flags.embedded_variant);
embedded_writer.SetTargetArch(i::v8_flags.target_arch);
embedded_writer.SetTargetOs(i::v8_flags.target_os);
std::unique_ptr<char> embed_script(
GetExtraCode(argc >= 2 ? argv[1] : nullptr, "embedding"));
......
......@@ -43,7 +43,7 @@ Serializer::Serializer(Isolate* isolate, Snapshot::SerializerFlags flags)
#endif
{
#ifdef OBJECT_PRINT
if (FLAG_serialization_statistics) {
if (v8_flags.serialization_statistics) {
for (int space = 0; space < kNumberOfSnapshotSpaces; ++space) {
// Value-initialized to 0.
instance_type_count_[space] = std::make_unique<int[]>(kInstanceTypes);
......@@ -58,7 +58,7 @@ void Serializer::PopStack() { stack_.Pop(); }
#endif
void Serializer::CountAllocation(Map map, int size, SnapshotSpace space) {
DCHECK(FLAG_serialization_statistics);
DCHECK(v8_flags.serialization_statistics);
const int space_number = static_cast<int>(space);
allocation_size_[space_number] += size;
......@@ -78,7 +78,7 @@ int Serializer::TotalAllocationSize() const {
}
void Serializer::OutputStatistics(const char* name) {
if (!FLAG_serialization_statistics) return;
if (!v8_flags.serialization_statistics) return;
PrintF("%s:\n", name);
......@@ -113,7 +113,7 @@ void Serializer::OutputStatistics(const char* name) {
}
void Serializer::SerializeDeferredObjects() {
if (FLAG_trace_serializer) {
if (v8_flags.trace_serializer) {
PrintF("Serializing deferred objects\n");
}
WHILE_WITH_HANDLE_SCOPE(isolate(), !deferred_objects_.empty(), {
......@@ -188,7 +188,7 @@ bool Serializer::SerializeHotObject(HeapObject obj) {
int index = hot_objects_.Find(obj);
if (index == HotObjectsList::kNotFound) return false;
DCHECK(index >= 0 && index < kHotObjectCount);
if (FLAG_trace_serializer) {
if (v8_flags.trace_serializer) {
PrintF(" Encoding hot object %d:", index);
obj.ShortPrint();
PrintF("\n");
......@@ -206,14 +206,14 @@ bool Serializer::SerializeBackReference(HeapObject obj) {
// offset fromthe start of the deserialized objects or as an offset
// backwards from thecurrent allocation pointer.
if (reference->is_attached_reference()) {
if (FLAG_trace_serializer) {
if (v8_flags.trace_serializer) {
PrintF(" Encoding attached reference %d\n",
reference->attached_reference_index());
}
PutAttachedReference(*reference);
} else {
DCHECK(reference->is_back_reference());
if (FLAG_trace_serializer) {
if (v8_flags.trace_serializer) {
PrintF(" Encoding back reference to: ");
obj.ShortPrint();
PrintF("\n");
......@@ -244,7 +244,7 @@ void Serializer::PutRoot(RootIndex root) {
DisallowGarbageCollection no_gc;
int root_index = static_cast<int>(root);
HeapObject object = HeapObject::cast(isolate()->root(root));
if (FLAG_trace_serializer) {
if (v8_flags.trace_serializer) {
PrintF(" Encoding root %d:", root_index);
object.ShortPrint();
PrintF("\n");
......@@ -450,7 +450,7 @@ void Serializer::ObjectSerializer::SerializePrologue(SnapshotSpace space,
serializer_->ResolvePendingObject(*object_);
}
if (FLAG_serialization_statistics) {
if (v8_flags.serialization_statistics) {
serializer_->CountAllocation(object_->map(), size, space);
}
......@@ -707,7 +707,7 @@ void Serializer::ObjectSerializer::Serialize() {
if ((recursion.ExceedsMaximum() && CanBeDeferred(raw)) ||
serializer_->MustBeDeferred(raw)) {
DCHECK(CanBeDeferred(raw));
if (FLAG_trace_serializer) {
if (v8_flags.trace_serializer) {
PrintF(" Deferring heap object: ");
object_->ShortPrint();
PrintF("\n");
......@@ -720,7 +720,7 @@ void Serializer::ObjectSerializer::Serialize() {
return;
}
if (FLAG_trace_serializer) {
if (v8_flags.trace_serializer) {
PrintF(" Encoding heap object: ");
object_->ShortPrint();
PrintF("\n");
......@@ -826,7 +826,7 @@ void Serializer::ObjectSerializer::SerializeDeferred() {
serializer_->reference_map()->LookupReference(object_);
if (back_reference != nullptr) {
if (FLAG_trace_serializer) {
if (v8_flags.trace_serializer) {
PrintF(" Deferred heap object ");
object_->ShortPrint();
PrintF(" was already serialized\n");
......@@ -834,7 +834,7 @@ void Serializer::ObjectSerializer::SerializeDeferred() {
return;
}
if (FLAG_trace_serializer) {
if (v8_flags.trace_serializer) {
PrintF(" Encoding deferred heap object\n");
}
Serialize();
......
......@@ -60,7 +60,7 @@ void SharedHeapSerializer::FinalizeSerialization() {
VisitRootPointer(Root::kSharedHeapObjectCache, nullptr,
FullObjectSlot(&undefined));
// When FLAG_shared_string_table is true, all internalized and
// When v8_flags.shared_string_table is true, all internalized and
// internalizable-in-place strings are in the shared heap.
SerializeStringTable(isolate()->string_table());
SerializeDeferredObjects();
......
......@@ -22,7 +22,7 @@ SnapshotData SnapshotCompression::Compress(
const SnapshotData* uncompressed_data) {
SnapshotData snapshot_data;
base::ElapsedTimer timer;
if (FLAG_profile_deserialization) timer.Start();
if (v8_flags.profile_deserialization) timer.Start();
static_assert(sizeof(Bytef) == 1, "");
const uLongf input_size =
......@@ -55,7 +55,7 @@ SnapshotData SnapshotCompression::Compress(
DCHECK_EQ(payload_length,
GetUncompressedSize(snapshot_data.RawData().begin()));
if (FLAG_profile_deserialization) {
if (v8_flags.profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
PrintF("[Compressing %d bytes took %0.3f ms]\n", payload_length, ms);
}
......@@ -66,7 +66,7 @@ SnapshotData SnapshotCompression::Decompress(
base::Vector<const byte> compressed_data) {
SnapshotData snapshot_data;
base::ElapsedTimer timer;
if (FLAG_profile_deserialization) timer.Start();
if (v8_flags.profile_deserialization) timer.Start();
const Bytef* input_bytef =
base::bit_cast<const Bytef*>(compressed_data.begin());
......@@ -87,7 +87,7 @@ SnapshotData SnapshotCompression::Decompress(
sizeof(uncompressed_payload_length))),
Z_OK);
if (FLAG_profile_deserialization) {
if (v8_flags.profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
PrintF("[Decompressing %d bytes took %0.3f ms]\n",
uncompressed_payload_length, ms);
......
......@@ -41,7 +41,7 @@ bool Snapshot::ShouldVerifyChecksum(const v8::StartupData* data) {
#ifdef V8_TARGET_OS_ANDROID
base::MutexGuard lock_guard(external_startup_data_mutex.Pointer());
if (data != &external_startup_blob) {
return FLAG_verify_snapshot_checksum;
return v8_flags.verify_snapshot_checksum;
}
// Verify the external snapshot maximally once per process due to the
// additional overhead.
......@@ -49,7 +49,7 @@ bool Snapshot::ShouldVerifyChecksum(const v8::StartupData* data) {
external_startup_checksum_verified = true;
return true;
#else
return FLAG_verify_snapshot_checksum;
return v8_flags.verify_snapshot_checksum;
#endif
}
......
......@@ -158,7 +158,7 @@ bool Snapshot::Initialize(Isolate* isolate) {
TRACE_EVENT0("v8", "V8.DeserializeIsolate");
RCS_SCOPE(isolate, RuntimeCallCounterId::kDeserializeIsolate);
base::ElapsedTimer timer;
if (FLAG_profile_deserialization) timer.Start();
if (v8_flags.profile_deserialization) timer.Start();
const v8::StartupData* blob = isolate->snapshot_blob();
SnapshotImpl::CheckVersion(blob);
......@@ -182,7 +182,7 @@ bool Snapshot::Initialize(Isolate* isolate) {
bool success = isolate->InitWithSnapshot(
&startup_snapshot_data, &read_only_snapshot_data,
&shared_heap_snapshot_data, ExtractRehashability(blob));
if (FLAG_profile_deserialization) {
if (v8_flags.profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
int bytes = startup_data.length();
PrintF("[Deserializing isolate (%d bytes) took %0.3f ms]\n", bytes, ms);
......@@ -197,7 +197,7 @@ MaybeHandle<Context> Snapshot::NewContextFromSnapshot(
TRACE_EVENT0("v8", "V8.DeserializeContext");
RCS_SCOPE(isolate, RuntimeCallCounterId::kDeserializeContext);
base::ElapsedTimer timer;
if (FLAG_profile_deserialization) timer.Start();
if (v8_flags.profile_deserialization) timer.Start();
const v8::StartupData* blob = isolate->snapshot_blob();
bool can_rehash = ExtractRehashability(blob);
......@@ -212,7 +212,7 @@ MaybeHandle<Context> Snapshot::NewContextFromSnapshot(
Handle<Context> result;
if (!maybe_result.ToHandle(&result)) return MaybeHandle<Context>();
if (FLAG_profile_deserialization) {
if (v8_flags.profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
int bytes = context_data.length();
PrintF("[Deserializing context #%zu (%d bytes) took %0.3f ms]\n",
......@@ -354,7 +354,7 @@ void Snapshot::SerializeDeserializeAndVerifyForTesting(
CHECK(new_native_context->IsNativeContext());
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) HeapVerifier::VerifyHeap(new_isolate->heap());
if (v8_flags.verify_heap) HeapVerifier::VerifyHeap(new_isolate->heap());
#endif // VERIFY_HEAP
}
new_isolate->Exit();
......@@ -405,7 +405,7 @@ v8::StartupData Snapshot::Create(
context_serializer.Serialize(&contexts->at(i), no_gc);
can_be_rehashed = can_be_rehashed && context_serializer.can_be_rehashed();
context_snapshots.push_back(new SnapshotData(&context_serializer));
if (FLAG_serialization_statistics) {
if (v8_flags.serialization_statistics) {
context_allocation_sizes.push_back(
context_serializer.TotalAllocationSize());
}
......@@ -422,7 +422,7 @@ v8::StartupData Snapshot::Create(
read_only_serializer.FinalizeSerialization();
can_be_rehashed = can_be_rehashed && read_only_serializer.can_be_rehashed();
if (FLAG_serialization_statistics) {
if (v8_flags.serialization_statistics) {
// These prints should match the regexp in test/memory/Memory.json
DCHECK_NE(read_only_serializer.TotalAllocationSize(), 0);
DCHECK_NE(shared_heap_serializer.TotalAllocationSize(), 0);
......@@ -537,7 +537,7 @@ v8::StartupData SnapshotImpl::CreateSnapshotBlob(
CopyBytes(data + payload_offset,
reinterpret_cast<const char*>(startup_snapshot->RawData().begin()),
payload_length);
if (FLAG_serialization_statistics) {
if (v8_flags.serialization_statistics) {
PrintF("Snapshot blob consists of:\n%10d bytes for startup\n",
payload_length);
}
......@@ -551,7 +551,7 @@ v8::StartupData SnapshotImpl::CreateSnapshotBlob(
data + payload_offset,
reinterpret_cast<const char*>(read_only_snapshot->RawData().begin()),
payload_length);
if (FLAG_serialization_statistics) {
if (v8_flags.serialization_statistics) {
PrintF("%10d bytes for read-only\n", payload_length);
}
payload_offset += payload_length;
......@@ -564,7 +564,7 @@ v8::StartupData SnapshotImpl::CreateSnapshotBlob(
data + payload_offset,
reinterpret_cast<const char*>(shared_heap_snapshot->RawData().begin()),
payload_length);
if (FLAG_serialization_statistics) {
if (v8_flags.serialization_statistics) {
PrintF("%10d bytes for shared heap\n", payload_length);
}
payload_offset += payload_length;
......@@ -579,12 +579,12 @@ v8::StartupData SnapshotImpl::CreateSnapshotBlob(
data + payload_offset,
reinterpret_cast<const char*>(context_snapshot->RawData().begin()),
payload_length);
if (FLAG_serialization_statistics) {
if (v8_flags.serialization_statistics) {
PrintF("%10d bytes for context #%d\n", payload_length, i);
}
payload_offset += payload_length;
}
if (FLAG_serialization_statistics) PrintF("\n");
if (v8_flags.serialization_statistics) PrintF("\n");
DCHECK_EQ(total_length, payload_offset);
v8::StartupData result = {data, static_cast<int>(total_length)};
......@@ -611,10 +611,10 @@ uint32_t Snapshot::CalculateChecksum(const v8::StartupData* data) {
bool Snapshot::VerifyChecksum(const v8::StartupData* data) {
base::ElapsedTimer timer;
if (FLAG_profile_deserialization) timer.Start();
if (v8_flags.profile_deserialization) timer.Start();
uint32_t expected = GetExpectedChecksum(data);
uint32_t result = CalculateChecksum(data);
if (FLAG_profile_deserialization) {
if (v8_flags.profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
PrintF("[Verifying snapshot checksum took %0.3f ms]\n", ms);
}
......
......@@ -74,7 +74,7 @@ void StartupDeserializer::DeserializeIntoIsolate() {
}
void StartupDeserializer::LogNewMapEvents() {
if (FLAG_log_maps) LOG(isolate(), LogAllMaps());
if (v8_flags.log_maps) LOG(isolate(), LogAllMaps());
}
void StartupDeserializer::FlushICache() {
......
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