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 4239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4250 } | 4250 } |
4251 | 4251 |
4252 | 4252 |
4253 bool Map::HasTransitionArray() { | 4253 bool Map::HasTransitionArray() { |
4254 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); | 4254 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); |
4255 return object->IsTransitionArray(); | 4255 return object->IsTransitionArray(); |
4256 } | 4256 } |
4257 | 4257 |
4258 | 4258 |
4259 Map* Map::elements_transition_map() { | 4259 Map* Map::elements_transition_map() { |
4260 return transitions()->elements_transition(); | 4260 int index = transitions()->Search(GetHeap()->elements_transition_symbol()); |
| 4261 return transitions()->GetTarget(index); |
4261 } | 4262 } |
4262 | 4263 |
4263 | 4264 |
4264 bool Map::CanHaveMoreTransitions() { | 4265 bool Map::CanHaveMoreTransitions() { |
4265 if (!HasTransitionArray()) return true; | 4266 if (!HasTransitionArray()) return true; |
4266 return FixedArray::SizeFor(transitions()->length() + | 4267 return FixedArray::SizeFor(transitions()->length() + |
4267 TransitionArray::kTransitionSize) | 4268 TransitionArray::kTransitionSize) |
4268 <= Page::kMaxNonCodeHeapObjectSize; | 4269 <= Page::kMaxNonCodeHeapObjectSize; |
4269 } | 4270 } |
4270 | 4271 |
(...skipping 10 matching lines...) Expand all Loading... |
4281 transitions()->SetTarget(transition_index, target); | 4282 transitions()->SetTarget(transition_index, target); |
4282 } | 4283 } |
4283 | 4284 |
4284 | 4285 |
4285 Map* Map::GetTransition(int transition_index) { | 4286 Map* Map::GetTransition(int transition_index) { |
4286 return transitions()->GetTarget(transition_index); | 4287 return transitions()->GetTarget(transition_index); |
4287 } | 4288 } |
4288 | 4289 |
4289 | 4290 |
4290 MaybeObject* Map::set_elements_transition_map(Map* transitioned_map) { | 4291 MaybeObject* Map::set_elements_transition_map(Map* transitioned_map) { |
4291 MaybeObject* allow_elements = EnsureHasTransitionArray(this); | 4292 TransitionArray* transitions; |
4292 if (allow_elements->IsFailure()) return allow_elements; | 4293 MaybeObject* maybe_transitions = AddTransition( |
4293 transitions()->set_elements_transition(transitioned_map); | 4294 GetHeap()->elements_transition_symbol(), |
4294 return this; | 4295 transitioned_map, |
| 4296 FULL_TRANSITION); |
| 4297 if (!maybe_transitions->To(&transitions)) return maybe_transitions; |
| 4298 set_transitions(transitions); |
| 4299 return transitions; |
4295 } | 4300 } |
4296 | 4301 |
4297 | 4302 |
4298 FixedArray* Map::GetPrototypeTransitions() { | 4303 FixedArray* Map::GetPrototypeTransitions() { |
4299 if (!HasTransitionArray()) return GetHeap()->empty_fixed_array(); | 4304 if (!HasTransitionArray()) return GetHeap()->empty_fixed_array(); |
4300 if (!transitions()->HasPrototypeTransitions()) { | 4305 if (!transitions()->HasPrototypeTransitions()) { |
4301 return GetHeap()->empty_fixed_array(); | 4306 return GetHeap()->empty_fixed_array(); |
4302 } | 4307 } |
4303 return transitions()->GetPrototypeTransitions(); | 4308 return transitions()->GetPrototypeTransitions(); |
4304 } | 4309 } |
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6224 #undef WRITE_UINT32_FIELD | 6229 #undef WRITE_UINT32_FIELD |
6225 #undef READ_SHORT_FIELD | 6230 #undef READ_SHORT_FIELD |
6226 #undef WRITE_SHORT_FIELD | 6231 #undef WRITE_SHORT_FIELD |
6227 #undef READ_BYTE_FIELD | 6232 #undef READ_BYTE_FIELD |
6228 #undef WRITE_BYTE_FIELD | 6233 #undef WRITE_BYTE_FIELD |
6229 | 6234 |
6230 | 6235 |
6231 } } // namespace v8::internal | 6236 } } // namespace v8::internal |
6232 | 6237 |
6233 #endif // V8_OBJECTS_INL_H_ | 6238 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |