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 4451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4462 } | 4462 } |
4463 | 4463 |
4464 | 4464 |
4465 void Map::set_transitions(TransitionArray* transition_array, | 4465 void Map::set_transitions(TransitionArray* transition_array, |
4466 WriteBarrierMode mode) { | 4466 WriteBarrierMode mode) { |
4467 // Transition arrays are not shared. When one is replaced, it should not | 4467 // Transition arrays are not shared. When one is replaced, it should not |
4468 // keep referenced objects alive, so we zap it. | 4468 // keep referenced objects alive, so we zap it. |
4469 // When there is another reference to the array somewhere (e.g. a handle), | 4469 // When there is another reference to the array somewhere (e.g. a handle), |
4470 // not zapping turns from a waste of memory into a source of crashes. | 4470 // not zapping turns from a waste of memory into a source of crashes. |
4471 if (HasTransitionArray()) { | 4471 if (HasTransitionArray()) { |
| 4472 #ifdef DEBUG |
| 4473 for (int i = 0; i < transitions()->number_of_transitions(); i++) { |
| 4474 Map* target = transitions()->GetTarget(i); |
| 4475 if (target->instance_descriptors() == instance_descriptors()) { |
| 4476 Name* key = transitions()->GetKey(i); |
| 4477 int new_target_index = transition_array->Search(key); |
| 4478 ASSERT(new_target_index != TransitionArray::kNotFound); |
| 4479 ASSERT(transition_array->GetTarget(new_target_index) == target); |
| 4480 } |
| 4481 } |
| 4482 #endif |
4472 ASSERT(transitions() != transition_array); | 4483 ASSERT(transitions() != transition_array); |
4473 ZapTransitions(); | 4484 ZapTransitions(); |
4474 } | 4485 } |
4475 | 4486 |
4476 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array); | 4487 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array); |
4477 CONDITIONAL_WRITE_BARRIER( | 4488 CONDITIONAL_WRITE_BARRIER( |
4478 GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode); | 4489 GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode); |
4479 } | 4490 } |
4480 | 4491 |
4481 | 4492 |
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6476 #undef WRITE_UINT32_FIELD | 6487 #undef WRITE_UINT32_FIELD |
6477 #undef READ_SHORT_FIELD | 6488 #undef READ_SHORT_FIELD |
6478 #undef WRITE_SHORT_FIELD | 6489 #undef WRITE_SHORT_FIELD |
6479 #undef READ_BYTE_FIELD | 6490 #undef READ_BYTE_FIELD |
6480 #undef WRITE_BYTE_FIELD | 6491 #undef WRITE_BYTE_FIELD |
6481 | 6492 |
6482 | 6493 |
6483 } } // namespace v8::internal | 6494 } } // namespace v8::internal |
6484 | 6495 |
6485 #endif // V8_OBJECTS_INL_H_ | 6496 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |