Chromium Code Reviews| Index: src/objects.cc |
| diff --git a/src/objects.cc b/src/objects.cc |
| index 4d8fe8eb059a0f0690f1849f071416500df6a740..1d1757fd4e4f3efbbdce695521cb2a37f8a45d17 100644 |
| --- a/src/objects.cc |
| +++ b/src/objects.cc |
| @@ -2169,6 +2169,12 @@ static void ZapEndOfFixedArray(Address new_end, int to_trim) { |
| template<RightTrimMode trim_mode> |
| static void RightTrimFixedArray(Heap* heap, FixedArray* elms, int to_trim) { |
| +#ifdef DEBUG |
| + bool zapInFromGCMode = true; |
| +#else |
| + bool zapInFromGCMode = FLAG_verify_heap; |
| +#endif |
| + |
| ASSERT(elms->map() != HEAP->fixed_cow_array_map()); |
| // For now this trick is only applied to fixed arrays in new and paged space. |
| ASSERT(!HEAP->lo_space()->Contains(elms)); |
| @@ -2179,12 +2185,8 @@ static void RightTrimFixedArray(Heap* heap, FixedArray* elms, int to_trim) { |
| Address new_end = elms->address() + FixedArray::SizeFor(len - to_trim); |
| - if (trim_mode == FROM_GC) { |
| -#ifdef DEBUG |
| - ZapEndOfFixedArray(new_end, to_trim); |
| -#endif |
| - } else { |
| - ZapEndOfFixedArray(new_end, to_trim); |
| + if (trim_mode != FROM_GC || zapInFromGCMode) { |
|
Michael Starzinger
2012/10/11 12:42:46
See comment about Heap::ShouldZapGarbage earlier.
mvstanton1
2012/10/12 08:40:50
Done.
|
| + ZapEndOfFixedArray(new_end, to_trim); |
| } |
| int size_delta = to_trim * kPointerSize; |
| @@ -9061,6 +9063,21 @@ MaybeObject* Map::PutPrototypeTransition(Object* prototype, Map* map) { |
| return cache; |
| } |
|
Michael Starzinger
2012/10/11 12:42:46
Additional empty newline here.
mvstanton1
2012/10/12 08:40:50
Done.
|
| +void Map::ZapTransitions() { |
| + TransitionArray* transition_array = transitions(); |
| + MemsetPointer(transition_array->data_start(), |
| + GetHeap()->the_hole_value(), |
| + transition_array->length()); |
| +} |
| + |
| + |
| +void Map::ZapPrototypeTransitions() { |
| + FixedArray* proto_transitions = GetPrototypeTransitions(); |
| + MemsetPointer(proto_transitions->data_start(), |
| + GetHeap()->the_hole_value(), |
| + proto_transitions->length()); |
| +} |
| + |
| MaybeObject* JSReceiver::SetPrototype(Object* value, |
| bool skip_hidden_prototypes) { |