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 3510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3521 Map* Map::elements_transition_map() { | 3521 Map* Map::elements_transition_map() { |
3522 return transitions()->elements_transition(); | 3522 return transitions()->elements_transition(); |
3523 } | 3523 } |
3524 | 3524 |
3525 | 3525 |
3526 MaybeObject* Map::AddTransition(String* key, Object* value) { | 3526 MaybeObject* Map::AddTransition(String* key, Object* value) { |
3527 if (HasTransitionArray()) return transitions()->CopyInsert(key, value); | 3527 if (HasTransitionArray()) return transitions()->CopyInsert(key, value); |
3528 return TransitionArray::NewWith(key, value); | 3528 return TransitionArray::NewWith(key, value); |
3529 } | 3529 } |
3530 | 3530 |
| 3531 void Map::SetTransition(int transition_index, Object* value) { |
| 3532 transitions()->SetValue(transition_index, value); |
| 3533 } |
| 3534 |
3531 | 3535 |
3532 // If the map is using the empty descriptor array, install a new empty | 3536 // If the map is using the empty descriptor array, install a new empty |
3533 // descriptor array that will contain an elements transition. | 3537 // descriptor array that will contain an elements transition. |
3534 static MaybeObject* AllowTransitions(Map* map) { | 3538 static MaybeObject* AllowTransitions(Map* map) { |
3535 if (map->instance_descriptors()->MayContainTransitions()) return map; | 3539 if (map->instance_descriptors()->MayContainTransitions()) return map; |
3536 DescriptorArray* descriptors; | 3540 DescriptorArray* descriptors; |
3537 MaybeObject* maybe_descriptors = | 3541 MaybeObject* maybe_descriptors = |
3538 DescriptorArray::Allocate(0, DescriptorArray::CANNOT_BE_SHARED); | 3542 DescriptorArray::Allocate(0, DescriptorArray::CANNOT_BE_SHARED); |
3539 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; | 3543 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; |
3540 map->set_instance_descriptors(descriptors); | 3544 map->set_instance_descriptors(descriptors); |
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5306 #undef WRITE_UINT32_FIELD | 5310 #undef WRITE_UINT32_FIELD |
5307 #undef READ_SHORT_FIELD | 5311 #undef READ_SHORT_FIELD |
5308 #undef WRITE_SHORT_FIELD | 5312 #undef WRITE_SHORT_FIELD |
5309 #undef READ_BYTE_FIELD | 5313 #undef READ_BYTE_FIELD |
5310 #undef WRITE_BYTE_FIELD | 5314 #undef WRITE_BYTE_FIELD |
5311 | 5315 |
5312 | 5316 |
5313 } } // namespace v8::internal | 5317 } } // namespace v8::internal |
5314 | 5318 |
5315 #endif // V8_OBJECTS_INL_H_ | 5319 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |