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/objects.cc

Issue 11013012: Off-by-one error in zapping objects after right trimming. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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 | « no previous file | 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 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 return heap->the_hole_value(); 2169 return heap->the_hole_value();
2170 } 2170 }
2171 2171
2172 2172
2173 enum RightTrimMode { FROM_GC, FROM_MUTATOR }; 2173 enum RightTrimMode { FROM_GC, FROM_MUTATOR };
2174 2174
2175 2175
2176 static void ZapEndOfFixedArray(Address new_end, int to_trim) { 2176 static void ZapEndOfFixedArray(Address new_end, int to_trim) {
2177 // If we are doing a big trim in old space then we zap the space. 2177 // If we are doing a big trim in old space then we zap the space.
2178 Object** zap = reinterpret_cast<Object**>(new_end); 2178 Object** zap = reinterpret_cast<Object**>(new_end);
2179 zap++; // Header of filler must be at least one word so skip that.
2179 for (int i = 1; i < to_trim; i++) { 2180 for (int i = 1; i < to_trim; i++) {
2180 *zap++ = Smi::FromInt(0); 2181 *zap++ = Smi::FromInt(0);
2181 } 2182 }
2182 } 2183 }
2183 2184
2185
2184 template<RightTrimMode trim_mode> 2186 template<RightTrimMode trim_mode>
2185 static void RightTrimFixedArray(Heap* heap, FixedArray* elms, int to_trim) { 2187 static void RightTrimFixedArray(Heap* heap, FixedArray* elms, int to_trim) {
2186 ASSERT(elms->map() != HEAP->fixed_cow_array_map()); 2188 ASSERT(elms->map() != HEAP->fixed_cow_array_map());
2187 // For now this trick is only applied to fixed arrays in new and paged space. 2189 // For now this trick is only applied to fixed arrays in new and paged space.
2188 ASSERT(!HEAP->lo_space()->Contains(elms)); 2190 ASSERT(!HEAP->lo_space()->Contains(elms));
2189 2191
2190 const int len = elms->length(); 2192 const int len = elms->length();
2191 2193
2192 ASSERT(to_trim < len); 2194 ASSERT(to_trim < len);
2193 2195
(...skipping 11354 matching lines...) Expand 10 before | Expand all | Expand 10 after
13548 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13550 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13549 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13551 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13550 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13552 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13551 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13553 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13552 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13554 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13553 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13555 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13554 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13556 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13555 } 13557 }
13556 13558
13557 } } // namespace v8::internal 13559 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698