diff --git a/test/cctest/parsing/test-scanner-streams.cc b/test/cctest/parsing/test-scanner-streams.cc index c2f462a27a53..eebe00717700 100644 --- a/test/cctest/parsing/test-scanner-streams.cc +++ b/test/cctest/parsing/test-scanner-streams.cc @@ -373,8 +373,8 @@ TEST(Utf8ChunkBoundaries) { v8::internal::ScannerStream::For( &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); - for (size_t i = 0; unicode_ucs2[i]; i++) { - CHECK_EQ(unicode_ucs2[i], stream->Advance()); + for (size_t j = 0; unicode_ucs2[j]; j++) { + CHECK_EQ(unicode_ucs2[j], stream->Advance()); } CHECK_EQ(v8::internal::Utf16CharacterStream::kEndOfInput, stream->Advance()); diff --git a/test/cctest/test-accessors.cc b/test/cctest/test-accessors.cc index 15f303ab7d18..271c99194831 100644 --- a/test/cctest/test-accessors.cc +++ b/test/cctest/test-accessors.cc @@ -316,7 +316,7 @@ THREADED_TEST(HandleScopePop) { int count_before = i::HandleScope::NumberOfHandles(reinterpret_cast(isolate)); { - v8::HandleScope scope(isolate); + v8::HandleScope inner_scope(isolate); CompileRun( "for (var i = 0; i < 1000; i++) {" " obj.one;" diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index f7cbc5449946..61398f2c5ea6 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -2627,7 +2627,7 @@ THREADED_TEST(DescriptorInheritance2) { v8::Local script = v8_compile("o = new F()"); for (int i = 0; i < 100; i++) { - v8::HandleScope scope(isolate); + v8::HandleScope inner_scope(isolate); script->Run(env.local()).ToLocalChecked(); } v8::Local object = script->Run(env.local()) @@ -7857,7 +7857,7 @@ void InternalFieldCallback(bool global_gc) { instance_templ->SetInternalFieldCount(2); v8::Persistent handle; { - v8::HandleScope scope(isolate); + v8::HandleScope inner_scope(isolate); Local obj = templ->GetFunction(env.local()) .ToLocalChecked() ->NewInstance(env.local()) @@ -9249,7 +9249,8 @@ THREADED_TEST(SecurityChecksForPrototypeChain) { // Change context to be able to get to the Object function in the // other context without hitting the security checks. v8::Local other_object; - { Context::Scope scope(other); + { + Context::Scope context_scope(other); other_object = other->Global()->Get(other, v8_str("Object")).ToLocalChecked(); CHECK(other->Global()->Set(other, v8_num(42), v8_num(87)).FromJust()); @@ -9293,7 +9294,8 @@ THREADED_TEST(SecurityChecksForPrototypeChain) { // Now it gets hairy: Set the prototype for the other global object // to be the current global object. The prototype chain for 'f' now // goes through 'other' but ends up in the current global object. - { Context::Scope scope(other); + { + Context::Scope context_scope(other); CHECK(other->Global() ->Set(other, v8_str("__proto__"), current->Global()) .FromJust()); @@ -9589,7 +9591,7 @@ TEST(DetachGlobal) { // Create a property on the global object in env2. { - v8::Context::Scope scope(env2); + v8::Context::Scope context_scope(env2); CHECK(env2->Global() ->Set(env2, v8_str("p"), v8::Integer::New(env2->GetIsolate(), 42)) .FromJust()); @@ -9624,7 +9626,7 @@ TEST(DetachGlobal) { // Create a property on the global object in env3. { - v8::Context::Scope scope(env3); + v8::Context::Scope context_scope(env3); CHECK(env3->Global() ->Set(env3, v8_str("p"), v8::Integer::New(env3->GetIsolate(), 24)) .FromJust()); @@ -9667,7 +9669,7 @@ TEST(DetachedAccesses) { .FromJust()); { - v8::Context::Scope scope(env2); + v8::Context::Scope context_scope(env2); CHECK(env2->Global()->Set(env2, v8_str("x"), v8_str("env2_x")).FromJust()); CompileRun( "function bound_x() { return x; }" @@ -9706,7 +9708,7 @@ TEST(DetachedAccesses) { v8::Local(), env2_global); env2->SetSecurityToken(foo); { - v8::Context::Scope scope(env2); + v8::Context::Scope context_scope(env2); CHECK(env2->Global()->Set(env2, v8_str("x"), v8_str("env3_x")).FromJust()); CHECK(env2->Global()->Set(env2, v8_str("env1"), env1->Global()).FromJust()); result = CompileRun( @@ -10548,7 +10550,6 @@ THREADED_TEST(ObjectGetOwnPropertyNames) { ->Equals(context.local(), v8_str("length")) .FromMaybe(false)); for (int i = 0; i < 4; ++i) { - v8::Local property; CHECK(properties->Get(context.local(), i).ToLocal(&property) && property->IsInt32()); CHECK_EQ(property.As()->Value(), i); @@ -10594,7 +10595,6 @@ THREADED_TEST(ObjectGetOwnPropertyNames) { bool concat_found = false; bool starts_with_found = false; for (uint32_t i = 0; i < properties->Length(); ++i) { - v8::Local property; CHECK(properties->Get(context.local(), i).ToLocal(&property)); if (!property->IsString()) continue; if (!concat_found) @@ -15316,8 +15316,9 @@ TEST(DefineProperty) { v8::TryCatch try_catch(isolate); // Use a writable descriptor, otherwise the next test, that changes // the array length will fail. - v8::PropertyDescriptor desc(v8_num(42), true); - CHECK(arr->DefineProperty(env.local(), v8_str("length"), desc).FromJust()); + v8::PropertyDescriptor desc_writable(v8_num(42), true); + CHECK(arr->DefineProperty(env.local(), v8_str("length"), desc_writable) + .FromJust()); CHECK(!try_catch.HasCaught()); } @@ -15412,11 +15413,11 @@ TEST(DefineProperty) { env->Global()->Get(env.local(), v8_str("get")).ToLocalChecked()); v8::Local set = v8::Local::Cast( env->Global()->Get(env.local(), v8_str("set")).ToLocalChecked()); - v8::PropertyDescriptor desc(get, set); + v8::PropertyDescriptor desc_getter_setter(get, set); p = v8_str("v7"); v8::TryCatch try_catch(isolate); - CHECK(obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(obj->DefineProperty(env.local(), p, desc_getter_setter).FromJust()); CHECK(!try_catch.HasCaught()); v8::Local val = obj->Get(env.local(), p).ToLocalChecked(); @@ -15437,12 +15438,12 @@ TEST(DefineProperty) { // Redefine an existing property. // desc = {value: 42, enumerable: true} - v8::PropertyDescriptor desc(v8_num(42)); - desc.set_enumerable(true); + v8::PropertyDescriptor desc42(v8_num(42)); + desc42.set_enumerable(true); p = v8_str("v8"); v8::TryCatch try_catch(isolate); - CHECK(obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(obj->DefineProperty(env.local(), p, desc42).FromJust()); CHECK(!try_catch.HasCaught()); // desc = {enumerable: true} @@ -15476,11 +15477,11 @@ TEST(DefineProperty) { env->Global()->Get(env.local(), v8_str("get")).ToLocalChecked()); // desc = {get: function() {}} - v8::PropertyDescriptor desc(get, v8::Local()); + v8::PropertyDescriptor desc_getter(get, v8::Local()); v8::TryCatch try_catch(isolate); p = v8_str("v9"); - CHECK(obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(obj->DefineProperty(env.local(), p, desc_getter).FromJust()); CHECK(!try_catch.HasCaught()); // desc_empty = {} @@ -15491,7 +15492,7 @@ TEST(DefineProperty) { // desc = {get: function() {}} // Successful because we redefine the getter with its current value. - CHECK(obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(obj->DefineProperty(env.local(), p, desc_getter).FromJust()); CHECK(!try_catch.HasCaught()); // desc = {get: undefined} @@ -17345,7 +17346,7 @@ TEST(Regress528) { // cache to the global object. const char* source_simple = "1"; { - v8::HandleScope scope(isolate); + v8::HandleScope inner_scope(isolate); v8::Local context = Context::New(isolate); context->Enter(); @@ -17369,7 +17370,7 @@ TEST(Regress528) { // global object. const char* source_eval = "function f(){eval('1')}; f()"; { - v8::HandleScope scope(isolate); + v8::HandleScope inner_scope(isolate); v8::Local context = Context::New(isolate); context->Enter(); @@ -17391,7 +17392,7 @@ TEST(Regress528) { // compilation cache to the global object. const char* source_exception = "function f(){throw 1;} f()"; { - v8::HandleScope scope(isolate); + v8::HandleScope inner_scope(isolate); v8::Local context = Context::New(isolate); context->Enter(); @@ -20333,7 +20334,7 @@ TEST(SetAutorunMicrotasks) { env->GetIsolate()->EnqueueMicrotask( Function::New(env.local(), MicrotaskTwo).ToLocalChecked()); { - v8::Isolate::SuppressMicrotaskExecutionScope scope(env->GetIsolate()); + v8::Isolate::SuppressMicrotaskExecutionScope suppress(env->GetIsolate()); CompileRun("1+1;"); CHECK_EQ(2, CompileRun("ext1Calls")->Int32Value(env.local()).FromJust()); CHECK_EQ(3, CompileRun("ext2Calls")->Int32Value(env.local()).FromJust()); @@ -24264,11 +24265,12 @@ TEST(CodeCache) { v8::Context::Scope cscope(context); v8::Local source_string = v8_str(source); v8::ScriptOrigin script_origin(isolate1, v8_str(origin)); - v8::ScriptCompiler::Source source(source_string, script_origin); + v8::ScriptCompiler::Source script_source(source_string, script_origin); v8::ScriptCompiler::CompileOptions option = v8::ScriptCompiler::kNoCompileOptions; v8::Local script = - v8::ScriptCompiler::Compile(context, &source, option).ToLocalChecked(); + v8::ScriptCompiler::Compile(context, &script_source, option) + .ToLocalChecked(); cache = v8::ScriptCompiler::CreateCodeCache(script->GetUnboundScript()); } isolate1->Dispose(); @@ -24281,14 +24283,15 @@ TEST(CodeCache) { v8::Context::Scope cscope(context); v8::Local source_string = v8_str(source); v8::ScriptOrigin script_origin(isolate2, v8_str(origin)); - v8::ScriptCompiler::Source source(source_string, script_origin, cache); + v8::ScriptCompiler::Source script_source(source_string, script_origin, + cache); v8::ScriptCompiler::CompileOptions option = v8::ScriptCompiler::kConsumeCodeCache; v8::Local script; { i::DisallowCompilation no_compile( reinterpret_cast(isolate2)); - script = v8::ScriptCompiler::Compile(context, &source, option) + script = v8::ScriptCompiler::Compile(context, &script_source, option) .ToLocalChecked(); } CHECK_EQ(2, script->Run(context) @@ -24879,11 +24882,11 @@ TEST(CodeCacheScriptModuleMismatch) { v8::Context::Scope cscope(context); v8::Local source_string = v8_str(source); v8::ScriptOrigin script_origin(isolate, v8_str(origin)); - v8::ScriptCompiler::Source source(source_string, script_origin); + v8::ScriptCompiler::Source script_source(source_string, script_origin); v8::ScriptCompiler::CompileOptions option = v8::ScriptCompiler::kNoCompileOptions; v8::Local script = - v8::ScriptCompiler::Compile(context, &source, option) + v8::ScriptCompiler::Compile(context, &script_source, option) .ToLocalChecked(); cache = v8::ScriptCompiler::CreateCodeCache(script->GetUnboundScript()); } @@ -25147,7 +25150,7 @@ TEST(SealHandleScopeNested) { v8::SealHandleScope seal(isolate); { - v8::HandleScope handle_scope(isolate); + v8::HandleScope inner_handle_scope(isolate); // Should work v8::Local obj = v8::Object::New(isolate); @@ -26044,7 +26047,7 @@ TEST(CrossActivationEval) { v8::HandleScope scope(isolate); { call_eval_context = v8::Context::New(isolate); - v8::Context::Scope scope(call_eval_context); + v8::Context::Scope context_scope(call_eval_context); call_eval_bound_function = Local::Cast(CompileRun("eval.bind(this, '1')")); } diff --git a/test/cctest/test-code-stub-assembler.cc b/test/cctest/test-code-stub-assembler.cc index dce6dda1e927..010bef26d882 100644 --- a/test/cctest/test-code-stub-assembler.cc +++ b/test/cctest/test-code-stub-assembler.cc @@ -3036,12 +3036,15 @@ TEST(NewPromiseCapability) { handle(JSFunction::cast(result->reject()), isolate)}; for (auto&& callback : callbacks) { - Handle context(Context::cast(callback->context()), isolate); + Handle callback_context(Context::cast(callback->context()), + isolate); CHECK_EQ(isolate->root(RootIndex::kEmptyScopeInfo), - context->scope_info()); - CHECK_EQ(*isolate->native_context(), context->native_context()); - CHECK_EQ(PromiseBuiltins::kPromiseContextLength, context->length()); - CHECK_EQ(context->get(PromiseBuiltins::kPromiseSlot), result->promise()); + callback_context->scope_info()); + CHECK_EQ(*isolate->native_context(), callback_context->native_context()); + CHECK_EQ(PromiseBuiltins::kPromiseContextLength, + callback_context->length()); + CHECK_EQ(callback_context->get(PromiseBuiltins::kPromiseSlot), + result->promise()); } } diff --git a/test/cctest/test-concurrent-feedback-vector.cc b/test/cctest/test-concurrent-feedback-vector.cc index 38f7c05ffea1..ec6f7079e1d8 100644 --- a/test/cctest/test-concurrent-feedback-vector.cc +++ b/test/cctest/test-concurrent-feedback-vector.cc @@ -68,8 +68,8 @@ class FeedbackVectorExplorationThread final : public v8::base::Thread { if (state == MONOMORPHIC || state == POLYMORPHIC) { MapHandles maps; nexus.ExtractMaps(&maps); - for (unsigned int i = 0; i < maps.size(); i++) { - CHECK(maps[i]->IsMap()); + for (unsigned int j = 0; j < maps.size(); j++) { + CHECK(maps[j]->IsMap()); } } diff --git a/test/cctest/test-concurrent-script-context-table.cc b/test/cctest/test-concurrent-script-context-table.cc index be1984c67380..d185d0538bbc 100644 --- a/test/cctest/test-concurrent-script-context-table.cc +++ b/test/cctest/test-concurrent-script-context-table.cc @@ -184,10 +184,10 @@ TEST(ScriptContextTable_AccessScriptContextTable) { sema_started.Wait(); for (; initialized_entries < 1000; ++initialized_entries) { - Handle context = + Handle new_context = factory->NewScriptContext(native_context, scope_info); script_context_table = - ScriptContextTable::Extend(script_context_table, context); + ScriptContextTable::Extend(script_context_table, new_context); native_context->synchronized_set_script_context_table( *script_context_table); // Update with relaxed semantics to not introduce ordering constraints. diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc index 00ac78f629d4..e03536fb757f 100644 --- a/test/cctest/test-cpu-profiler.cc +++ b/test/cctest/test-cpu-profiler.cc @@ -4277,7 +4277,7 @@ TEST(BytecodeFlushEventsEagerLogging) { // This compile will add the code to the compilation cache. { - v8::HandleScope scope(isolate); + v8::HandleScope inner_scope(isolate); CompileRun(source); } diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc index 171c963ea034..f98907fa9257 100644 --- a/test/cctest/test-debug.cc +++ b/test/cctest/test-debug.cc @@ -3269,15 +3269,16 @@ TEST(DebugScriptLineEndsAreAscending) { v8::HandleScope scope(isolate); // Compile a test script. - v8::Local script = v8_str(isolate, - "function f() {\n" - " debugger;\n" - "}\n"); + v8::Local script_source = v8_str(isolate, + "function f() {\n" + " debugger;\n" + "}\n"); v8::ScriptOrigin origin1 = v8::ScriptOrigin(isolate, v8_str(isolate, "name")); - v8::Local script1 = - v8::Script::Compile(env.local(), script, &origin1).ToLocalChecked(); - USE(script1); + v8::Local script = + v8::Script::Compile(env.local(), script_source, &origin1) + .ToLocalChecked(); + USE(script); Handle instances; { @@ -3287,12 +3288,12 @@ TEST(DebugScriptLineEndsAreAscending) { CHECK_GT(instances->length(), 0); for (int i = 0; i < instances->length(); i++) { - Handle script = Handle( + Handle new_script = Handle( v8::internal::Script::cast(instances->get(i)), CcTest::i_isolate()); - v8::internal::Script::InitLineEnds(CcTest::i_isolate(), script); + v8::internal::Script::InitLineEnds(CcTest::i_isolate(), new_script); v8::internal::FixedArray ends = - v8::internal::FixedArray::cast(script->line_ends()); + v8::internal::FixedArray::cast(new_script->line_ends()); CHECK_GT(ends.length(), 0); int prev_end = -1; diff --git a/test/cctest/test-field-type-tracking.cc b/test/cctest/test-field-type-tracking.cc index 342dd46d53ed..ddd2388bdc85 100644 --- a/test/cctest/test-field-type-tracking.cc +++ b/test/cctest/test-field-type-tracking.cc @@ -785,9 +785,9 @@ void TestGeneralizeField(const CRFTData& from, const CRFTData& to, // Check the cases when the map being reconfigured is NOT a part of the // transition tree. "None -> anything" representation changes make sense // only for "attached" maps. - int indices[] = {0, kPropCount - 1}; - for (int i = 0; i < static_cast(arraysize(indices)); i++) { - TestGeneralizeField(indices[i], 2, from, to, expected, expected_alert); + int indices2[] = {0, kPropCount - 1}; + for (int i = 0; i < static_cast(arraysize(indices2)); i++) { + TestGeneralizeField(indices2[i], 2, from, to, expected, expected_alert); } // Check that reconfiguration to the very same field works correctly. @@ -2196,8 +2196,8 @@ static void TestGeneralizeFieldWithSpecialTransition( if (config->is_non_equivalent_transition()) { // In case of non-equivalent transition currently we generalize all // representations. - for (int i = 0; i < kPropCount; i++) { - expectations2.GeneralizeField(i); + for (int j = 0; j < kPropCount; j++) { + expectations2.GeneralizeField(j); } CHECK(new_map2->GetBackPointer().IsUndefined(isolate)); CHECK(expectations2.Check(*new_map2)); diff --git a/test/cctest/test-global-handles.cc b/test/cctest/test-global-handles.cc index 55b34e3838da..d9efaba7b1e5 100644 --- a/test/cctest/test-global-handles.cc +++ b/test/cctest/test-global-handles.cc @@ -504,7 +504,7 @@ TEST(FinalizerOnUnmodifiedJSApiObjectDoesNotCrash) { v8::WeakCallbackType::kFinalizer); fp.flag = false; { - v8::HandleScope scope(isolate); + v8::HandleScope inner_scope(isolate); v8::Local tmp = v8::Local::New(isolate, fp.handle); USE(tmp); InvokeScavenge();