| 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 4762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4773 } | 4773 } |
| 4774 | 4774 |
| 4775 | 4775 |
| 4776 void Map::set_transitions(TransitionArray* transition_array, | 4776 void Map::set_transitions(TransitionArray* transition_array, |
| 4777 WriteBarrierMode mode) { | 4777 WriteBarrierMode mode) { |
| 4778 // Transition arrays are not shared. When one is replaced, it should not | 4778 // Transition arrays are not shared. When one is replaced, it should not |
| 4779 // keep referenced objects alive, so we zap it. | 4779 // keep referenced objects alive, so we zap it. |
| 4780 // When there is another reference to the array somewhere (e.g. a handle), | 4780 // When there is another reference to the array somewhere (e.g. a handle), |
| 4781 // not zapping turns from a waste of memory into a source of crashes. | 4781 // not zapping turns from a waste of memory into a source of crashes. |
| 4782 if (HasTransitionArray()) { | 4782 if (HasTransitionArray()) { |
| 4783 #ifdef DEBUG |
| 4784 for (int i = 0; i < transitions()->number_of_transitions(); i++) { |
| 4785 Map* target = transitions()->GetTarget(i); |
| 4786 if (target->instance_descriptors() == instance_descriptors()) { |
| 4787 Name* key = transitions()->GetKey(i); |
| 4788 int new_target_index = transition_array->Search(key); |
| 4789 ASSERT(new_target_index != TransitionArray::kNotFound); |
| 4790 ASSERT(transition_array->GetTarget(new_target_index) == target); |
| 4791 } |
| 4792 } |
| 4793 #endif |
| 4783 ASSERT(transitions() != transition_array); | 4794 ASSERT(transitions() != transition_array); |
| 4784 ZapTransitions(); | 4795 ZapTransitions(); |
| 4785 } | 4796 } |
| 4786 | 4797 |
| 4787 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array); | 4798 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array); |
| 4788 CONDITIONAL_WRITE_BARRIER( | 4799 CONDITIONAL_WRITE_BARRIER( |
| 4789 GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode); | 4800 GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode); |
| 4790 } | 4801 } |
| 4791 | 4802 |
| 4792 | 4803 |
| (...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6794 #undef READ_UINT32_FIELD | 6805 #undef READ_UINT32_FIELD |
| 6795 #undef WRITE_UINT32_FIELD | 6806 #undef WRITE_UINT32_FIELD |
| 6796 #undef READ_SHORT_FIELD | 6807 #undef READ_SHORT_FIELD |
| 6797 #undef WRITE_SHORT_FIELD | 6808 #undef WRITE_SHORT_FIELD |
| 6798 #undef READ_BYTE_FIELD | 6809 #undef READ_BYTE_FIELD |
| 6799 #undef WRITE_BYTE_FIELD | 6810 #undef WRITE_BYTE_FIELD |
| 6800 | 6811 |
| 6801 } } // namespace v8::internal | 6812 } } // namespace v8::internal |
| 6802 | 6813 |
| 6803 #endif // V8_OBJECTS_INL_H_ | 6814 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |