Commit 1e6a8ae0 authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Resolve multiple -Wshadow warnings in src/heap

Bug: v8:12244, v8:12245
Change-Id: I718c7531a7bec24abbc1c5b23246828261d0b94b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3182221Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77048}
parent 6888232c
......@@ -61,11 +61,11 @@ class V8_EXPORT_PRIVATE GCTracer {
struct IncrementalMarkingInfos {
IncrementalMarkingInfos() : duration(0), longest_step(0), steps(0) {}
void Update(double duration) {
void Update(double delta) {
steps++;
this->duration += duration;
if (duration > longest_step) {
longest_step = duration;
duration += delta;
if (delta > longest_step) {
longest_step = delta;
}
}
......
......@@ -571,8 +571,9 @@ base::Optional<std::pair<Address, size_t>> PagedSpace::RawRefillLabBackground(
DCHECK(identity() == OLD_SPACE || identity() == MAP_SPACE);
DCHECK_EQ(origin, AllocationOrigin::kRuntime);
auto result = TryAllocationFromFreeListBackground(
local_heap, min_size_in_bytes, max_size_in_bytes, alignment, origin);
base::Optional<std::pair<Address, size_t>> result =
TryAllocationFromFreeListBackground(local_heap, min_size_in_bytes,
max_size_in_bytes, alignment, origin);
if (result) return result;
MarkCompactCollector* collector = heap()->mark_compact_collector();
......@@ -583,7 +584,7 @@ base::Optional<std::pair<Address, size_t>> PagedSpace::RawRefillLabBackground(
RefillFreeList();
// Retry the free list allocation.
auto result = TryAllocationFromFreeListBackground(
result = TryAllocationFromFreeListBackground(
local_heap, min_size_in_bytes, max_size_in_bytes, alignment, origin);
if (result) return result;
......@@ -601,7 +602,7 @@ base::Optional<std::pair<Address, size_t>> PagedSpace::RawRefillLabBackground(
RefillFreeList();
if (static_cast<size_t>(max_freed) >= min_size_in_bytes) {
auto result = TryAllocationFromFreeListBackground(
result = TryAllocationFromFreeListBackground(
local_heap, min_size_in_bytes, max_size_in_bytes, alignment, origin);
if (result) return result;
}
......@@ -609,7 +610,7 @@ base::Optional<std::pair<Address, size_t>> PagedSpace::RawRefillLabBackground(
if (heap()->ShouldExpandOldGenerationOnSlowAllocation(local_heap) &&
heap()->CanExpandOldGenerationBackground(local_heap, AreaSize())) {
auto result = ExpandBackground(local_heap, max_size_in_bytes);
result = ExpandBackground(local_heap, max_size_in_bytes);
if (result) {
DCHECK_EQ(Heap::GetFillToAlign(result->first, alignment), 0);
return result;
......@@ -730,8 +731,9 @@ void PagedSpace::Verify(Isolate* isolate, ObjectVisitor* visitor) {
if (object.IsExternalString()) {
ExternalString external_string = ExternalString::cast(object);
size_t size = external_string.ExternalPayloadSize();
external_page_bytes[ExternalBackingStoreType::kExternalString] += size;
size_t payload_size = external_string.ExternalPayloadSize();
external_page_bytes[ExternalBackingStoreType::kExternalString] +=
payload_size;
}
}
for (int i = 0; i < kNumTypes; i++) {
......
......@@ -341,10 +341,10 @@ SlotCallbackResult Scavenger::EvacuateShortcutCandidate(Map map,
kReleaseStore);
return Heap::InYoungGeneration(target) ? KEEP_SLOT : REMOVE_SLOT;
}
Map map = first_word.ToMap();
SlotCallbackResult result =
EvacuateObjectDefault(map, slot, first, first.SizeFromMap(map),
Map::ObjectFieldsFrom(map.visitor_id()));
Map first_map = first_word.ToMap();
SlotCallbackResult result = EvacuateObjectDefault(
first_map, slot, first, first.SizeFromMap(first_map),
Map::ObjectFieldsFrom(first_map.visitor_id()));
object.set_map_word(MapWord::FromForwardingAddress(slot.ToHeapObject()),
kReleaseStore);
return result;
......
......@@ -640,7 +640,7 @@ void Heap::CreateApiObjects() {
}
void Heap::CreateInitialObjects() {
HandleScope scope(isolate());
HandleScope initial_objects_handle_scope(isolate());
Factory* factory = isolate()->factory();
ReadOnlyRoots roots(this);
......@@ -736,7 +736,7 @@ void Heap::CreateInitialObjects() {
set_interpreter_entry_trampoline_for_profiling(roots.undefined_value());
{
HandleScope scope(isolate());
HandleScope handle_scope(isolate());
#define SYMBOL_INIT(_, name) \
{ \
Handle<Symbol> symbol( \
......@@ -748,7 +748,7 @@ void Heap::CreateInitialObjects() {
}
{
HandleScope scope(isolate());
HandleScope handle_scope(isolate());
#define SYMBOL_INIT(_, name, description) \
Handle<Symbol> name = factory->NewSymbol(AllocationType::kReadOnly); \
Handle<String> name##d = factory->InternalizeUtf8String(#description); \
......
......@@ -25,11 +25,13 @@ void WeakObjects::UpdateAfterScavenge() {
#undef INVOKE_UPDATE
}
// static
void WeakObjects::UpdateTransitionArrays(
WeakObjectWorklist<TransitionArray>& transition_arrays) {
DCHECK(!ContainsYoungObjects(transition_arrays));
}
// static
void WeakObjects::UpdateEphemeronHashTables(
WeakObjectWorklist<EphemeronHashTable>& ephemeron_hash_tables) {
ephemeron_hash_tables.Update(
......@@ -61,21 +63,25 @@ bool EphemeronUpdater(Ephemeron slot_in, Ephemeron* slot_out) {
}
} // anonymous namespace
// static
void WeakObjects::UpdateCurrentEphemerons(
WeakObjectWorklist<Ephemeron>& current_ephemerons) {
current_ephemerons.Update(EphemeronUpdater);
}
// static
void WeakObjects::UpdateNextEphemerons(
WeakObjectWorklist<Ephemeron>& next_ephemerons) {
next_ephemerons.Update(EphemeronUpdater);
}
// static
void WeakObjects::UpdateDiscoveredEphemerons(
WeakObjectWorklist<Ephemeron>& discovered_ephemerons) {
discovered_ephemerons.Update(EphemeronUpdater);
}
// static
void WeakObjects::UpdateWeakReferences(
WeakObjectWorklist<HeapObjectAndSlot>& weak_references) {
weak_references.Update(
......@@ -96,6 +102,7 @@ void WeakObjects::UpdateWeakReferences(
});
}
// static
void WeakObjects::UpdateWeakObjectsInCode(
WeakObjectWorklist<HeapObjectAndCode>& weak_objects_in_code) {
weak_objects_in_code.Update(
......@@ -113,6 +120,7 @@ void WeakObjects::UpdateWeakObjectsInCode(
});
}
// static
void WeakObjects::UpdateJSWeakRefs(
WeakObjectWorklist<JSWeakRef>& js_weak_refs) {
js_weak_refs.Update(
......@@ -128,16 +136,19 @@ void WeakObjects::UpdateJSWeakRefs(
});
}
// static
void WeakObjects::UpdateWeakCells(WeakObjectWorklist<WeakCell>& weak_cells) {
// TODO(syg, marja): Support WeakCells in the young generation.
DCHECK(!ContainsYoungObjects(weak_cells));
}
// static
void WeakObjects::UpdateCodeFlushingCandidates(
WeakObjectWorklist<SharedFunctionInfo>& code_flushing_candidates) {
DCHECK(!ContainsYoungObjects(code_flushing_candidates));
}
// static
void WeakObjects::UpdateFlushedJSFunctions(
WeakObjectWorklist<JSFunction>& flushed_js_functions) {
flushed_js_functions.Update(
......@@ -153,6 +164,7 @@ void WeakObjects::UpdateFlushedJSFunctions(
});
}
// static
void WeakObjects::UpdateBaselineFlushingCandidates(
WeakObjectWorklist<JSFunction>& baseline_flush_candidates) {
baseline_flush_candidates.Update(
......@@ -169,6 +181,7 @@ void WeakObjects::UpdateBaselineFlushingCandidates(
}
#ifdef DEBUG
// static
template <typename Type>
bool WeakObjects::ContainsYoungObjects(WeakObjectWorklist<Type>& worklist) {
bool result = false;
......
......@@ -74,13 +74,13 @@ class WeakObjects {
private:
#define DECLARE_UPDATE_METHODS(Type, _, Name) \
void Update##Name(WeakObjectWorklist<Type>&);
static void Update##Name(WeakObjectWorklist<Type>&);
WEAK_OBJECT_WORKLISTS(DECLARE_UPDATE_METHODS)
#undef DECLARE_UPDATE_METHODS
#ifdef DEBUG
template <typename Type>
bool ContainsYoungObjects(WeakObjectWorklist<Type>& worklist);
static bool ContainsYoungObjects(WeakObjectWorklist<Type>& worklist);
#endif
};
......
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