OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 6653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6664 if (insert_transition) { | 6664 if (insert_transition) { |
6665 MaybeObject* added_elements = set_elements_transition_map(new_map); | 6665 MaybeObject* added_elements = set_elements_transition_map(new_map); |
6666 if (added_elements->IsFailure()) return added_elements; | 6666 if (added_elements->IsFailure()) return added_elements; |
6667 new_map->SetBackPointer(this); | 6667 new_map->SetBackPointer(this); |
6668 } | 6668 } |
6669 | 6669 |
6670 return new_map; | 6670 return new_map; |
6671 } | 6671 } |
6672 | 6672 |
6673 | 6673 |
| 6674 MaybeObject* Map::CopyForObserved() { |
| 6675 ASSERT(!is_observed()); |
| 6676 |
| 6677 Map* new_map; |
| 6678 MaybeObject* maybe_new_map; |
| 6679 if (owns_descriptors()) { |
| 6680 maybe_new_map = CopyDropDescriptors(); |
| 6681 } else { |
| 6682 maybe_new_map = Copy(); |
| 6683 } |
| 6684 if (!maybe_new_map->To(&new_map)) return maybe_new_map; |
| 6685 |
| 6686 TransitionArray* transitions; |
| 6687 MaybeObject* maybe_transitions = AddTransition(GetHeap()->observed_symbol(), |
| 6688 new_map, |
| 6689 FULL_TRANSITION); |
| 6690 if (!maybe_transitions->To(&transitions)) return maybe_transitions; |
| 6691 set_transitions(transitions); |
| 6692 |
| 6693 new_map->set_is_observed(true); |
| 6694 |
| 6695 if (owns_descriptors()) { |
| 6696 new_map->InitializeDescriptors(instance_descriptors()); |
| 6697 set_owns_descriptors(false); |
| 6698 } |
| 6699 |
| 6700 new_map->SetBackPointer(this); |
| 6701 return new_map; |
| 6702 } |
| 6703 |
| 6704 |
6674 MaybeObject* Map::CopyWithPreallocatedFieldDescriptors() { | 6705 MaybeObject* Map::CopyWithPreallocatedFieldDescriptors() { |
6675 if (pre_allocated_property_fields() == 0) return CopyDropDescriptors(); | 6706 if (pre_allocated_property_fields() == 0) return CopyDropDescriptors(); |
6676 | 6707 |
6677 // If the map has pre-allocated properties always start out with a descriptor | 6708 // If the map has pre-allocated properties always start out with a descriptor |
6678 // array describing these properties. | 6709 // array describing these properties. |
6679 ASSERT(constructor()->IsJSFunction()); | 6710 ASSERT(constructor()->IsJSFunction()); |
6680 JSFunction* ctor = JSFunction::cast(constructor()); | 6711 JSFunction* ctor = JSFunction::cast(constructor()); |
6681 Map* map = ctor->initial_map(); | 6712 Map* map = ctor->initial_map(); |
6682 DescriptorArray* descriptors = map->instance_descriptors(); | 6713 DescriptorArray* descriptors = map->instance_descriptors(); |
6683 | 6714 |
(...skipping 9187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15871 | 15902 |
15872 void PropertyCell::AddDependentCode(Handle<Code> code) { | 15903 void PropertyCell::AddDependentCode(Handle<Code> code) { |
15873 Handle<DependentCode> codes = DependentCode::Insert( | 15904 Handle<DependentCode> codes = DependentCode::Insert( |
15874 Handle<DependentCode>(dependent_code()), | 15905 Handle<DependentCode>(dependent_code()), |
15875 DependentCode::kPropertyCellChangedGroup, code); | 15906 DependentCode::kPropertyCellChangedGroup, code); |
15876 if (*codes != dependent_code()) set_dependent_code(*codes); | 15907 if (*codes != dependent_code()) set_dependent_code(*codes); |
15877 } | 15908 } |
15878 | 15909 |
15879 | 15910 |
15880 } } // namespace v8::internal | 15911 } } // namespace v8::internal |
OLD | NEW |