Commit 5ccc719a authored by krasin's avatar krasin Committed by Commit bot

Fix unused lambda captures.

Clang just got more strict about unused lambda captures,
and that requires us to clean all places with this issue
across all the Chromium code base. This CL fixes all such
cases in V8.

BUG=chromium:681136

Review-Url: https://codereview.chromium.org/2646553002
Cr-Commit-Position: refs/heads/master@{#42523}
parent 4e565c68
......@@ -318,7 +318,7 @@ void Builtins::Generate_FastArrayPush(compiler::CodeAssemblerState* state) {
assembler.Bind(&default_label);
{
args.ForEach(
[&assembler, receiver, context, &arg_index](Node* arg) {
[&assembler, receiver, context](Node* arg) {
Node* length = assembler.LoadJSArrayLength(receiver);
assembler.CallRuntime(Runtime::kSetProperty, context, receiver,
length, arg, assembler.SmiConstant(STRICT));
......
......@@ -1841,7 +1841,7 @@ void GetPropertyStub::GenerateAssembly(
};
CodeStubAssembler::LookupInHolder lookup_element_in_holder =
[&assembler, context, &var_result, &end](
[&assembler](
Node* receiver, Node* holder, Node* holder_map,
Node* holder_instance_type, Node* index, Label* next_holder,
Label* if_bailout) {
......
......@@ -3676,7 +3676,7 @@ class PointerUpdateJobTraits {
private:
static void UpdateUntypedPointers(Heap* heap, MemoryChunk* chunk) {
if (direction == OLD_TO_NEW) {
RememberedSet<OLD_TO_NEW>::Iterate(chunk, [heap, chunk](Address slot) {
RememberedSet<OLD_TO_NEW>::Iterate(chunk, [heap](Address slot) {
return CheckAndUpdateOldToNewSlot(heap, slot);
});
} else {
......
......@@ -780,7 +780,7 @@ void Page::ResetFreeListStatistics() {
size_t Page::AvailableInFreeList() {
size_t sum = 0;
ForAllFreeListCategories([this, &sum](FreeListCategory* category) {
ForAllFreeListCategories([&sum](FreeListCategory* category) {
sum += category->available();
});
return sum;
......@@ -2636,7 +2636,7 @@ HeapObject* FreeList::Allocate(size_t size_in_bytes) {
size_t FreeList::EvictFreeListItems(Page* page) {
size_t sum = 0;
page->ForAllFreeListCategories(
[this, &sum, page](FreeListCategory* category) {
[this, &sum](FreeListCategory* category) {
DCHECK_EQ(this, category->owner());
sum += category->available();
RemoveCategory(category);
......
......@@ -150,8 +150,11 @@ TEST(SlotSet, RemoveRange) {
TEST(TypedSlotSet, Iterate) {
TypedSlotSet set(0);
const int kDelta = 10000001;
const int kHostDelta = 50001;
// These two constants must be static as a workaround
// for a MSVC++ bug about lambda captures, see the discussion at
// https://social.msdn.microsoft.com/Forums/SqlServer/4abf18bd-4ae4-4c72-ba3e-3b13e7909d5f
static const int kDelta = 10000001;
static const int kHostDelta = 50001;
int added = 0;
uint32_t j = 0;
for (uint32_t i = 0; i < TypedSlotSet::kMaxOffset;
......@@ -162,8 +165,8 @@ TEST(TypedSlotSet, Iterate) {
}
int iterated = 0;
set.Iterate(
[&iterated, kDelta, kHostDelta](SlotType type, Address host_addr,
Address addr) {
[&iterated](SlotType type, Address host_addr,
Address addr) {
uint32_t i = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr));
uint32_t j =
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(host_addr));
......
......@@ -1178,7 +1178,7 @@ TEST_F(ValueSerializerTest, RoundTripArrayWithTrickyGetters) {
TEST_F(ValueSerializerTest, DecodeSparseArrayVersion0) {
// Empty (sparse) array.
DecodeTestForVersion0({0x40, 0x00, 0x00, 0x00},
[this](Local<Value> value) {
[](Local<Value> value) {
ASSERT_TRUE(value->IsArray());
ASSERT_EQ(0u, Array::Cast(*value)->Length());
});
......@@ -1210,16 +1210,16 @@ TEST_F(ValueSerializerTest, DecodeSparseArrayVersion0) {
}
TEST_F(ValueSerializerTest, RoundTripDate) {
RoundTripTest("new Date(1e6)", [this](Local<Value> value) {
RoundTripTest("new Date(1e6)", [](Local<Value> value) {
ASSERT_TRUE(value->IsDate());
EXPECT_EQ(1e6, Date::Cast(*value)->ValueOf());
EXPECT_TRUE("Object.getPrototypeOf(result) === Date.prototype");
});
RoundTripTest("new Date(Date.UTC(1867, 6, 1))", [this](Local<Value> value) {
RoundTripTest("new Date(Date.UTC(1867, 6, 1))", [](Local<Value> value) {
ASSERT_TRUE(value->IsDate());
EXPECT_TRUE("result.toISOString() === '1867-07-01T00:00:00.000Z'");
});
RoundTripTest("new Date(NaN)", [this](Local<Value> value) {
RoundTripTest("new Date(NaN)", [](Local<Value> value) {
ASSERT_TRUE(value->IsDate());
EXPECT_TRUE(std::isnan(Date::Cast(*value)->ValueOf()));
});
......@@ -1235,7 +1235,7 @@ TEST_F(ValueSerializerTest, DecodeDate) {
#if defined(V8_TARGET_LITTLE_ENDIAN)
DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x80, 0x84,
0x2e, 0x41, 0x00},
[this](Local<Value> value) {
[](Local<Value> value) {
ASSERT_TRUE(value->IsDate());
EXPECT_EQ(1e6, Date::Cast(*value)->ValueOf());
EXPECT_TRUE("Object.getPrototypeOf(result) === Date.prototype");
......@@ -1243,13 +1243,13 @@ TEST_F(ValueSerializerTest, DecodeDate) {
DecodeTest(
{0xff, 0x09, 0x3f, 0x00, 0x44, 0x00, 0x00, 0x20, 0x45, 0x27, 0x89, 0x87,
0xc2, 0x00},
[this](Local<Value> value) {
[](Local<Value> value) {
ASSERT_TRUE(value->IsDate());
EXPECT_TRUE("result.toISOString() === '1867-07-01T00:00:00.000Z'");
});
DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf8, 0x7f, 0x00},
[this](Local<Value> value) {
[](Local<Value> value) {
ASSERT_TRUE(value->IsDate());
EXPECT_TRUE(std::isnan(Date::Cast(*value)->ValueOf()));
});
......
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