Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: test/cctest/test-mark-compact.cc

Issue 19934006: Simplified large object allocation strategy. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // Test the situation that some objects in new space are promoted to 112 // Test the situation that some objects in new space are promoted to
113 // the old space 113 // the old space
114 CcTest::InitializeVM(); 114 CcTest::InitializeVM();
115 115
116 v8::HandleScope sc(CcTest::isolate()); 116 v8::HandleScope sc(CcTest::isolate());
117 117
118 // Do a mark compact GC to shrink the heap. 118 // Do a mark compact GC to shrink the heap.
119 HEAP->CollectGarbage(OLD_POINTER_SPACE); 119 HEAP->CollectGarbage(OLD_POINTER_SPACE);
120 120
121 // Allocate a big Fixed array in the new space. 121 // Allocate a big Fixed array in the new space.
122 int max_size = 122 int length = (Page::kMaxNonCodeHeapObjectSize -
123 Min(Page::kMaxNonCodeHeapObjectSize, HEAP->MaxObjectSizeInNewSpace()); 123 FixedArray::kHeaderSize) / (2 * kPointerSize);
124
125 int length = (max_size - FixedArray::kHeaderSize) / (2*kPointerSize);
126 Object* obj = i::Isolate::Current()->heap()->AllocateFixedArray(length)-> 124 Object* obj = i::Isolate::Current()->heap()->AllocateFixedArray(length)->
127 ToObjectChecked(); 125 ToObjectChecked();
128 126
129 Handle<FixedArray> array(FixedArray::cast(obj)); 127 Handle<FixedArray> array(FixedArray::cast(obj));
130 128
131 // Array still stays in the new space. 129 // Array still stays in the new space.
132 CHECK(HEAP->InSpace(*array, NEW_SPACE)); 130 CHECK(HEAP->InSpace(*array, NEW_SPACE));
133 131
134 // Allocate objects in the old space until out of memory. 132 // Allocate objects in the old space until out of memory.
135 FixedArray* host = *array; 133 FixedArray* host = *array;
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 580
583 581
584 TEST(RegressJoinThreadsOnIsolateDeinit) { 582 TEST(RegressJoinThreadsOnIsolateDeinit) {
585 intptr_t size_limit = ShortLivingIsolate() * 2; 583 intptr_t size_limit = ShortLivingIsolate() * 2;
586 for (int i = 0; i < 10; i++) { 584 for (int i = 0; i < 10; i++) {
587 CHECK_GT(size_limit, ShortLivingIsolate()); 585 CHECK_GT(size_limit, ShortLivingIsolate());
588 } 586 }
589 } 587 }
590 588
591 #endif // __linux__ and !USE_SIMULATOR 589 #endif // __linux__ and !USE_SIMULATOR
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698