| 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 3516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3527 bool Map::HasTransitionArray() { | 3527 bool Map::HasTransitionArray() { |
| 3528 return instance_descriptors()->HasTransitionArray(); | 3528 return instance_descriptors()->HasTransitionArray(); |
| 3529 } | 3529 } |
| 3530 | 3530 |
| 3531 | 3531 |
| 3532 Map* Map::elements_transition_map() { | 3532 Map* Map::elements_transition_map() { |
| 3533 return transitions()->elements_transition(); | 3533 return transitions()->elements_transition(); |
| 3534 } | 3534 } |
| 3535 | 3535 |
| 3536 | 3536 |
| 3537 MaybeObject* Map::AddTransition(String* key, Object* value) { | 3537 MaybeObject* Map::AddTransition(String* key, Map* target) { |
| 3538 if (HasTransitionArray()) return transitions()->CopyInsert(key, value); | 3538 if (HasTransitionArray()) return transitions()->CopyInsert(key, target); |
| 3539 return TransitionArray::NewWith(key, value); | 3539 return TransitionArray::NewWith(key, target); |
| 3540 } | |
| 3541 | |
| 3542 void Map::SetTransition(int transition_index, Object* value) { | |
| 3543 transitions()->SetValue(transition_index, value); | |
| 3544 } | 3540 } |
| 3545 | 3541 |
| 3546 | 3542 |
| 3543 void Map::SetTransition(int transition_index, Map* target) { |
| 3544 transitions()->SetTarget(transition_index, target); |
| 3545 } |
| 3546 |
| 3547 |
| 3547 // If the map is using the empty descriptor array, install a new empty | 3548 // If the map is using the empty descriptor array, install a new empty |
| 3548 // descriptor array that will contain an elements transition. | 3549 // descriptor array that will contain an elements transition. |
| 3549 static MaybeObject* AllowTransitions(Map* map) { | 3550 static MaybeObject* AllowTransitions(Map* map) { |
| 3550 if (map->instance_descriptors()->MayContainTransitions()) return map; | 3551 if (map->instance_descriptors()->MayContainTransitions()) return map; |
| 3551 DescriptorArray* descriptors; | 3552 DescriptorArray* descriptors; |
| 3552 MaybeObject* maybe_descriptors = | 3553 MaybeObject* maybe_descriptors = |
| 3553 DescriptorArray::Allocate(0, DescriptorArray::CANNOT_BE_SHARED); | 3554 DescriptorArray::Allocate(0, DescriptorArray::CANNOT_BE_SHARED); |
| 3554 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; | 3555 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; |
| 3555 map->set_instance_descriptors(descriptors); | 3556 map->set_instance_descriptors(descriptors); |
| 3556 return descriptors; | 3557 return descriptors; |
| (...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5321 #undef WRITE_UINT32_FIELD | 5322 #undef WRITE_UINT32_FIELD |
| 5322 #undef READ_SHORT_FIELD | 5323 #undef READ_SHORT_FIELD |
| 5323 #undef WRITE_SHORT_FIELD | 5324 #undef WRITE_SHORT_FIELD |
| 5324 #undef READ_BYTE_FIELD | 5325 #undef READ_BYTE_FIELD |
| 5325 #undef WRITE_BYTE_FIELD | 5326 #undef WRITE_BYTE_FIELD |
| 5326 | 5327 |
| 5327 | 5328 |
| 5328 } } // namespace v8::internal | 5329 } } // namespace v8::internal |
| 5329 | 5330 |
| 5330 #endif // V8_OBJECTS_INL_H_ | 5331 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |