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 3624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3635 SetNumberOfOwnDescriptors(len); | 3635 SetNumberOfOwnDescriptors(len); |
3636 return this; | 3636 return this; |
3637 } | 3637 } |
3638 | 3638 |
3639 | 3639 |
3640 SMI_ACCESSORS(Map, bit_field3, kBitField3Offset) | 3640 SMI_ACCESSORS(Map, bit_field3, kBitField3Offset) |
3641 | 3641 |
3642 | 3642 |
3643 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { | 3643 void Map::ClearTransitions(Heap* heap, WriteBarrierMode mode) { |
3644 Object* back_pointer = GetBackPointer(); | 3644 Object* back_pointer = GetBackPointer(); |
3645 #ifdef DEBUG | 3645 |
3646 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 3646 // In release builds we only need to run this code if verify_heap is on. |
3647 if (object->IsTransitionArray()) { | 3647 #ifndef DEBUG |
Michael Starzinger
2012/10/11 12:42:46
I think it would be useful to have a static inline
mvstanton1
2012/10/12 08:40:50
Done.
| |
3648 ZapTransitions(); | 3648 if (FLAG_verify_heap) { |
3649 } else { | 3649 #endif |
3650 ASSERT(object->IsMap() || object->IsUndefined()); | 3650 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); |
3651 if (object->IsTransitionArray()) { | |
3652 ZapTransitions(); | |
3653 } else { | |
3654 CHECK(object->IsMap() || object->IsUndefined()); | |
3655 } | |
3656 #ifndef DEBUG | |
3651 } | 3657 } |
3652 #endif | 3658 #endif |
3659 | |
3653 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); | 3660 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, back_pointer); |
3654 CONDITIONAL_WRITE_BARRIER( | 3661 CONDITIONAL_WRITE_BARRIER( |
3655 heap, this, kTransitionsOrBackPointerOffset, back_pointer, mode); | 3662 heap, this, kTransitionsOrBackPointerOffset, back_pointer, mode); |
3656 } | 3663 } |
3657 | 3664 |
3658 | 3665 |
3659 void Map::AppendDescriptor(Descriptor* desc, | 3666 void Map::AppendDescriptor(Descriptor* desc, |
3660 const DescriptorArray::WhitenessWitness& witness) { | 3667 const DescriptorArray::WhitenessWitness& witness) { |
3661 DescriptorArray* descriptors = instance_descriptors(); | 3668 DescriptorArray* descriptors = instance_descriptors(); |
3662 int number_of_own_descriptors = NumberOfOwnDescriptors(); | 3669 int number_of_own_descriptors = NumberOfOwnDescriptors(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3771 | 3778 |
3772 TransitionArray* Map::transitions() { | 3779 TransitionArray* Map::transitions() { |
3773 ASSERT(HasTransitionArray()); | 3780 ASSERT(HasTransitionArray()); |
3774 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 3781 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); |
3775 return TransitionArray::cast(object); | 3782 return TransitionArray::cast(object); |
3776 } | 3783 } |
3777 | 3784 |
3778 | 3785 |
3779 void Map::set_transitions(TransitionArray* transition_array, | 3786 void Map::set_transitions(TransitionArray* transition_array, |
3780 WriteBarrierMode mode) { | 3787 WriteBarrierMode mode) { |
3781 #ifdef DEBUG | 3788 // In release mode, only run this code if verify_heap is on. |
3782 if (HasTransitionArray()) { | 3789 #ifndef DEBUG |
Michael Starzinger
2012/10/11 12:42:46
Likewise.
mvstanton1
2012/10/12 08:40:50
Done.
| |
3783 ASSERT(transitions() != transition_array); | 3790 if (FLAG_verify_heap) { |
3784 ZapTransitions(); | 3791 #endif |
3792 if (HasTransitionArray()) { | |
3793 CHECK(transitions() != transition_array); | |
3794 ZapTransitions(); | |
3795 } | |
3796 #ifndef DEBUG | |
3785 } | 3797 } |
3786 #endif | 3798 #endif |
3787 | 3799 |
3788 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array); | 3800 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array); |
3789 CONDITIONAL_WRITE_BARRIER( | 3801 CONDITIONAL_WRITE_BARRIER( |
3790 GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode); | 3802 GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode); |
3791 } | 3803 } |
3792 | 3804 |
3793 | 3805 |
3794 void Map::init_back_pointer(Object* undefined) { | 3806 void Map::init_back_pointer(Object* undefined) { |
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5565 #undef WRITE_UINT32_FIELD | 5577 #undef WRITE_UINT32_FIELD |
5566 #undef READ_SHORT_FIELD | 5578 #undef READ_SHORT_FIELD |
5567 #undef WRITE_SHORT_FIELD | 5579 #undef WRITE_SHORT_FIELD |
5568 #undef READ_BYTE_FIELD | 5580 #undef READ_BYTE_FIELD |
5569 #undef WRITE_BYTE_FIELD | 5581 #undef WRITE_BYTE_FIELD |
5570 | 5582 |
5571 | 5583 |
5572 } } // namespace v8::internal | 5584 } } // namespace v8::internal |
5573 | 5585 |
5574 #endif // V8_OBJECTS_INL_H_ | 5586 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |