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

Side by Side Diff: test/cctest/test-heap.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 | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | 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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 Handle<Map> my_map = factory->CopyMap(object_map, 1); 977 Handle<Map> my_map = factory->CopyMap(object_map, 1);
978 int n_properties = my_map->inobject_properties(); 978 int n_properties = my_map->inobject_properties();
979 CHECK_GT(n_properties, 0); 979 CHECK_GT(n_properties, 0);
980 980
981 int object_size = my_map->instance_size(); 981 int object_size = my_map->instance_size();
982 982
983 // Step 2: allocate a lot of objects so to almost fill new space: we need 983 // Step 2: allocate a lot of objects so to almost fill new space: we need
984 // just enough room to allocate JSObject and thus fill the newspace. 984 // just enough room to allocate JSObject and thus fill the newspace.
985 985
986 int allocation_amount = Min(FixedArray::kMaxSize, 986 int allocation_amount = Min(FixedArray::kMaxSize,
987 HEAP->MaxObjectSizeInNewSpace()); 987 Page::kMaxNonCodeHeapObjectSize);
988 int allocation_len = LenFromSize(allocation_amount); 988 int allocation_len = LenFromSize(allocation_amount);
989 NewSpace* new_space = HEAP->new_space(); 989 NewSpace* new_space = HEAP->new_space();
990 Address* top_addr = new_space->allocation_top_address(); 990 Address* top_addr = new_space->allocation_top_address();
991 Address* limit_addr = new_space->allocation_limit_address(); 991 Address* limit_addr = new_space->allocation_limit_address();
992 while ((*limit_addr - *top_addr) > allocation_amount) { 992 while ((*limit_addr - *top_addr) > allocation_amount) {
993 CHECK(!HEAP->always_allocate()); 993 CHECK(!HEAP->always_allocate());
994 Object* array = HEAP->AllocateFixedArray(allocation_len)->ToObjectChecked(); 994 Object* array = HEAP->AllocateFixedArray(allocation_len)->ToObjectChecked();
995 CHECK(!array->IsFailure()); 995 CHECK(!array->IsFailure());
996 CHECK(new_space->Contains(array)); 996 CHECK(new_space->Contains(array));
997 } 997 }
(...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3348 " var a = new Array(n);" 3348 " var a = new Array(n);"
3349 " for (var i = 0; i < n; i += 100) a[i] = i;" 3349 " for (var i = 0; i < n; i += 100) a[i] = i;"
3350 "};" 3350 "};"
3351 "f(10 * 1024 * 1024);"); 3351 "f(10 * 1024 * 1024);");
3352 IncrementalMarking* marking = HEAP->incremental_marking(); 3352 IncrementalMarking* marking = HEAP->incremental_marking();
3353 if (marking->IsStopped()) marking->Start(); 3353 if (marking->IsStopped()) marking->Start();
3354 // This big step should be sufficient to mark the whole array. 3354 // This big step should be sufficient to mark the whole array.
3355 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); 3355 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
3356 ASSERT(marking->IsComplete()); 3356 ASSERT(marking->IsComplete());
3357 } 3357 }
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698