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

Side by Side Diff: src/builtins.cc

Issue 203833005: Account for right object size when left trimming arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // we still do it. 261 // we still do it.
262 heap->CreateFillerObjectAt(elms->address(), to_trim * entry_size); 262 heap->CreateFillerObjectAt(elms->address(), to_trim * entry_size);
263 263
264 int new_start_index = to_trim * (entry_size / kPointerSize); 264 int new_start_index = to_trim * (entry_size / kPointerSize);
265 former_start[new_start_index] = map; 265 former_start[new_start_index] = map;
266 former_start[new_start_index + 1] = Smi::FromInt(len - to_trim); 266 former_start[new_start_index + 1] = Smi::FromInt(len - to_trim);
267 267
268 // Maintain marking consistency for HeapObjectIterator and 268 // Maintain marking consistency for HeapObjectIterator and
269 // IncrementalMarking. 269 // IncrementalMarking.
270 int size_delta = to_trim * entry_size; 270 int size_delta = to_trim * entry_size;
271 heap->marking()->TransferMark(elms->address(), elms->address() + size_delta); 271 Address new_start = elms->address() + size_delta;
272 heap->AdjustLiveBytes(elms->address(), -size_delta, Heap::FROM_MUTATOR); 272 heap->marking()->TransferMark(elms->address(), new_start);
273 heap->AdjustLiveBytes(new_start, -size_delta, Heap::FROM_MUTATOR);
273 274
274 FixedArrayBase* new_elms = FixedArrayBase::cast(HeapObject::FromAddress( 275 FixedArrayBase* new_elms =
275 elms->address() + size_delta)); 276 FixedArrayBase::cast(HeapObject::FromAddress(new_start));
276 HeapProfiler* profiler = heap->isolate()->heap_profiler(); 277 HeapProfiler* profiler = heap->isolate()->heap_profiler();
277 if (profiler->is_tracking_object_moves()) { 278 if (profiler->is_tracking_object_moves()) {
278 profiler->ObjectMoveEvent(elms->address(), 279 profiler->ObjectMoveEvent(elms->address(),
279 new_elms->address(), 280 new_elms->address(),
280 new_elms->Size()); 281 new_elms->Size());
281 } 282 }
282 return new_elms; 283 return new_elms;
283 } 284 }
284 285
285 286
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 } 1757 }
1757 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1758 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1758 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1759 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1759 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 1760 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
1760 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1761 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1761 #undef DEFINE_BUILTIN_ACCESSOR_C 1762 #undef DEFINE_BUILTIN_ACCESSOR_C
1762 #undef DEFINE_BUILTIN_ACCESSOR_A 1763 #undef DEFINE_BUILTIN_ACCESSOR_A
1763 1764
1764 1765
1765 } } // namespace v8::internal 1766 } } // 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