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

Side by Side Diff: src/spaces.cc

Issue 164397: - Reduced the maximum capacity of a semi space from 8MB to 4MB.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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') | 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 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 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 #endif 956 #endif
957 957
958 958
959 void NewSpace::Flip() { 959 void NewSpace::Flip() {
960 SemiSpace tmp = from_space_; 960 SemiSpace tmp = from_space_;
961 from_space_ = to_space_; 961 from_space_ = to_space_;
962 to_space_ = tmp; 962 to_space_ = tmp;
963 } 963 }
964 964
965 965
966 bool NewSpace::Double() { 966 bool NewSpace::Grow() {
967 ASSERT(capacity_ <= maximum_capacity_ / 2); 967 ASSERT(capacity_ < maximum_capacity_);
968 // TODO(1240712): Failure to double the from space can result in 968 // TODO(1240712): Failure to double the from space can result in
969 // semispaces of different sizes. In the event of that failure, the 969 // semispaces of different sizes. In the event of that failure, the
970 // to space doubling should be rolled back before returning false. 970 // to space doubling should be rolled back before returning false.
971 if (!to_space_.Double() || !from_space_.Double()) return false; 971 if (!to_space_.Grow() || !from_space_.Grow()) return false;
972 capacity_ *= 2; 972 capacity_ = to_space_.Capacity() + from_space_.Capacity();
973 allocation_info_.limit = to_space_.high(); 973 allocation_info_.limit = to_space_.high();
974 ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); 974 ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_);
975 return true; 975 return true;
976 } 976 }
977 977
978 978
979 void NewSpace::ResetAllocationInfo() { 979 void NewSpace::ResetAllocationInfo() {
980 allocation_info_.top = to_space_.low(); 980 allocation_info_.top = to_space_.low();
981 allocation_info_.limit = to_space_.high(); 981 allocation_info_.limit = to_space_.high();
982 ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_); 982 ASSERT_SEMISPACE_ALLOCATION_INFO(allocation_info_, to_space_);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 return true; 1067 return true;
1068 } 1068 }
1069 1069
1070 1070
1071 void SemiSpace::TearDown() { 1071 void SemiSpace::TearDown() {
1072 start_ = NULL; 1072 start_ = NULL;
1073 capacity_ = 0; 1073 capacity_ = 0;
1074 } 1074 }
1075 1075
1076 1076
1077 bool SemiSpace::Double() { 1077 bool SemiSpace::Grow() {
1078 if (!MemoryAllocator::CommitBlock(high(), capacity_, executable())) { 1078 // Commit 50% extra space but only up to maximum capacity.
1079 int extra = capacity_/2;
Lasse Reichstein 2009/08/13 08:45:17 Just a thought: Would it be safer to round this up
1080 if (capacity_ + extra > maximum_capacity_) {
1081 extra = maximum_capacity_ - capacity_;
1082 }
1083 if (!MemoryAllocator::CommitBlock(high(), extra, executable())) {
1079 return false; 1084 return false;
1080 } 1085 }
1081 capacity_ *= 2; 1086 capacity_ += extra;
1082 return true; 1087 return true;
1083 } 1088 }
1084 1089
1085 1090
1086 #ifdef DEBUG 1091 #ifdef DEBUG
1087 void SemiSpace::Print() { } 1092 void SemiSpace::Print() { }
1088 1093
1089 1094
1090 void SemiSpace::Verify() { } 1095 void SemiSpace::Verify() { }
1091 #endif 1096 #endif
(...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after
2593 reinterpret_cast<Object**>(object->address() 2598 reinterpret_cast<Object**>(object->address()
2594 + Page::kObjectAreaSize), 2599 + Page::kObjectAreaSize),
2595 allocation_top); 2600 allocation_top);
2596 PrintF("\n"); 2601 PrintF("\n");
2597 } 2602 }
2598 } 2603 }
2599 } 2604 }
2600 #endif // DEBUG 2605 #endif // DEBUG
2601 2606
2602 } } // namespace v8::internal 2607 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698