зеркало из https://github.com/mozilla/gecko-dev.git
merge mozilla-central to mozilla-inbound. r=merge a=merge
This commit is contained in:
Коммит
c888605891
|
@ -18,4 +18,27 @@ struct Log2 : mozilla::tl::CeilingLog2<N>
|
|||
};
|
||||
#define LOG2(N) Log2<N>::value
|
||||
|
||||
// Compare two addresses. Returns whether the first address is smaller (-1),
|
||||
// equal (0) or greater (1) than the second address.
|
||||
template<typename T>
|
||||
int
|
||||
CompareAddr(T* aAddr1, T* aAddr2)
|
||||
{
|
||||
uintptr_t addr1 = reinterpret_cast<uintptr_t>(aAddr1);
|
||||
uintptr_t addr2 = reinterpret_cast<uintptr_t>(aAddr2);
|
||||
|
||||
return (addr1 > addr2) - (addr1 < addr2);
|
||||
}
|
||||
|
||||
// User-defined literals to make constants more legible
|
||||
constexpr unsigned long long int operator"" _KiB(unsigned long long int aNum)
|
||||
{
|
||||
return aNum * 1024;
|
||||
}
|
||||
|
||||
constexpr unsigned long long int operator"" _MiB(unsigned long long int aNum)
|
||||
{
|
||||
return aNum * 1024_KiB;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -8,6 +8,7 @@
|
|||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/Vector.h"
|
||||
#include "mozmemory.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
@ -35,9 +36,6 @@ TestThree(size_t size)
|
|||
ASSERT_NO_FATAL_FAILURE(TestOne(size + 1));
|
||||
}
|
||||
|
||||
#define K * 1024
|
||||
#define M * 1024 * 1024
|
||||
|
||||
TEST(Jemalloc, UsableSizeInAdvance)
|
||||
{
|
||||
/*
|
||||
|
@ -45,13 +43,13 @@ TEST(Jemalloc, UsableSizeInAdvance)
|
|||
* various sizes beyond that.
|
||||
*/
|
||||
|
||||
for (size_t n = 0; n < 16 K; n++)
|
||||
for (size_t n = 0; n < 16_KiB; n++)
|
||||
ASSERT_NO_FATAL_FAILURE(TestOne(n));
|
||||
|
||||
for (size_t n = 16 K; n < 1 M; n += 4 K)
|
||||
for (size_t n = 16_KiB; n < 1_MiB; n += 4_KiB)
|
||||
ASSERT_NO_FATAL_FAILURE(TestThree(n));
|
||||
|
||||
for (size_t n = 1 M; n < 8 M; n += 128 K)
|
||||
for (size_t n = 1_MiB; n < 8_MiB; n += 128_KiB)
|
||||
ASSERT_NO_FATAL_FAILURE(TestThree(n));
|
||||
}
|
||||
|
||||
|
@ -99,7 +97,7 @@ TEST(Jemalloc, PtrInfo)
|
|||
}
|
||||
|
||||
// Similar for large (2KiB + 1 KiB .. 1MiB - 8KiB) allocations.
|
||||
for (size_t n = small_max + 1 K; n <= stats.large_max; n += 1 K) {
|
||||
for (size_t n = small_max + 1_KiB; n <= stats.large_max; n += 1_KiB) {
|
||||
auto p = (char*)malloc(n);
|
||||
size_t usable = moz_malloc_size_of(p);
|
||||
ASSERT_TRUE(large.append(p));
|
||||
|
@ -110,7 +108,7 @@ TEST(Jemalloc, PtrInfo)
|
|||
}
|
||||
|
||||
// Similar for huge (> 1MiB - 8KiB) allocations.
|
||||
for (size_t n = stats.chunksize; n <= 10 M; n += 512 K) {
|
||||
for (size_t n = stats.chunksize; n <= 10_MiB; n += 512_KiB) {
|
||||
auto p = (char*)malloc(n);
|
||||
size_t usable = moz_malloc_size_of(p);
|
||||
ASSERT_TRUE(huge.append(p));
|
||||
|
@ -225,6 +223,3 @@ TEST(Jemalloc, PtrInfo)
|
|||
|
||||
jemalloc_thread_local_arena(false);
|
||||
}
|
||||
|
||||
#undef K
|
||||
#undef M
|
||||
|
|
|
@ -9,3 +9,7 @@ UNIFIED_SOURCES += [
|
|||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul-gtest'
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../build',
|
||||
]
|
||||
|
|
|
@ -18,7 +18,7 @@ e.g. To enable `flex` and `flex-direction` css properties:
|
|||
./mach run -d -- --pref layout.flex.enabled --pref layout.flex-direction.enabled ...
|
||||
```
|
||||
|
||||
You can find all the available preferences at [resources/prefs.json](http://mxr.mozilla.org/servo/source/resources/prefs.json).
|
||||
You can find all the available preferences at [resources/prefs.json](https://dxr.mozilla.org/servo/source/resources/prefs.json).
|
||||
|
||||
# Debugging
|
||||
## Remote Debugging
|
||||
|
|
Загрузка…
Ссылка в новой задаче