Lines 92-107
Link Here
|
92 |
#include "vm/Debugger.h" |
92 |
#include "vm/Debugger.h" |
93 |
#include "vm/String.h" |
93 |
#include "vm/String.h" |
94 |
|
94 |
|
95 |
#include "jsobjinlines.h" |
95 |
#include "jsobjinlines.h" |
96 |
|
96 |
|
97 |
#include "vm/CallObject-inl.h" |
97 |
#include "vm/CallObject-inl.h" |
98 |
#include "vm/String-inl.h" |
98 |
#include "vm/String-inl.h" |
99 |
|
99 |
|
|
|
100 |
#include "yarr/PageBlock.h" /* for pageSize() */ |
101 |
|
100 |
#ifdef MOZ_VALGRIND |
102 |
#ifdef MOZ_VALGRIND |
101 |
# define JS_VALGRIND |
103 |
# define JS_VALGRIND |
102 |
#endif |
104 |
#endif |
103 |
#ifdef JS_VALGRIND |
105 |
#ifdef JS_VALGRIND |
104 |
# include <valgrind/memcheck.h> |
106 |
# include <valgrind/memcheck.h> |
105 |
#endif |
107 |
#endif |
106 |
|
108 |
|
107 |
using namespace mozilla; |
109 |
using namespace mozilla; |
Lines 2380-2395
ReleaseObservedTypes(JSContext *cx)
Link Here
|
2380 |
} |
2382 |
} |
2381 |
|
2383 |
|
2382 |
return releaseTypes; |
2384 |
return releaseTypes; |
2383 |
} |
2385 |
} |
2384 |
|
2386 |
|
2385 |
static void |
2387 |
static void |
2386 |
DecommitFreePages(JSContext *cx) |
2388 |
DecommitFreePages(JSContext *cx) |
2387 |
{ |
2389 |
{ |
|
|
2390 |
/* |
2391 |
* If the ArenaSize is smaller than a memory page, we don't attempt to |
2392 |
* decommit anything because DecommitMemory() would always fail. |
2393 |
*/ |
2394 |
if (ArenaSize < pageSize()) |
2395 |
return; |
2396 |
|
2388 |
JSRuntime *rt = cx->runtime; |
2397 |
JSRuntime *rt = cx->runtime; |
2389 |
|
2398 |
|
2390 |
for (GCChunkSet::Range r(rt->gcChunkSet.all()); !r.empty(); r.popFront()) { |
2399 |
for (GCChunkSet::Range r(rt->gcChunkSet.all()); !r.empty(); r.popFront()) { |
2391 |
Chunk *chunk = r.front(); |
2400 |
Chunk *chunk = r.front(); |
2392 |
while (chunk) { |
2401 |
while (chunk) { |
2393 |
ArenaHeader *aheader = static_cast<ArenaHeader*>(chunk->info.freeArenasHead); |
2402 |
ArenaHeader *aheader = static_cast<ArenaHeader*>(chunk->info.freeArenasHead); |
2394 |
|
2403 |
|
2395 |
/* |
2404 |
/* |
Lines 2402-2425
DecommitFreePages(JSContext *cx)
Link Here
|
2402 |
while (aheader) { |
2411 |
while (aheader) { |
2403 |
/* Store aside everything we will need after decommit. */ |
2412 |
/* Store aside everything we will need after decommit. */ |
2404 |
ArenaHeader *next = aheader->next; |
2413 |
ArenaHeader *next = aheader->next; |
2405 |
|
2414 |
|
2406 |
bool success = DecommitMemory(aheader, ArenaSize); |
2415 |
bool success = DecommitMemory(aheader, ArenaSize); |
2407 |
if (!success) { |
2416 |
if (!success) { |
2408 |
aheader->next = chunk->info.freeArenasHead; |
2417 |
aheader->next = chunk->info.freeArenasHead; |
2409 |
chunk->info.freeArenasHead = aheader; |
2418 |
chunk->info.freeArenasHead = aheader; |
2410 |
continue; |
2419 |
} else { |
|
|
2420 |
size_t arenaOffset = Chunk::arenaIndex(reinterpret_cast<uintptr_t>(aheader)); |
2421 |
chunk->decommittedArenas.set(arenaOffset); |
2422 |
--chunk->info.numArenasFreeCommitted; |
2423 |
--rt->gcNumFreeArenas; |
2411 |
} |
2424 |
} |
2412 |
|
2425 |
|
2413 |
size_t arenaOffset = Chunk::arenaIndex(reinterpret_cast<uintptr_t>(aheader)); |
|
|
2414 |
chunk->decommittedArenas.set(arenaOffset); |
2415 |
--chunk->info.numArenasFreeCommitted; |
2416 |
--rt->gcNumFreeArenas; |
2417 |
|
2418 |
aheader = next; |
2426 |
aheader = next; |
2419 |
} |
2427 |
} |
2420 |
|
2428 |
|
2421 |
chunk = chunk->info.next; |
2429 |
chunk = chunk->info.next; |
2422 |
} |
2430 |
} |
2423 |
} |
2431 |
} |
2424 |
} |
2432 |
} |
2425 |
|
2433 |
|