| 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 432 |
| 433 | 433 |
| 434 TEST(SizeOfFirstPageIsLargeEnough) { | 434 TEST(SizeOfFirstPageIsLargeEnough) { |
| 435 if (i::FLAG_always_opt) return; | 435 if (i::FLAG_always_opt) return; |
| 436 // Bootstrapping without a snapshot causes more allocations. | 436 // Bootstrapping without a snapshot causes more allocations. |
| 437 CcTest::InitializeVM(); | 437 CcTest::InitializeVM(); |
| 438 Isolate* isolate = CcTest::i_isolate(); | 438 Isolate* isolate = CcTest::i_isolate(); |
| 439 if (!isolate->snapshot_available()) return; | 439 if (!isolate->snapshot_available()) return; |
| 440 if (Snapshot::EmbedsScript(isolate)) return; | 440 if (Snapshot::EmbedsScript(isolate)) return; |
| 441 | 441 |
| 442 // If this test fails due to enabling experimental natives that are not part |
| 443 // of the snapshot, we may need to adjust CalculateFirstPageSizes. |
| 444 |
| 442 // Freshly initialized VM gets by with one page per space. | 445 // Freshly initialized VM gets by with one page per space. |
| 443 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { | 446 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { |
| 444 // 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. |
| 445 if (i == CODE_SPACE && i::FLAG_debug_code) continue; | 448 if (i == CODE_SPACE && i::FLAG_debug_code) continue; |
| 446 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); | 449 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); |
| 447 } | 450 } |
| 448 | 451 |
| 449 // Executing the empty script gets by with one page per space. | 452 // Executing the empty script gets by with one page per space. |
| 450 HandleScope scope(isolate); | 453 HandleScope scope(isolate); |
| 451 CompileRun("/*empty*/"); | 454 CompileRun("/*empty*/"); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 497 |
| 495 // Turn the allocation into a proper object so isolate teardown won't | 498 // Turn the allocation into a proper object so isolate teardown won't |
| 496 // crash. | 499 // crash. |
| 497 HeapObject* free_space = NULL; | 500 HeapObject* free_space = NULL; |
| 498 CHECK(allocation.To(&free_space)); | 501 CHECK(allocation.To(&free_space)); |
| 499 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80); | 502 new_space->heap()->CreateFillerObjectAt(free_space->address(), 80); |
| 500 } | 503 } |
| 501 } | 504 } |
| 502 isolate->Dispose(); | 505 isolate->Dispose(); |
| 503 } | 506 } |
| OLD | NEW |