Commit c25070c2 authored by Ng Zhi An's avatar Ng Zhi An Committed by V8 LUCI CQ

[cleanup] Fix some -Wshadow warnings

Bug: v8:12244,v8:12245
Change-Id: Icfdf2666220ac06c01b6220b4ac99b9ad00818dc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3278687Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77911}
parent 6577c5e9
...@@ -828,13 +828,15 @@ void Genesis::CreateObjectFunction(Handle<JSFunction> empty_function) { ...@@ -828,13 +828,15 @@ void Genesis::CreateObjectFunction(Handle<JSFunction> empty_function) {
Handle<JSObject> object_function_prototype = Handle<JSObject> object_function_prototype =
factory->NewFunctionPrototype(object_fun); factory->NewFunctionPrototype(object_fun);
Handle<Map> map = {
Map::Copy(isolate(), handle(object_function_prototype->map(), isolate()), Handle<Map> map = Map::Copy(
"EmptyObjectPrototype"); isolate(), handle(object_function_prototype->map(), isolate()),
map->set_is_prototype_map(true); "EmptyObjectPrototype");
// Ban re-setting Object.prototype.__proto__ to prevent Proxy security bug map->set_is_prototype_map(true);
map->set_is_immutable_proto(true); // Ban re-setting Object.prototype.__proto__ to prevent Proxy security bug
object_function_prototype->set_map(*map); map->set_is_immutable_proto(true);
object_function_prototype->set_map(*map);
}
// Complete setting up empty function. // Complete setting up empty function.
{ {
...@@ -1898,7 +1900,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, ...@@ -1898,7 +1900,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
// Install Number constants // Install Number constants
const double kMaxValue = 1.7976931348623157e+308; const double kMaxValue = 1.7976931348623157e+308;
const double kMinValue = 5e-324; const double kMinValue = 5e-324;
const double kMinSafeInteger = -kMaxSafeInteger;
const double kEPS = 2.220446049250313e-16; const double kEPS = 2.220446049250313e-16;
InstallConstant(isolate_, number_fun, "MAX_VALUE", InstallConstant(isolate_, number_fun, "MAX_VALUE",
......
...@@ -616,10 +616,10 @@ void WasmTableObject::ClearDispatchTables(Isolate* isolate, ...@@ -616,10 +616,10 @@ void WasmTableObject::ClearDispatchTables(Isolate* isolate,
WasmInstanceObject::cast( WasmInstanceObject::cast(
dispatch_tables->get(i + kDispatchTableInstanceOffset)), dispatch_tables->get(i + kDispatchTableInstanceOffset)),
isolate); isolate);
Handle<WasmIndirectFunctionTable> table = Handle<WasmIndirectFunctionTable> function_table =
target_instance->GetIndirectFunctionTable(isolate, table_index); target_instance->GetIndirectFunctionTable(isolate, table_index);
DCHECK_LT(index, table->size()); DCHECK_LT(index, function_table->size());
table->Clear(index); function_table->Clear(index);
} }
} }
......
...@@ -78,10 +78,10 @@ class NamedEntriesDetector { ...@@ -78,10 +78,10 @@ class NamedEntriesDetector {
list.push_back(root); list.push_back(root);
CheckEntry(root); CheckEntry(root);
while (!list.empty()) { while (!list.empty()) {
i::HeapEntry* entry = list.back(); i::HeapEntry* heap_entry = list.back();
list.pop_back(); list.pop_back();
for (int i = 0; i < entry->children_count(); ++i) { for (int i = 0; i < heap_entry->children_count(); ++i) {
i::HeapGraphEdge* edge = entry->child(i); i::HeapGraphEdge* edge = heap_entry->child(i);
if (edge->type() == i::HeapGraphEdge::kShortcut) continue; if (edge->type() == i::HeapGraphEdge::kShortcut) continue;
i::HeapEntry* child = edge->to(); i::HeapEntry* child = edge->to();
v8::base::HashMap::Entry* entry = visited.LookupOrInsert( v8::base::HashMap::Entry* entry = visited.LookupOrInsert(
...@@ -189,9 +189,9 @@ static bool HasString(v8::Isolate* isolate, const v8::HeapGraphNode* node, ...@@ -189,9 +189,9 @@ static bool HasString(v8::Isolate* isolate, const v8::HeapGraphNode* node,
const char* contents) { const char* contents) {
for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) { for (int i = 0, count = node->GetChildrenCount(); i < count; ++i) {
const v8::HeapGraphEdge* prop = node->GetChild(i); const v8::HeapGraphEdge* prop = node->GetChild(i);
const v8::HeapGraphNode* node = prop->GetToNode(); const v8::HeapGraphNode* dest_node = prop->GetToNode();
if (node->GetType() == v8::HeapGraphNode::kString) { if (dest_node->GetType() == v8::HeapGraphNode::kString) {
v8::String::Utf8Value node_name(isolate, node->GetName()); v8::String::Utf8Value node_name(isolate, dest_node->GetName());
if (strcmp(contents, *node_name) == 0) return true; if (strcmp(contents, *node_name) == 0) return true;
} }
} }
...@@ -1873,7 +1873,7 @@ TEST(NativeSnapshotObjectIdMoving) { ...@@ -1873,7 +1873,7 @@ TEST(NativeSnapshotObjectIdMoving) {
CHECK_NOT_NULL(merged_node); CHECK_NOT_NULL(merged_node);
{ {
v8::HandleScope scope(isolate); v8::HandleScope inner_scope(isolate);
auto local = v8::Local<v8::String>::New(isolate, wrapper); auto local = v8::Local<v8::String>::New(isolate, wrapper);
i::Handle<i::String> internal = i::Handle<i::String>::cast( i::Handle<i::String> internal = i::Handle<i::String>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::String>::Cast(local))); v8::Utils::OpenHandle(*v8::Local<v8::String>::Cast(local)));
...@@ -2088,7 +2088,7 @@ TEST(GetHeapValueForDeletedObject) { ...@@ -2088,7 +2088,7 @@ TEST(GetHeapValueForDeletedObject) {
{ {
// Perform the check inside a nested local scope to avoid creating a // Perform the check inside a nested local scope to avoid creating a
// reference to the object we are deleting. // 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()); CHECK(heap_profiler->FindObjectById(prop->GetId())->IsObject());
} }
CompileRun("delete a.p;"); CompileRun("delete a.p;");
......
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