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

Side by Side Diff: src/heap/heap.cc

Issue 487703002: Do not install fillers when right trimming large objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « no previous file | test/mjsunit/regress/regress-404981.js » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/once.h" 9 #include "src/base/once.h"
10 #include "src/base/utils/random-number-generator.h" 10 #include "src/base/utils/random-number-generator.h"
(...skipping 3303 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 template 3314 template
3315 void Heap::RightTrimFixedArray<Heap::FROM_MUTATOR>(FixedArrayBase*, int); 3315 void Heap::RightTrimFixedArray<Heap::FROM_MUTATOR>(FixedArrayBase*, int);
3316 3316
3317 3317
3318 template<Heap::InvocationMode mode> 3318 template<Heap::InvocationMode mode>
3319 void Heap::RightTrimFixedArray(FixedArrayBase* object, int elements_to_trim) { 3319 void Heap::RightTrimFixedArray(FixedArrayBase* object, int elements_to_trim) {
3320 const int element_size = object->IsFixedArray() ? kPointerSize : kDoubleSize; 3320 const int element_size = object->IsFixedArray() ? kPointerSize : kDoubleSize;
3321 const int bytes_to_trim = elements_to_trim * element_size; 3321 const int bytes_to_trim = elements_to_trim * element_size;
3322 3322
3323 // For now this trick is only applied to objects in new and paged space. 3323 // For now this trick is only applied to objects in new and paged space.
3324 DCHECK(!lo_space()->Contains(object));
3325 DCHECK(object->map() != fixed_cow_array_map()); 3324 DCHECK(object->map() != fixed_cow_array_map());
3326 3325
3327 const int len = object->length(); 3326 const int len = object->length();
3328 DCHECK(elements_to_trim < len); 3327 DCHECK(elements_to_trim < len);
3329 3328
3330 // Calculate location of new array end. 3329 // Calculate location of new array end.
3331 Address new_end = object->address() + object->Size() - bytes_to_trim; 3330 Address new_end = object->address() + object->Size() - bytes_to_trim;
3332 3331
3333 // Technically in new space this write might be omitted (except for 3332 // Technically in new space this write might be omitted (except for
3334 // debug mode which iterates through the heap), but to play safer 3333 // debug mode which iterates through the heap), but to play safer
3335 // we still do it. 3334 // we still do it.
3336 CreateFillerObjectAt(new_end, bytes_to_trim); 3335 // We do not create a filler for objects in large object space.
3336 // TODO(hpayer): We should shrink the large object page if the size
3337 // of the object changed significantly.
3338 if (!lo_space()->Contains(object)) {
3339 CreateFillerObjectAt(new_end, bytes_to_trim);
3340 }
3337 3341
3338 // Initialize header of the trimmed array. We are storing the new length 3342 // Initialize header of the trimmed array. We are storing the new length
3339 // using release store after creating a filler for the left-over space to 3343 // using release store after creating a filler for the left-over space to
3340 // avoid races with the sweeper thread. 3344 // avoid races with the sweeper thread.
3341 object->synchronized_set_length(len - elements_to_trim); 3345 object->synchronized_set_length(len - elements_to_trim);
3342 3346
3343 // Maintain consistency of live bytes during incremental marking 3347 // Maintain consistency of live bytes during incremental marking
3344 AdjustLiveBytes(object->address(), -bytes_to_trim, mode); 3348 AdjustLiveBytes(object->address(), -bytes_to_trim, mode);
3345 3349
3346 // Notify the heap profiler of change in object layout. The array may not be 3350 // Notify the heap profiler of change in object layout. The array may not be
(...skipping 2796 matching lines...) Expand 10 before | Expand all | Expand 10 after
6143 static_cast<int>(object_sizes_last_time_[index])); 6147 static_cast<int>(object_sizes_last_time_[index]));
6144 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6148 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6145 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6149 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6146 6150
6147 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6151 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6148 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6152 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6149 ClearObjectStats(); 6153 ClearObjectStats();
6150 } 6154 }
6151 } 6155 }
6152 } // namespace v8::internal 6156 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-404981.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698