| OLD | NEW |
| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 static void FillWithHoles(FixedDoubleArray* dst, int from, int to) { | 216 static void FillWithHoles(FixedDoubleArray* dst, int from, int to) { |
| 217 for (int i = from; i < to; i++) { | 217 for (int i = from; i < to; i++) { |
| 218 dst->set_the_hole(i); | 218 dst->set_the_hole(i); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 | 222 |
| 223 static FixedArrayBase* LeftTrimFixedArray(Heap* heap, | 223 static FixedArrayBase* LeftTrimFixedArray(Heap* heap, |
| 224 FixedArrayBase* elms, | 224 FixedArrayBase* elms, |
| 225 int to_trim) { | 225 int to_trim) { |
| 226 ASSERT(heap->CanMoveObjectStart(elms)); |
| 227 |
| 226 Map* map = elms->map(); | 228 Map* map = elms->map(); |
| 227 int entry_size; | 229 int entry_size; |
| 228 if (elms->IsFixedArray()) { | 230 if (elms->IsFixedArray()) { |
| 229 entry_size = kPointerSize; | 231 entry_size = kPointerSize; |
| 230 } else { | 232 } else { |
| 231 entry_size = kDoubleSize; | 233 entry_size = kDoubleSize; |
| 232 } | 234 } |
| 233 ASSERT(elms->map() != heap->fixed_cow_array_map()); | 235 ASSERT(elms->map() != heap->fixed_cow_array_map()); |
| 234 // For now this trick is only applied to fixed arrays in new and paged space. | 236 // For now this trick is only applied to fixed arrays in new and paged space. |
| 235 // In large object space the object's start must coincide with chunk | 237 // In large object space the object's start must coincide with chunk |
| (...skipping 16 matching lines...) Expand all Loading... |
| 252 // remembered set) won't find pointers to new-space there. | 254 // remembered set) won't find pointers to new-space there. |
| 253 Object** zap = reinterpret_cast<Object**>(elms->address()); | 255 Object** zap = reinterpret_cast<Object**>(elms->address()); |
| 254 zap++; // Header of filler must be at least one word so skip that. | 256 zap++; // Header of filler must be at least one word so skip that. |
| 255 for (int i = 1; i < to_trim; i++) { | 257 for (int i = 1; i < to_trim; i++) { |
| 256 *zap++ = Smi::FromInt(0); | 258 *zap++ = Smi::FromInt(0); |
| 257 } | 259 } |
| 258 } | 260 } |
| 259 // Technically in new space this write might be omitted (except for | 261 // Technically in new space this write might be omitted (except for |
| 260 // debug mode which iterates through the heap), but to play safer | 262 // debug mode which iterates through the heap), but to play safer |
| 261 // we still do it. | 263 // we still do it. |
| 264 // Since left trimming is only performed on pages which are not concurrently |
| 265 // swept creating a filler object does not require synchronization. |
| 262 heap->CreateFillerObjectAt(elms->address(), to_trim * entry_size); | 266 heap->CreateFillerObjectAt(elms->address(), to_trim * entry_size); |
| 263 | 267 |
| 264 int new_start_index = to_trim * (entry_size / kPointerSize); | 268 int new_start_index = to_trim * (entry_size / kPointerSize); |
| 265 former_start[new_start_index] = map; | 269 former_start[new_start_index] = map; |
| 266 former_start[new_start_index + 1] = Smi::FromInt(len - to_trim); | 270 former_start[new_start_index + 1] = Smi::FromInt(len - to_trim); |
| 267 | 271 |
| 268 // Maintain marking consistency for HeapObjectIterator and | 272 // Maintain marking consistency for HeapObjectIterator and |
| 269 // IncrementalMarking. | 273 // IncrementalMarking. |
| 270 int size_delta = to_trim * entry_size; | 274 int size_delta = to_trim * entry_size; |
| 271 Address new_start = elms->address() + size_delta; | 275 Address new_start = elms->address() + size_delta; |
| (...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 } | 1739 } |
| 1736 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1740 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1737 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1741 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1738 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1742 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
| 1739 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1743 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1740 #undef DEFINE_BUILTIN_ACCESSOR_C | 1744 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1741 #undef DEFINE_BUILTIN_ACCESSOR_A | 1745 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1742 | 1746 |
| 1743 | 1747 |
| 1744 } } // namespace v8::internal | 1748 } } // namespace v8::internal |
| OLD | NEW |