| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 FLAG_gc_global = true; | 79 FLAG_gc_global = true; |
| 80 FLAG_always_compact = true; | 80 FLAG_always_compact = true; |
| 81 HEAP->ConfigureHeap(2*256*KB, 8*MB, 8*MB); | 81 HEAP->ConfigureHeap(2*256*KB, 8*MB, 8*MB); |
| 82 | 82 |
| 83 InitializeVM(); | 83 InitializeVM(); |
| 84 | 84 |
| 85 v8::HandleScope sc; | 85 v8::HandleScope sc; |
| 86 | 86 |
| 87 // Allocate a fixed array in the new space. | 87 // Allocate a fixed array in the new space. |
| 88 int array_size = | 88 int array_size = |
| 89 (HEAP->MaxObjectSizeInPagedSpace() - FixedArray::kHeaderSize) / | 89 (Page::kMaxNonCodeHeapObjectSize - FixedArray::kHeaderSize) / |
| 90 (kPointerSize * 4); | 90 (kPointerSize * 4); |
| 91 Object* obj = HEAP->AllocateFixedArray(array_size)->ToObjectChecked(); | 91 Object* obj = HEAP->AllocateFixedArray(array_size)->ToObjectChecked(); |
| 92 | 92 |
| 93 Handle<FixedArray> array(FixedArray::cast(obj)); | 93 Handle<FixedArray> array(FixedArray::cast(obj)); |
| 94 | 94 |
| 95 // Array should be in the new space. | 95 // Array should be in the new space. |
| 96 CHECK(HEAP->InSpace(*array, NEW_SPACE)); | 96 CHECK(HEAP->InSpace(*array, NEW_SPACE)); |
| 97 | 97 |
| 98 // Call the m-c collector, so array becomes an old object. | 98 // Call the m-c collector, so array becomes an old object. |
| 99 HEAP->CollectGarbage(OLD_POINTER_SPACE); | 99 HEAP->CollectGarbage(OLD_POINTER_SPACE); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 110 // the old space | 110 // the old space |
| 111 InitializeVM(); | 111 InitializeVM(); |
| 112 | 112 |
| 113 v8::HandleScope sc; | 113 v8::HandleScope sc; |
| 114 | 114 |
| 115 // Do a mark compact GC to shrink the heap. | 115 // Do a mark compact GC to shrink the heap. |
| 116 HEAP->CollectGarbage(OLD_POINTER_SPACE); | 116 HEAP->CollectGarbage(OLD_POINTER_SPACE); |
| 117 | 117 |
| 118 // Allocate a big Fixed array in the new space. | 118 // Allocate a big Fixed array in the new space. |
| 119 int max_size = | 119 int max_size = |
| 120 Min(HEAP->MaxObjectSizeInPagedSpace(), HEAP->MaxObjectSizeInNewSpace()); | 120 Min(Page::kMaxNonCodeHeapObjectSize, HEAP->MaxObjectSizeInNewSpace()); |
| 121 | 121 |
| 122 int length = (max_size - FixedArray::kHeaderSize) / (2*kPointerSize); | 122 int length = (max_size - FixedArray::kHeaderSize) / (2*kPointerSize); |
| 123 Object* obj = i::Isolate::Current()->heap()->AllocateFixedArray(length)-> | 123 Object* obj = i::Isolate::Current()->heap()->AllocateFixedArray(length)-> |
| 124 ToObjectChecked(); | 124 ToObjectChecked(); |
| 125 | 125 |
| 126 Handle<FixedArray> array(FixedArray::cast(obj)); | 126 Handle<FixedArray> array(FixedArray::cast(obj)); |
| 127 | 127 |
| 128 // Array still stays in the new space. | 128 // Array still stays in the new space. |
| 129 CHECK(HEAP->InSpace(*array, NEW_SPACE)); | 129 CHECK(HEAP->InSpace(*array, NEW_SPACE)); |
| 130 | 130 |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 Handle<Object> object = | 440 Handle<Object> object = |
| 441 global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); | 441 global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked()); |
| 442 | 442 |
| 443 TestRetainedObjectInfo info; | 443 TestRetainedObjectInfo info; |
| 444 global_handles->AddObjectGroup(NULL, 0, &info); | 444 global_handles->AddObjectGroup(NULL, 0, &info); |
| 445 ASSERT(info.has_been_disposed()); | 445 ASSERT(info.has_been_disposed()); |
| 446 | 446 |
| 447 global_handles->AddImplicitReferences( | 447 global_handles->AddImplicitReferences( |
| 448 Handle<HeapObject>::cast(object).location(), NULL, 0); | 448 Handle<HeapObject>::cast(object).location(), NULL, 0); |
| 449 } | 449 } |
| OLD | NEW |