OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 | 430 |
431 CHECK(!lo->IsEmpty()); | 431 CHECK(!lo->IsEmpty()); |
432 | 432 |
433 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE).IsRetry()); | 433 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE).IsRetry()); |
434 } | 434 } |
435 | 435 |
436 | 436 |
437 TEST(SizeOfFirstPageIsLargeEnough) { | 437 TEST(SizeOfFirstPageIsLargeEnough) { |
438 if (i::FLAG_always_opt) return; | 438 if (i::FLAG_always_opt) return; |
439 // Bootstrapping without a snapshot causes more allocations. | 439 // Bootstrapping without a snapshot causes more allocations. |
440 if (!i::Snapshot::HaveASnapshotToStartFrom()) return; | |
441 CcTest::InitializeVM(); | 440 CcTest::InitializeVM(); |
442 Isolate* isolate = CcTest::i_isolate(); | 441 Isolate* isolate = CcTest::i_isolate(); |
| 442 if (!isolate->snapshot_available()) return; |
| 443 if (Snapshot::EmbedsScript(isolate)) return; |
443 | 444 |
444 // Freshly initialized VM gets by with one page per space. | 445 // Freshly initialized VM gets by with one page per space. |
445 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { | 446 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { |
446 // Debug code can be very large, so skip CODE_SPACE if we are generating it. | 447 // Debug code can be very large, so skip CODE_SPACE if we are generating it. |
447 if (i == CODE_SPACE && i::FLAG_debug_code) continue; | 448 if (i == CODE_SPACE && i::FLAG_debug_code) continue; |
448 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); | 449 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); |
449 } | 450 } |
450 | 451 |
451 // Executing the empty script gets by with one page per space. | 452 // Executing the empty script gets by with one page per space. |
452 HandleScope scope(isolate); | 453 HandleScope scope(isolate); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 | 494 |
494 // Turn the allocation into a proper object so isolate teardown won't | 495 // Turn the allocation into a proper object so isolate teardown won't |
495 // crash. | 496 // crash. |
496 HeapObject* free_space = NULL; | 497 HeapObject* free_space = NULL; |
497 CHECK(allocation.To(&free_space)); | 498 CHECK(allocation.To(&free_space)); |
498 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80); | 499 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80); |
499 } | 500 } |
500 } | 501 } |
501 isolate->Dispose(); | 502 isolate->Dispose(); |
502 } | 503 } |
OLD | NEW |