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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 FLAG_gc_global = true; | 87 FLAG_gc_global = true; |
88 FLAG_always_compact = true; | 88 FLAG_always_compact = true; |
89 HEAP->ConfigureHeap(2*256*KB, 8*MB, 8*MB); | 89 HEAP->ConfigureHeap(2*256*KB, 8*MB, 8*MB); |
90 | 90 |
91 InitializeVM(); | 91 InitializeVM(); |
92 | 92 |
93 v8::HandleScope sc; | 93 v8::HandleScope sc; |
94 | 94 |
95 // Allocate a fixed array in the new space. | 95 // Allocate a fixed array in the new space. |
96 int array_size = | 96 int array_size = |
97 (HEAP->MaxObjectSizeInPagedSpace() - FixedArray::kHeaderSize) / | 97 (Page::kMaxNonCodeHeapObjectSize - FixedArray::kHeaderSize) / |
98 (kPointerSize * 4); | 98 (kPointerSize * 4); |
99 Object* obj = HEAP->AllocateFixedArray(array_size)->ToObjectChecked(); | 99 Object* obj = HEAP->AllocateFixedArray(array_size)->ToObjectChecked(); |
100 | 100 |
101 Handle<FixedArray> array(FixedArray::cast(obj)); | 101 Handle<FixedArray> array(FixedArray::cast(obj)); |
102 | 102 |
103 // Array should be in the new space. | 103 // Array should be in the new space. |
104 CHECK(HEAP->InSpace(*array, NEW_SPACE)); | 104 CHECK(HEAP->InSpace(*array, NEW_SPACE)); |
105 | 105 |
106 // Call the m-c collector, so array becomes an old object. | 106 // Call the m-c collector, so array becomes an old object. |
107 HEAP->CollectGarbage(OLD_POINTER_SPACE); | 107 HEAP->CollectGarbage(OLD_POINTER_SPACE); |
(...skipping 10 matching lines...) Expand all Loading... |
118 // the old space | 118 // the old space |
119 InitializeVM(); | 119 InitializeVM(); |
120 | 120 |
121 v8::HandleScope sc; | 121 v8::HandleScope sc; |
122 | 122 |
123 // Do a mark compact GC to shrink the heap. | 123 // Do a mark compact GC to shrink the heap. |
124 HEAP->CollectGarbage(OLD_POINTER_SPACE); | 124 HEAP->CollectGarbage(OLD_POINTER_SPACE); |
125 | 125 |
126 // Allocate a big Fixed array in the new space. | 126 // Allocate a big Fixed array in the new space. |
127 int max_size = | 127 int max_size = |
128 Min(HEAP->MaxObjectSizeInPagedSpace(), HEAP->MaxObjectSizeInNewSpace()); | 128 Min(Page::kMaxNonCodeHeapObjectSize, HEAP->MaxObjectSizeInNewSpace()); |
129 | 129 |
130 int length = (max_size - FixedArray::kHeaderSize) / (2*kPointerSize); | 130 int length = (max_size - FixedArray::kHeaderSize) / (2*kPointerSize); |
131 Object* obj = i::Isolate::Current()->heap()->AllocateFixedArray(length)-> | 131 Object* obj = i::Isolate::Current()->heap()->AllocateFixedArray(length)-> |
132 ToObjectChecked(); | 132 ToObjectChecked(); |
133 | 133 |
134 Handle<FixedArray> array(FixedArray::cast(obj)); | 134 Handle<FixedArray> array(FixedArray::cast(obj)); |
135 | 135 |
136 // Array still stays in the new space. | 136 // Array still stays in the new space. |
137 CHECK(HEAP->InSpace(*array, NEW_SPACE)); | 137 CHECK(HEAP->InSpace(*array, NEW_SPACE)); |
138 | 138 |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 if (v8::internal::Snapshot::IsEnabled()) { | 542 if (v8::internal::Snapshot::IsEnabled()) { |
543 CHECK_LE(booted_memory - initial_memory, 6532 * 1024); // 6388. | 543 CHECK_LE(booted_memory - initial_memory, 6532 * 1024); // 6388. |
544 } else { | 544 } else { |
545 CHECK_LE(booted_memory - initial_memory, 6686 * 1024); // 6456 | 545 CHECK_LE(booted_memory - initial_memory, 6686 * 1024); // 6456 |
546 } | 546 } |
547 } | 547 } |
548 } | 548 } |
549 } | 549 } |
550 | 550 |
551 #endif // __linux__ and !USE_SIMULATOR | 551 #endif // __linux__ and !USE_SIMULATOR |
OLD | NEW |