Revision f230a1cf deps/v8/test/cctest/test-spaces.cc

View differences:

deps/v8/test/cctest/test-spaces.cc
72 72

  
73 73
  Page* p = Page::FromAddress(page_start);
74 74
  // Initialized Page has heap pointer, normally set by memory_allocator.
75
  p->heap_ = HEAP;
75
  p->heap_ = CcTest::heap();
76 76
  CHECK(p->address() == page_start);
77 77
  CHECK(p->is_valid());
78 78

  
......
207 207

  
208 208

  
209 209
TEST(MemoryChunk) {
210
  Isolate* isolate = Isolate::Current();
210
  Isolate* isolate = CcTest::i_isolate();
211 211
  isolate->InitializeLoggingAndCounters();
212 212
  Heap* heap = isolate->heap();
213 213
  CHECK(heap->ConfigureHeapDefault());
......
263 263

  
264 264

  
265 265
TEST(MemoryAllocator) {
266
  Isolate* isolate = Isolate::Current();
266
  Isolate* isolate = CcTest::i_isolate();
267 267
  isolate->InitializeLoggingAndCounters();
268 268
  Heap* heap = isolate->heap();
269 269
  CHECK(isolate->heap()->ConfigureHeapDefault());
......
312 312

  
313 313

  
314 314
TEST(NewSpace) {
315
  Isolate* isolate = Isolate::Current();
315
  Isolate* isolate = CcTest::i_isolate();
316 316
  isolate->InitializeLoggingAndCounters();
317 317
  Heap* heap = isolate->heap();
318 318
  CHECK(heap->ConfigureHeapDefault());
......
323 323

  
324 324
  NewSpace new_space(heap);
325 325

  
326
  CHECK(new_space.SetUp(HEAP->ReservedSemiSpaceSize(),
327
                        HEAP->ReservedSemiSpaceSize()));
326
  CHECK(new_space.SetUp(CcTest::heap()->ReservedSemiSpaceSize(),
327
                        CcTest::heap()->ReservedSemiSpaceSize()));
328 328
  CHECK(new_space.HasBeenSetUp());
329 329

  
330 330
  while (new_space.Available() >= Page::kMaxNonCodeHeapObjectSize) {
......
341 341

  
342 342

  
343 343
TEST(OldSpace) {
344
  Isolate* isolate = Isolate::Current();
344
  Isolate* isolate = CcTest::i_isolate();
345 345
  isolate->InitializeLoggingAndCounters();
346 346
  Heap* heap = isolate->heap();
347 347
  CHECK(heap->ConfigureHeapDefault());
......
372 372
TEST(LargeObjectSpace) {
373 373
  v8::V8::Initialize();
374 374

  
375
  LargeObjectSpace* lo = HEAP->lo_space();
375
  LargeObjectSpace* lo = CcTest::heap()->lo_space();
376 376
  CHECK(lo != NULL);
377 377

  
378 378
  int lo_size = Page::kPageSize;
......
400 400

  
401 401
  CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE)->IsFailure());
402 402
}
403

  
404

  
405
TEST(SizeOfFirstPageIsLargeEnough) {
406
  if (i::FLAG_always_opt) return;
407
  CcTest::InitializeVM();
408
  Isolate* isolate = CcTest::i_isolate();
409

  
410
  // Freshly initialized VM gets by with one page per space.
411
  for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) {
412
    CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages());
413
  }
414

  
415
  // Executing the empty script gets by with one page per space.
416
  HandleScope scope(isolate);
417
  CompileRun("/*empty*/");
418
  for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) {
419
    CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages());
420
  }
421

  
422
  // No large objects required to perform the above steps.
423
  CHECK(isolate->heap()->lo_space()->IsEmpty());
424
}

Also available in: Unified diff