| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 TEST(Promotion) { | 76 TEST(Promotion) { |
| 77 CcTest::InitializeVM(); | 77 CcTest::InitializeVM(); |
| 78 Heap* heap = CcTest::heap(); | 78 Heap* heap = CcTest::heap(); |
| 79 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB); | 79 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB); |
| 80 | 80 |
| 81 v8::HandleScope sc(CcTest::isolate()); | 81 v8::HandleScope sc(CcTest::isolate()); |
| 82 | 82 |
| 83 // Allocate a fixed array in the new space. | 83 // Allocate a fixed array in the new space. |
| 84 int array_length = | 84 int array_length = |
| 85 (Page::kMaxNonCodeHeapObjectSize - FixedArray::kHeaderSize) / | 85 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / |
| 86 (4 * kPointerSize); | 86 (4 * kPointerSize); |
| 87 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); | 87 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); |
| 88 Handle<FixedArray> array(FixedArray::cast(obj)); | 88 Handle<FixedArray> array(FixedArray::cast(obj)); |
| 89 | 89 |
| 90 // Array should be in the new space. | 90 // Array should be in the new space. |
| 91 CHECK(heap->InSpace(*array, NEW_SPACE)); | 91 CHECK(heap->InSpace(*array, NEW_SPACE)); |
| 92 | 92 |
| 93 // Call mark compact GC, so array becomes an old object. | 93 // Call mark compact GC, so array becomes an old object. |
| 94 heap->CollectGarbage(OLD_POINTER_SPACE); | 94 heap->CollectGarbage(OLD_POINTER_SPACE); |
| 95 | 95 |
| 96 // Array now sits in the old space | 96 // Array now sits in the old space |
| 97 CHECK(heap->InSpace(*array, OLD_POINTER_SPACE)); | 97 CHECK(heap->InSpace(*array, OLD_POINTER_SPACE)); |
| 98 } | 98 } |
| 99 | 99 |
| 100 | 100 |
| 101 TEST(NoPromotion) { | 101 TEST(NoPromotion) { |
| 102 CcTest::InitializeVM(); | 102 CcTest::InitializeVM(); |
| 103 Heap* heap = CcTest::heap(); | 103 Heap* heap = CcTest::heap(); |
| 104 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB); | 104 heap->ConfigureHeap(2*256*KB, 1*MB, 1*MB); |
| 105 | 105 |
| 106 v8::HandleScope sc(CcTest::isolate()); | 106 v8::HandleScope sc(CcTest::isolate()); |
| 107 | 107 |
| 108 // Allocate a big fixed array in the new space. | 108 // Allocate a big fixed array in the new space. |
| 109 int array_length = | 109 int array_length = |
| 110 (Page::kMaxNonCodeHeapObjectSize - FixedArray::kHeaderSize) / | 110 (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / |
| 111 (2 * kPointerSize); | 111 (2 * kPointerSize); |
| 112 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); | 112 Object* obj = heap->AllocateFixedArray(array_length)->ToObjectChecked(); |
| 113 Handle<FixedArray> array(FixedArray::cast(obj)); | 113 Handle<FixedArray> array(FixedArray::cast(obj)); |
| 114 | 114 |
| 115 // Array should be in the new space. | 115 // Array should be in the new space. |
| 116 CHECK(heap->InSpace(*array, NEW_SPACE)); | 116 CHECK(heap->InSpace(*array, NEW_SPACE)); |
| 117 | 117 |
| 118 // Simulate a full old space to make promotion fail. | 118 // Simulate a full old space to make promotion fail. |
| 119 SimulateFullSpace(heap->old_pointer_space()); | 119 SimulateFullSpace(heap->old_pointer_space()); |
| 120 | 120 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 } | 489 } |
| 490 close(fd); | 490 close(fd); |
| 491 return memory_use; | 491 return memory_use; |
| 492 } | 492 } |
| 493 | 493 |
| 494 | 494 |
| 495 TEST(BootUpMemoryUse) { | 495 TEST(BootUpMemoryUse) { |
| 496 intptr_t initial_memory = MemoryInUse(); | 496 intptr_t initial_memory = MemoryInUse(); |
| 497 // Avoid flakiness. | 497 // Avoid flakiness. |
| 498 FLAG_crankshaft = false; | 498 FLAG_crankshaft = false; |
| 499 FLAG_concurrent_osr = false; |
| 499 FLAG_concurrent_recompilation = false; | 500 FLAG_concurrent_recompilation = false; |
| 500 | 501 |
| 501 // Only Linux has the proc filesystem and only if it is mapped. If it's not | 502 // Only Linux has the proc filesystem and only if it is mapped. If it's not |
| 502 // there we just skip the test. | 503 // there we just skip the test. |
| 503 if (initial_memory >= 0) { | 504 if (initial_memory >= 0) { |
| 504 CcTest::InitializeVM(); | 505 CcTest::InitializeVM(); |
| 505 intptr_t delta = MemoryInUse() - initial_memory; | 506 intptr_t delta = MemoryInUse() - initial_memory; |
| 506 printf("delta: %" V8_PTR_PREFIX "d kB\n", delta / 1024); | 507 printf("delta: %" V8_PTR_PREFIX "d kB\n", delta / 1024); |
| 507 if (sizeof(initial_memory) == 8) { // 64-bit. | 508 if (sizeof(initial_memory) == 8) { // 64-bit. |
| 508 if (v8::internal::Snapshot::IsEnabled()) { | 509 if (v8::internal::Snapshot::IsEnabled()) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 535 | 536 |
| 536 | 537 |
| 537 TEST(RegressJoinThreadsOnIsolateDeinit) { | 538 TEST(RegressJoinThreadsOnIsolateDeinit) { |
| 538 intptr_t size_limit = ShortLivingIsolate() * 2; | 539 intptr_t size_limit = ShortLivingIsolate() * 2; |
| 539 for (int i = 0; i < 10; i++) { | 540 for (int i = 0; i < 10; i++) { |
| 540 CHECK_GT(size_limit, ShortLivingIsolate()); | 541 CHECK_GT(size_limit, ShortLivingIsolate()); |
| 541 } | 542 } |
| 542 } | 543 } |
| 543 | 544 |
| 544 #endif // __linux__ and !USE_SIMULATOR | 545 #endif // __linux__ and !USE_SIMULATOR |
| OLD | NEW |