OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/lookup.h" | 5 #include "src/lookup.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/elements.h" | 9 #include "src/elements.h" |
10 #include "src/field-type.h" | 10 #include "src/field-type.h" |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
361 // Can only be called when the receiver is a JSObject. JSProxy has to be | 361 // Can only be called when the receiver is a JSObject. JSProxy has to be |
362 // handled via a trap. Adding properties to primitive values is not | 362 // handled via a trap. Adding properties to primitive values is not |
363 // observable. | 363 // observable. |
364 Handle<JSObject> receiver = GetStoreTarget(); | 364 Handle<JSObject> receiver = GetStoreTarget(); |
365 | 365 |
366 if (!IsElement() && !receiver->map()->is_dictionary_map()) { | 366 if (!IsElement() && !receiver->map()->is_dictionary_map()) { |
367 holder_ = receiver; | 367 holder_ = receiver; |
368 Handle<Map> old_map(receiver->map(), isolate_); | 368 Handle<Map> old_map(receiver->map(), isolate_); |
369 Handle<Map> new_map = Map::TransitionToAccessorProperty( | 369 Handle<Map> new_map = Map::TransitionToAccessorProperty( |
370 old_map, name_, component, accessor, attributes); | 370 old_map, name_, component, accessor, attributes); |
371 bool simple_transition = new_map->GetBackPointer() == receiver->map(); | |
371 JSObject::MigrateToMap(receiver, new_map); | 372 JSObject::MigrateToMap(receiver, new_map); |
372 | 373 |
374 if (simple_transition) { | |
375 int number = new_map->LastAdded(); | |
jochen (gone - plz use gerrit)
2016/03/04 09:58:03
why's LastAdded not return uint32_t?
| |
376 number_ = static_cast<uint32_t>(number); | |
377 property_details_ = new_map->GetLastDescriptorDetails(); | |
378 state_ = ACCESSOR; | |
379 return; | |
380 } | |
381 | |
373 ReloadPropertyInformation(); | 382 ReloadPropertyInformation(); |
374 | |
375 if (!new_map->is_dictionary_map()) return; | 383 if (!new_map->is_dictionary_map()) return; |
376 } | 384 } |
377 | 385 |
378 Handle<AccessorPair> pair; | 386 Handle<AccessorPair> pair; |
379 if (state() == ACCESSOR && GetAccessors()->IsAccessorPair()) { | 387 if (state() == ACCESSOR && GetAccessors()->IsAccessorPair()) { |
380 pair = Handle<AccessorPair>::cast(GetAccessors()); | 388 pair = Handle<AccessorPair>::cast(GetAccessors()); |
381 // If the component and attributes are identical, nothing has to be done. | 389 // If the component and attributes are identical, nothing has to be done. |
382 if (pair->get(component) == *accessor) { | 390 if (pair->get(component) == *accessor) { |
383 if (property_details().attributes() == attributes) return; | 391 if (property_details().attributes() == attributes) return; |
384 } else { | 392 } else { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
720 // Fall through. | 728 // Fall through. |
721 default: | 729 default: |
722 return NOT_FOUND; | 730 return NOT_FOUND; |
723 } | 731 } |
724 UNREACHABLE(); | 732 UNREACHABLE(); |
725 return state_; | 733 return state_; |
726 } | 734 } |
727 | 735 |
728 } // namespace internal | 736 } // namespace internal |
729 } // namespace v8 | 737 } // namespace v8 |
OLD | NEW |