[cleanup] Fix some -Wshadow warnings

Bug: v8:12244,v8:12245
Change-Id: Icfdf2666220ac06c01b6220b4ac99b9ad00818dc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3278687
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77911}
This commit is contained in:
Ng Zhi An 2021-11-12 16:46:48 -08:00 committed by V8 LUCI CQ
parent 6577c5e9e2
commit c25070c2a1
3 changed files with 20 additions and 19 deletions

View File

@ -828,13 +828,15 @@ void Genesis::CreateObjectFunction(Handle<JSFunction> empty_function) {
Handle<JSObject> object_function_prototype =
factory->NewFunctionPrototype(object_fun);
Handle<Map> map =
Map::Copy(isolate(), handle(object_function_prototype->map(), isolate()),
"EmptyObjectPrototype");
map->set_is_prototype_map(true);
// Ban re-setting Object.prototype.__proto__ to prevent Proxy security bug
map->set_is_immutable_proto(true);
object_function_prototype->set_map(*map);
{
Handle<Map> map = Map::Copy(
isolate(), handle(object_function_prototype->map(), isolate()),
"EmptyObjectPrototype");
map->set_is_prototype_map(true);
// Ban re-setting Object.prototype.__proto__ to prevent Proxy security bug
map->set_is_immutable_proto(true);
object_function_prototype->set_map(*map);
}
// Complete setting up empty function.
{
@ -1898,7 +1900,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
// Install Number constants
const double kMaxValue = 1.7976931348623157e+308;
const double kMinValue = 5e-324;
const double kMinSafeInteger = -kMaxSafeInteger;
const double kEPS = 2.220446049250313e-16;
InstallConstant(isolate_, number_fun, "MAX_VALUE",

View File

@ -616,10 +616,10 @@ void WasmTableObject::ClearDispatchTables(Isolate* isolate,
WasmInstanceObject::cast(
dispatch_tables->get(i + kDispatchTableInstanceOffset)),
isolate);
Handle<WasmIndirectFunctionTable> table =
Handle<WasmIndirectFunctionTable> function_table =
target_instance->GetIndirectFunctionTable(isolate, table_index);
DCHECK_LT(index, table->size());
table->Clear(index);
DCHECK_LT(index, function_table->size());
function_table->Clear(index);
}
}

View File

@ -78,10 +78,10 @@ class NamedEntriesDetector {
list.push_back(root);
CheckEntry(root);
while (!list.empty()) {
i::HeapEntry* entry = list.back();
i::HeapEntry* heap_entry = list.back();
list.pop_back();
for (int i = 0; i < entry->children_count(); ++i) {
i::HeapGraphEdge* edge = entry->child(i);
for (int i = 0; i < heap_entry->children_count(); ++i) {
i::HeapGraphEdge* edge = heap_entry->child(i);
if (edge->type() == i::HeapGraphEdge::kShortcut) continue;
i::HeapEntry* child = edge->to();
v8::base::HashMap::Entry* entry = visited.LookupOrInsert(
@ -189,9 +189,9 @@ static bool HasString(v8::Isolate* isolate, const v8::HeapGraphNode* node,
const char* contents) {
for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) {
const v8::HeapGraphEdge* prop = node->GetChild(i);
const v8::HeapGraphNode* node = prop->GetToNode();
if (node->GetType() == v8::HeapGraphNode::kString) {
v8::String::Utf8Value node_name(isolate, node->GetName());
const v8::HeapGraphNode* dest_node = prop->GetToNode();
if (dest_node->GetType() == v8::HeapGraphNode::kString) {
v8::String::Utf8Value node_name(isolate, dest_node->GetName());
if (strcmp(contents, *node_name) == 0) return true;
}
}
@ -1873,7 +1873,7 @@ TEST(NativeSnapshotObjectIdMoving) {
CHECK_NOT_NULL(merged_node);
{
v8::HandleScope scope(isolate);
v8::HandleScope inner_scope(isolate);
auto local = v8::Local<v8::String>::New(isolate, wrapper);
i::Handle<i::String> internal = i::Handle<i::String>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::String>::Cast(local)));
@ -2088,7 +2088,7 @@ TEST(GetHeapValueForDeletedObject) {
{
// Perform the check inside a nested local scope to avoid creating a
// reference to the object we are deleting.
v8::HandleScope scope(env->GetIsolate());
v8::HandleScope inner_scope(env->GetIsolate());
CHECK(heap_profiler->FindObjectById(prop->GetId())->IsObject());
}
CompileRun("delete a.p;");