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

Side by Side Diff: src/spaces.cc

Issue 9242008: Make from-space initially uncommitted for another 1Mbyte (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 11 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/spaces.h ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 #define SET_NAME(name) allocated_histogram_[name].set_name(#name); \ 1019 #define SET_NAME(name) allocated_histogram_[name].set_name(#name); \
1020 promoted_histogram_[name].set_name(#name); 1020 promoted_histogram_[name].set_name(#name);
1021 INSTANCE_TYPE_LIST(SET_NAME) 1021 INSTANCE_TYPE_LIST(SET_NAME)
1022 #undef SET_NAME 1022 #undef SET_NAME
1023 1023
1024 ASSERT(reserved_semispace_capacity == heap()->ReservedSemiSpaceSize()); 1024 ASSERT(reserved_semispace_capacity == heap()->ReservedSemiSpaceSize());
1025 ASSERT(static_cast<intptr_t>(chunk_size_) >= 1025 ASSERT(static_cast<intptr_t>(chunk_size_) >=
1026 2 * heap()->ReservedSemiSpaceSize()); 1026 2 * heap()->ReservedSemiSpaceSize());
1027 ASSERT(IsAddressAligned(chunk_base_, 2 * reserved_semispace_capacity, 0)); 1027 ASSERT(IsAddressAligned(chunk_base_, 2 * reserved_semispace_capacity, 0));
1028 1028
1029 if (!to_space_.SetUp(chunk_base_, 1029 to_space_.SetUp(chunk_base_,
1030 initial_semispace_capacity, 1030 initial_semispace_capacity,
1031 maximum_semispace_capacity)) { 1031 maximum_semispace_capacity);
1032 return false; 1032 from_space_.SetUp(chunk_base_ + reserved_semispace_capacity,
1033 } 1033 initial_semispace_capacity,
1034 if (!from_space_.SetUp(chunk_base_ + reserved_semispace_capacity, 1034 maximum_semispace_capacity);
1035 initial_semispace_capacity, 1035 if (!to_space_.Commit()) {
1036 maximum_semispace_capacity)) {
1037 return false; 1036 return false;
1038 } 1037 }
1039 1038
1040 start_ = chunk_base_; 1039 start_ = chunk_base_;
1041 address_mask_ = ~(2 * reserved_semispace_capacity - 1); 1040 address_mask_ = ~(2 * reserved_semispace_capacity - 1);
1042 object_mask_ = address_mask_ | kHeapObjectTagMask; 1041 object_mask_ = address_mask_ | kHeapObjectTagMask;
1043 object_expected_ = reinterpret_cast<uintptr_t>(start_) | kHeapObjectTag; 1042 object_expected_ = reinterpret_cast<uintptr_t>(start_) | kHeapObjectTag;
1044 1043
1045 ResetAllocationInfo(); 1044 ResetAllocationInfo();
1046 1045
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 ASSERT_EQ(from_space_.id(), kFromSpace); 1258 ASSERT_EQ(from_space_.id(), kFromSpace);
1260 ASSERT_EQ(to_space_.id(), kToSpace); 1259 ASSERT_EQ(to_space_.id(), kToSpace);
1261 from_space_.Verify(); 1260 from_space_.Verify();
1262 to_space_.Verify(); 1261 to_space_.Verify();
1263 } 1262 }
1264 #endif 1263 #endif
1265 1264
1266 // ----------------------------------------------------------------------------- 1265 // -----------------------------------------------------------------------------
1267 // SemiSpace implementation 1266 // SemiSpace implementation
1268 1267
1269 bool SemiSpace::SetUp(Address start, 1268 void SemiSpace::SetUp(Address start,
1270 int initial_capacity, 1269 int initial_capacity,
1271 int maximum_capacity) { 1270 int maximum_capacity) {
1272 // Creates a space in the young generation. The constructor does not 1271 // Creates a space in the young generation. The constructor does not
1273 // allocate memory from the OS. A SemiSpace is given a contiguous chunk of 1272 // allocate memory from the OS. A SemiSpace is given a contiguous chunk of
1274 // memory of size 'capacity' when set up, and does not grow or shrink 1273 // memory of size 'capacity' when set up, and does not grow or shrink
1275 // otherwise. In the mark-compact collector, the memory region of the from 1274 // otherwise. In the mark-compact collector, the memory region of the from
1276 // space is used as the marking stack. It requires contiguous memory 1275 // space is used as the marking stack. It requires contiguous memory
1277 // addresses. 1276 // addresses.
1278 ASSERT(maximum_capacity >= Page::kPageSize); 1277 ASSERT(maximum_capacity >= Page::kPageSize);
1279 initial_capacity_ = RoundDown(initial_capacity, Page::kPageSize); 1278 initial_capacity_ = RoundDown(initial_capacity, Page::kPageSize);
1280 capacity_ = initial_capacity; 1279 capacity_ = initial_capacity;
1281 maximum_capacity_ = RoundDown(maximum_capacity, Page::kPageSize); 1280 maximum_capacity_ = RoundDown(maximum_capacity, Page::kPageSize);
1282 committed_ = false; 1281 committed_ = false;
1283 start_ = start; 1282 start_ = start;
1284 address_mask_ = ~(maximum_capacity - 1); 1283 address_mask_ = ~(maximum_capacity - 1);
1285 object_mask_ = address_mask_ | kHeapObjectTagMask; 1284 object_mask_ = address_mask_ | kHeapObjectTagMask;
1286 object_expected_ = reinterpret_cast<uintptr_t>(start) | kHeapObjectTag; 1285 object_expected_ = reinterpret_cast<uintptr_t>(start) | kHeapObjectTag;
1287 age_mark_ = start_; 1286 age_mark_ = start_;
1288
1289 return Commit();
1290 } 1287 }
1291 1288
1292 1289
1293 void SemiSpace::TearDown() { 1290 void SemiSpace::TearDown() {
1294 start_ = NULL; 1291 start_ = NULL;
1295 capacity_ = 0; 1292 capacity_ = 0;
1296 } 1293 }
1297 1294
1298 1295
1299 bool SemiSpace::Commit() { 1296 bool SemiSpace::Commit() {
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 object->ShortPrint(); 2830 object->ShortPrint();
2834 PrintF("\n"); 2831 PrintF("\n");
2835 } 2832 }
2836 printf(" --------------------------------------\n"); 2833 printf(" --------------------------------------\n");
2837 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 2834 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
2838 } 2835 }
2839 2836
2840 #endif // DEBUG 2837 #endif // DEBUG
2841 2838
2842 } } // namespace v8::internal 2839 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698