| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 MockPartitionStatsDumper mockStatsDumperGeneric; | 1338 MockPartitionStatsDumper mockStatsDumperGeneric; |
| 1339 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_all
ocator", &mockStatsDumperGeneric); | 1339 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_all
ocator", &mockStatsDumperGeneric); |
| 1340 EXPECT_TRUE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); | 1340 EXPECT_TRUE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); |
| 1341 | 1341 |
| 1342 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(2048); | 1342 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(2048); |
| 1343 EXPECT_TRUE(stats); | 1343 EXPECT_TRUE(stats); |
| 1344 EXPECT_TRUE(stats->isValid); | 1344 EXPECT_TRUE(stats->isValid); |
| 1345 EXPECT_EQ(2048u, stats->bucketSlotSize); | 1345 EXPECT_EQ(2048u, stats->bucketSlotSize); |
| 1346 EXPECT_EQ(2048u, stats->activeBytes); | 1346 EXPECT_EQ(2048u, stats->activeBytes); |
| 1347 EXPECT_EQ(kSystemPageSize, stats->residentBytes); | 1347 EXPECT_EQ(kSystemPageSize, stats->residentBytes); |
| 1348 EXPECT_EQ(0u, stats->freeableBytes); | 1348 EXPECT_EQ(0u, stats->decommittableBytes); |
| 1349 EXPECT_EQ(0u, stats->numFullPages); | 1349 EXPECT_EQ(0u, stats->numFullPages); |
| 1350 EXPECT_EQ(1u, stats->numActivePages); | 1350 EXPECT_EQ(1u, stats->numActivePages); |
| 1351 EXPECT_EQ(0u, stats->numEmptyPages); | 1351 EXPECT_EQ(0u, stats->numEmptyPages); |
| 1352 EXPECT_EQ(0u, stats->numDecommittedPages); | 1352 EXPECT_EQ(0u, stats->numDecommittedPages); |
| 1353 } | 1353 } |
| 1354 | 1354 |
| 1355 partitionFreeGeneric(genericAllocator.root(), genericPtr); | 1355 partitionFreeGeneric(genericAllocator.root(), genericPtr); |
| 1356 | 1356 |
| 1357 { | 1357 { |
| 1358 MockPartitionStatsDumper mockStatsDumperGeneric; | 1358 MockPartitionStatsDumper mockStatsDumperGeneric; |
| 1359 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_all
ocator", &mockStatsDumperGeneric); | 1359 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_all
ocator", &mockStatsDumperGeneric); |
| 1360 EXPECT_FALSE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); | 1360 EXPECT_FALSE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); |
| 1361 | 1361 |
| 1362 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(2048); | 1362 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(2048); |
| 1363 EXPECT_TRUE(stats); | 1363 EXPECT_TRUE(stats); |
| 1364 EXPECT_TRUE(stats->isValid); | 1364 EXPECT_TRUE(stats->isValid); |
| 1365 EXPECT_EQ(2048u, stats->bucketSlotSize); | 1365 EXPECT_EQ(2048u, stats->bucketSlotSize); |
| 1366 EXPECT_EQ(0u, stats->activeBytes); | 1366 EXPECT_EQ(0u, stats->activeBytes); |
| 1367 EXPECT_EQ(kSystemPageSize, stats->residentBytes); | 1367 EXPECT_EQ(kSystemPageSize, stats->residentBytes); |
| 1368 EXPECT_EQ(kSystemPageSize, stats->freeableBytes); | 1368 EXPECT_EQ(kSystemPageSize, stats->decommittableBytes); |
| 1369 EXPECT_EQ(0u, stats->numFullPages); | 1369 EXPECT_EQ(0u, stats->numFullPages); |
| 1370 EXPECT_EQ(0u, stats->numActivePages); | 1370 EXPECT_EQ(0u, stats->numActivePages); |
| 1371 EXPECT_EQ(1u, stats->numEmptyPages); | 1371 EXPECT_EQ(1u, stats->numEmptyPages); |
| 1372 EXPECT_EQ(0u, stats->numDecommittedPages); | 1372 EXPECT_EQ(0u, stats->numDecommittedPages); |
| 1373 } | 1373 } |
| 1374 | 1374 |
| 1375 CycleGenericFreeCache(kTestAllocSize); | 1375 CycleGenericFreeCache(kTestAllocSize); |
| 1376 | 1376 |
| 1377 { | 1377 { |
| 1378 MockPartitionStatsDumper mockStatsDumperGeneric; | 1378 MockPartitionStatsDumper mockStatsDumperGeneric; |
| 1379 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_all
ocator", &mockStatsDumperGeneric); | 1379 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_all
ocator", &mockStatsDumperGeneric); |
| 1380 EXPECT_FALSE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); | 1380 EXPECT_FALSE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); |
| 1381 | 1381 |
| 1382 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(2048); | 1382 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(2048); |
| 1383 EXPECT_TRUE(stats); | 1383 EXPECT_TRUE(stats); |
| 1384 EXPECT_TRUE(stats->isValid); | 1384 EXPECT_TRUE(stats->isValid); |
| 1385 EXPECT_EQ(2048u, stats->bucketSlotSize); | 1385 EXPECT_EQ(2048u, stats->bucketSlotSize); |
| 1386 EXPECT_EQ(0u, stats->activeBytes); | 1386 EXPECT_EQ(0u, stats->activeBytes); |
| 1387 EXPECT_EQ(0u, stats->residentBytes); | 1387 EXPECT_EQ(0u, stats->residentBytes); |
| 1388 EXPECT_EQ(0u, stats->freeableBytes); | 1388 EXPECT_EQ(0u, stats->decommittableBytes); |
| 1389 EXPECT_EQ(0u, stats->numFullPages); | 1389 EXPECT_EQ(0u, stats->numFullPages); |
| 1390 EXPECT_EQ(0u, stats->numActivePages); | 1390 EXPECT_EQ(0u, stats->numActivePages); |
| 1391 EXPECT_EQ(0u, stats->numEmptyPages); | 1391 EXPECT_EQ(0u, stats->numEmptyPages); |
| 1392 EXPECT_EQ(1u, stats->numDecommittedPages); | 1392 EXPECT_EQ(1u, stats->numDecommittedPages); |
| 1393 } | 1393 } |
| 1394 } | 1394 } |
| 1395 | 1395 |
| 1396 // This test checks for correct empty page list accounting. | 1396 // This test checks for correct empty page list accounting. |
| 1397 { | 1397 { |
| 1398 size_t size = kPartitionPageSize - kExtraAllocSize; | 1398 size_t size = kPartitionPageSize - kExtraAllocSize; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1409 MockPartitionStatsDumper mockStatsDumperGeneric; | 1409 MockPartitionStatsDumper mockStatsDumperGeneric; |
| 1410 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_all
ocator", &mockStatsDumperGeneric); | 1410 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_all
ocator", &mockStatsDumperGeneric); |
| 1411 EXPECT_TRUE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); | 1411 EXPECT_TRUE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); |
| 1412 | 1412 |
| 1413 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(kPartitionPageSize); | 1413 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(kPartitionPageSize); |
| 1414 EXPECT_TRUE(stats); | 1414 EXPECT_TRUE(stats); |
| 1415 EXPECT_TRUE(stats->isValid); | 1415 EXPECT_TRUE(stats->isValid); |
| 1416 EXPECT_EQ(kPartitionPageSize, stats->bucketSlotSize); | 1416 EXPECT_EQ(kPartitionPageSize, stats->bucketSlotSize); |
| 1417 EXPECT_EQ(kPartitionPageSize, stats->activeBytes); | 1417 EXPECT_EQ(kPartitionPageSize, stats->activeBytes); |
| 1418 EXPECT_EQ(kPartitionPageSize, stats->residentBytes); | 1418 EXPECT_EQ(kPartitionPageSize, stats->residentBytes); |
| 1419 EXPECT_EQ(0u, stats->freeableBytes); | 1419 EXPECT_EQ(0u, stats->decommittableBytes); |
| 1420 EXPECT_EQ(1u, stats->numFullPages); | 1420 EXPECT_EQ(1u, stats->numFullPages); |
| 1421 EXPECT_EQ(0u, stats->numActivePages); | 1421 EXPECT_EQ(0u, stats->numActivePages); |
| 1422 EXPECT_EQ(0u, stats->numEmptyPages); | 1422 EXPECT_EQ(0u, stats->numEmptyPages); |
| 1423 EXPECT_EQ(1u, stats->numDecommittedPages); | 1423 EXPECT_EQ(1u, stats->numDecommittedPages); |
| 1424 } | 1424 } |
| 1425 partitionFreeGeneric(genericAllocator.root(), ptr1); | 1425 partitionFreeGeneric(genericAllocator.root(), ptr1); |
| 1426 } | 1426 } |
| 1427 | 1427 |
| 1428 // This test checks for correct direct mapped accounting. | 1428 // This test checks for correct direct mapped accounting. |
| 1429 { | 1429 { |
| 1430 size_t sizeSmaller = kGenericMaxBucketed + 1; | 1430 size_t sizeSmaller = kGenericMaxBucketed + 1; |
| 1431 size_t sizeBigger = (kGenericMaxBucketed * 2) + 1; | 1431 size_t sizeBigger = (kGenericMaxBucketed * 2) + 1; |
| 1432 size_t realSizeSmaller = (sizeSmaller + kSystemPageOffsetMask) & kSystem
PageBaseMask; | 1432 size_t realSizeSmaller = (sizeSmaller + kSystemPageOffsetMask) & kSystem
PageBaseMask; |
| 1433 size_t realSizeBigger = (sizeBigger + kSystemPageOffsetMask) & kSystemPa
geBaseMask; | 1433 size_t realSizeBigger = (sizeBigger + kSystemPageOffsetMask) & kSystemPa
geBaseMask; |
| 1434 void* ptr = partitionAllocGeneric(genericAllocator.root(), sizeSmaller); | 1434 void* ptr = partitionAllocGeneric(genericAllocator.root(), sizeSmaller); |
| 1435 void* ptr2 = partitionAllocGeneric(genericAllocator.root(), sizeBigger); | 1435 void* ptr2 = partitionAllocGeneric(genericAllocator.root(), sizeBigger); |
| 1436 | 1436 |
| 1437 { | 1437 { |
| 1438 MockPartitionStatsDumper mockStatsDumperGeneric; | 1438 MockPartitionStatsDumper mockStatsDumperGeneric; |
| 1439 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_all
ocator", &mockStatsDumperGeneric); | 1439 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_all
ocator", &mockStatsDumperGeneric); |
| 1440 EXPECT_TRUE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); | 1440 EXPECT_TRUE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); |
| 1441 | 1441 |
| 1442 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(realSizeSmaller); | 1442 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(realSizeSmaller); |
| 1443 EXPECT_TRUE(stats); | 1443 EXPECT_TRUE(stats); |
| 1444 EXPECT_TRUE(stats->isValid); | 1444 EXPECT_TRUE(stats->isValid); |
| 1445 EXPECT_TRUE(stats->isDirectMap); | 1445 EXPECT_TRUE(stats->isDirectMap); |
| 1446 EXPECT_EQ(realSizeSmaller, stats->bucketSlotSize); | 1446 EXPECT_EQ(realSizeSmaller, stats->bucketSlotSize); |
| 1447 EXPECT_EQ(realSizeSmaller, stats->activeBytes); | 1447 EXPECT_EQ(realSizeSmaller, stats->activeBytes); |
| 1448 EXPECT_EQ(realSizeSmaller, stats->residentBytes); | 1448 EXPECT_EQ(realSizeSmaller, stats->residentBytes); |
| 1449 EXPECT_EQ(0u, stats->freeableBytes); | 1449 EXPECT_EQ(0u, stats->decommittableBytes); |
| 1450 EXPECT_EQ(1u, stats->numFullPages); | 1450 EXPECT_EQ(1u, stats->numFullPages); |
| 1451 EXPECT_EQ(0u, stats->numActivePages); | 1451 EXPECT_EQ(0u, stats->numActivePages); |
| 1452 EXPECT_EQ(0u, stats->numEmptyPages); | 1452 EXPECT_EQ(0u, stats->numEmptyPages); |
| 1453 EXPECT_EQ(0u, stats->numDecommittedPages); | 1453 EXPECT_EQ(0u, stats->numDecommittedPages); |
| 1454 | 1454 |
| 1455 stats = mockStatsDumperGeneric.GetBucketStats(realSizeBigger); | 1455 stats = mockStatsDumperGeneric.GetBucketStats(realSizeBigger); |
| 1456 EXPECT_TRUE(stats); | 1456 EXPECT_TRUE(stats); |
| 1457 EXPECT_TRUE(stats->isValid); | 1457 EXPECT_TRUE(stats->isValid); |
| 1458 EXPECT_TRUE(stats->isDirectMap); | 1458 EXPECT_TRUE(stats->isDirectMap); |
| 1459 EXPECT_EQ(realSizeBigger, stats->bucketSlotSize); | 1459 EXPECT_EQ(realSizeBigger, stats->bucketSlotSize); |
| 1460 EXPECT_EQ(realSizeBigger, stats->activeBytes); | 1460 EXPECT_EQ(realSizeBigger, stats->activeBytes); |
| 1461 EXPECT_EQ(realSizeBigger, stats->residentBytes); | 1461 EXPECT_EQ(realSizeBigger, stats->residentBytes); |
| 1462 EXPECT_EQ(0u, stats->freeableBytes); | 1462 EXPECT_EQ(0u, stats->decommittableBytes); |
| 1463 EXPECT_EQ(1u, stats->numFullPages); | 1463 EXPECT_EQ(1u, stats->numFullPages); |
| 1464 EXPECT_EQ(0u, stats->numActivePages); | 1464 EXPECT_EQ(0u, stats->numActivePages); |
| 1465 EXPECT_EQ(0u, stats->numEmptyPages); | 1465 EXPECT_EQ(0u, stats->numEmptyPages); |
| 1466 EXPECT_EQ(0u, stats->numDecommittedPages); | 1466 EXPECT_EQ(0u, stats->numDecommittedPages); |
| 1467 } | 1467 } |
| 1468 | 1468 |
| 1469 partitionFreeGeneric(genericAllocator.root(), ptr2); | 1469 partitionFreeGeneric(genericAllocator.root(), ptr2); |
| 1470 partitionFreeGeneric(genericAllocator.root(), ptr); | 1470 partitionFreeGeneric(genericAllocator.root(), ptr); |
| 1471 | 1471 |
| 1472 // Whilst we're here, allocate again and free with different ordering | 1472 // Whilst we're here, allocate again and free with different ordering |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1487 EXPECT_TRUE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); | 1487 EXPECT_TRUE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); |
| 1488 | 1488 |
| 1489 size_t slotSize = 65536 + (65536 / kGenericNumBucketsPerOrder); | 1489 size_t slotSize = 65536 + (65536 / kGenericNumBucketsPerOrder); |
| 1490 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(slotSize); | 1490 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.Get
BucketStats(slotSize); |
| 1491 EXPECT_TRUE(stats); | 1491 EXPECT_TRUE(stats); |
| 1492 EXPECT_TRUE(stats->isValid); | 1492 EXPECT_TRUE(stats->isValid); |
| 1493 EXPECT_FALSE(stats->isDirectMap); | 1493 EXPECT_FALSE(stats->isDirectMap); |
| 1494 EXPECT_EQ(slotSize, stats->bucketSlotSize); | 1494 EXPECT_EQ(slotSize, stats->bucketSlotSize); |
| 1495 EXPECT_EQ(65536 + kSystemPageSize, stats->activeBytes); | 1495 EXPECT_EQ(65536 + kSystemPageSize, stats->activeBytes); |
| 1496 EXPECT_EQ(slotSize, stats->residentBytes); | 1496 EXPECT_EQ(slotSize, stats->residentBytes); |
| 1497 EXPECT_EQ(0u, stats->freeableBytes); | 1497 EXPECT_EQ(0u, stats->decommittableBytes); |
| 1498 EXPECT_EQ(1u, stats->numFullPages); | 1498 EXPECT_EQ(1u, stats->numFullPages); |
| 1499 EXPECT_EQ(0u, stats->numActivePages); | 1499 EXPECT_EQ(0u, stats->numActivePages); |
| 1500 EXPECT_EQ(0u, stats->numEmptyPages); | 1500 EXPECT_EQ(0u, stats->numEmptyPages); |
| 1501 EXPECT_EQ(0u, stats->numDecommittedPages); | 1501 EXPECT_EQ(0u, stats->numDecommittedPages); |
| 1502 } | 1502 } |
| 1503 | 1503 |
| 1504 partitionFreeGeneric(genericAllocator.root(), ptr); | 1504 partitionFreeGeneric(genericAllocator.root(), ptr); |
| 1505 } | 1505 } |
| 1506 | 1506 |
| 1507 TestShutdown(); | 1507 TestShutdown(); |
| 1508 } | 1508 } |
| 1509 | 1509 |
| 1510 // Tests the API to purge freeable memory. | 1510 // Tests the API to purge freeable memory. |
| 1511 TEST(PartitionAllocTest, Purge) | 1511 TEST(PartitionAllocTest, Purge) |
| 1512 { | 1512 { |
| 1513 TestSetup(); | 1513 TestSetup(); |
| 1514 | 1514 |
| 1515 void* ptr = partitionAllocGeneric(genericAllocator.root(), 2048 - kExtraAllo
cSize); | 1515 void* ptr = partitionAllocGeneric(genericAllocator.root(), 2048 - kExtraAllo
cSize); |
| 1516 partitionFreeGeneric(genericAllocator.root(), ptr); | 1516 partitionFreeGeneric(genericAllocator.root(), ptr); |
| 1517 { | 1517 { |
| 1518 MockPartitionStatsDumper mockStatsDumperGeneric; | 1518 MockPartitionStatsDumper mockStatsDumperGeneric; |
| 1519 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_allocat
or", &mockStatsDumperGeneric); | 1519 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_allocat
or", &mockStatsDumperGeneric); |
| 1520 EXPECT_FALSE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); | 1520 EXPECT_FALSE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); |
| 1521 | 1521 |
| 1522 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.GetBuck
etStats(2048); | 1522 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.GetBuck
etStats(2048); |
| 1523 EXPECT_TRUE(stats); | 1523 EXPECT_TRUE(stats); |
| 1524 EXPECT_TRUE(stats->isValid); | 1524 EXPECT_TRUE(stats->isValid); |
| 1525 EXPECT_EQ(kSystemPageSize, stats->freeableBytes); | 1525 EXPECT_EQ(kSystemPageSize, stats->decommittableBytes); |
| 1526 EXPECT_EQ(kSystemPageSize, stats->residentBytes); | 1526 EXPECT_EQ(kSystemPageSize, stats->residentBytes); |
| 1527 } | 1527 } |
| 1528 partitionPurgeMemoryGeneric(genericAllocator.root()); | 1528 partitionPurgeMemoryGeneric(genericAllocator.root(), PartitionPurgeDecommitE
mptyPages); |
| 1529 { | 1529 { |
| 1530 MockPartitionStatsDumper mockStatsDumperGeneric; | 1530 MockPartitionStatsDumper mockStatsDumperGeneric; |
| 1531 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_allocat
or", &mockStatsDumperGeneric); | 1531 partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_allocat
or", &mockStatsDumperGeneric); |
| 1532 EXPECT_FALSE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); | 1532 EXPECT_FALSE(mockStatsDumperGeneric.IsMemoryAllocationRecorded()); |
| 1533 | 1533 |
| 1534 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.GetBuck
etStats(2048); | 1534 const PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.GetBuck
etStats(2048); |
| 1535 EXPECT_TRUE(stats); | 1535 EXPECT_TRUE(stats); |
| 1536 EXPECT_TRUE(stats->isValid); | 1536 EXPECT_TRUE(stats->isValid); |
| 1537 EXPECT_EQ(0u, stats->freeableBytes); | 1537 EXPECT_EQ(0u, stats->decommittableBytes); |
| 1538 EXPECT_EQ(0u, stats->residentBytes); | 1538 EXPECT_EQ(0u, stats->residentBytes); |
| 1539 } | 1539 } |
| 1540 // Calling purge again here is a good way of testing we didn't mess up the | 1540 // Calling purge again here is a good way of testing we didn't mess up the |
| 1541 // state of the free cache ring. | 1541 // state of the free cache ring. |
| 1542 partitionPurgeMemoryGeneric(genericAllocator.root()); | 1542 partitionPurgeMemoryGeneric(genericAllocator.root(), PartitionPurgeDecommitE
mptyPages); |
| 1543 TestShutdown(); | 1543 TestShutdown(); |
| 1544 } | 1544 } |
| 1545 | 1545 |
| 1546 // Tests that the countLeadingZeros() functions work to our satisfaction. | 1546 // Tests that the countLeadingZeros() functions work to our satisfaction. |
| 1547 // It doesn't seem worth the overhead of a whole new file for these tests, so | 1547 // It doesn't seem worth the overhead of a whole new file for these tests, so |
| 1548 // we'll put them here since partitionAllocGeneric will depend heavily on these | 1548 // we'll put them here since partitionAllocGeneric will depend heavily on these |
| 1549 // functions working correctly. | 1549 // functions working correctly. |
| 1550 TEST(PartitionAllocTest, CLZWorks) | 1550 TEST(PartitionAllocTest, CLZWorks) |
| 1551 { | 1551 { |
| 1552 EXPECT_EQ(32u, countLeadingZeros32(0u)); | 1552 EXPECT_EQ(32u, countLeadingZeros32(0u)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1564 EXPECT_EQ(32u, countLeadingZerosSizet(0u)); | 1564 EXPECT_EQ(32u, countLeadingZerosSizet(0u)); |
| 1565 EXPECT_EQ(31u, countLeadingZerosSizet(1u)); | 1565 EXPECT_EQ(31u, countLeadingZerosSizet(1u)); |
| 1566 EXPECT_EQ(1u, countLeadingZerosSizet(1u << 30)); | 1566 EXPECT_EQ(1u, countLeadingZerosSizet(1u << 30)); |
| 1567 EXPECT_EQ(0u, countLeadingZerosSizet(1u << 31)); | 1567 EXPECT_EQ(0u, countLeadingZerosSizet(1u << 31)); |
| 1568 #endif | 1568 #endif |
| 1569 } | 1569 } |
| 1570 | 1570 |
| 1571 } // namespace WTF | 1571 } // namespace WTF |
| 1572 | 1572 |
| 1573 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 1573 #endif // !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
| OLD | NEW |