33 using namespace v8::internal;
36 static void VerifyRegionMarking(
Address page_start) {
37 #ifdef ENABLE_CARDMARKING_WRITE_BARRIER
40 p->SetRegionMarks(Page::kAllRegionsCleanMarks);
42 for (
Address addr = p->ObjectAreaStart();
43 addr < p->ObjectAreaEnd();
48 for (
Address addr = p->ObjectAreaStart();
49 addr < p->ObjectAreaEnd();
54 for (
Address addr = p->ObjectAreaStart();
55 addr < p->ObjectAreaEnd();
80 p->SetIsLargeObjectPage(
false);
94 VerifyRegionMarking(page_start);
109 old_allocator_(isolate->memory_allocator_) {
110 isolate->memory_allocator_ = allocator;
114 isolate_->memory_allocator_ = old_allocator_;
130 old_code_range_(isolate->code_range_) {
131 isolate->code_range_ = code_range;
135 isolate_->code_range_ = old_code_range_;
148 static void VerifyMemoryChunk(
Isolate* isolate,
151 size_t reserve_area_size,
152 size_t commit_area_size,
153 size_t second_commit_area_size,
161 size_t header_size = (executable ==
EXECUTABLE)
164 size_t guard_size = (executable ==
EXECUTABLE)
172 size_t alignment = code_range->
exists() ?
174 size_t reserved_size = ((executable ==
EXECUTABLE))
175 ?
RoundUp(header_size + guard_size + reserve_area_size + guard_size,
177 :
RoundUp(header_size + reserve_area_size,
OS::CommitPageSize());
178 CHECK(memory_chunk->
size() == reserved_size);
180 memory_chunk->
size());
182 memory_chunk->
size());
183 CHECK(static_cast<size_t>(memory_chunk->
area_size()) == commit_area_size);
187 memory_chunk->
CommitArea(second_commit_area_size);
190 memory_chunk->
size());
192 memory_chunk->
size());
194 second_commit_area_size);
196 memory_allocator->
Free(memory_chunk);
198 delete memory_allocator;
203 static uint32_t
lo = 2345;
204 lo = 18273 * (lo & 0xFFFFF) + (lo >> 16);
215 size_t reserve_area_size = 1 *
MB;
216 size_t initial_commit_area_size, second_commit_area_size;
218 for (
int i = 0; i < 100; i++) {
224 const int code_range_size = 32 *
MB;
225 if (!code_range->
SetUp(code_range_size))
return;
227 VerifyMemoryChunk(isolate,
231 initial_commit_area_size,
232 second_commit_area_size,
235 VerifyMemoryChunk(isolate,
239 initial_commit_area_size,
240 second_commit_area_size,
246 VerifyMemoryChunk(isolate,
250 initial_commit_area_size,
251 second_commit_area_size,
254 VerifyMemoryChunk(isolate,
258 initial_commit_area_size,
259 second_commit_area_size,
280 Page* first_page = memory_allocator->AllocatePage(
283 first_page->
InsertAfter(faked_space.anchor()->prev_page());
284 CHECK(first_page->is_valid());
285 CHECK(first_page->next_page() == faked_space.anchor());
288 for (
Page* p = first_page; p != faked_space.anchor(); p = p->
next_page()) {
293 Page* other = memory_allocator->AllocatePage(
299 for (
Page* p = first_page; p != faked_space.anchor(); p = p->
next_page()) {
303 CHECK(total_pages == page_count);
307 memory_allocator->Free(first_page);
308 memory_allocator->Free(second_page);
309 memory_allocator->TearDown();
310 delete memory_allocator;
338 memory_allocator->TearDown();
339 delete memory_allocator;
368 delete memory_allocator;
381 CHECK(obj->IsHeapObject());
394 if (!maybe_obj->ToObject(&obj))
break;
405 TEST(SizeOfFirstPageIsLargeEnough) {
406 if (i::FLAG_always_opt)
return;
417 CompileRun(
"/*empty*/");
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if available(ARM only)") DEFINE_bool(enable_sudiv
#define CHECK_EQ(expected, value)
int ReservedSemiSpaceSize()
MUST_USE_RESULT MaybeObject * AllocateRaw(int size_in_bytes)
bool SetUp(const size_t requested_size)
bool CommitArea(size_t requested)
static MemoryChunk * FromAddress(Address a)
static HeapObject * cast(Object *obj)
bool SetUp(intptr_t max_capacity, intptr_t capacity_executable)
MemoryChunk * AllocateChunk(intptr_t reserve_area_size, intptr_t commit_area_size, Executability executable, Space *space)
Address OffsetToAddress(int offset)
static const int kPageSize
unsigned int Pseudorandom()
void Free(MemoryChunk *chunk)
~TestMemoryAllocatorScope()
intptr_t MaxOldGenerationSize()
bool ConfigureHeapDefault()
PagedSpace * paged_space(int idx)
TestMemoryAllocatorScope(Isolate *isolate, MemoryAllocator *allocator)
static int CodePageGuardSize()
static const int kMaxRegularHeapObjectSize
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
T RoundUp(T x, intptr_t m)
static i::Isolate * i_isolate()
LargeObjectSpace * lo_space()
MaybeObject * FindObject(Address a)
static const int kObjectStartOffset
TestCodeRangeScope(Isolate *isolate, CodeRange *code_range)
bool Contains(HeapObject *obj)
static void InitializeVM()
static const intptr_t kAlignment
void InitializeLoggingAndCounters()
void InsertAfter(MemoryChunk *other)
static int CodePageGuardStartOffset()
bool SetUp(int reserved_semispace_size_, int max_semispace_size)
void DeleteArray(T *array)
MUST_USE_RESULT MaybeObject * AllocateRaw(int object_size, Executability executable)
static intptr_t CommitPageSize()
intptr_t MaxExecutableSize()