| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/ic/accessor-assembler.h" | 5 #include "src/ic/accessor-assembler.h" |
| 6 #include "src/ic/accessor-assembler-impl.h" | 6 #include "src/ic/accessor-assembler-impl.h" |
| 7 | 7 |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/ic/handler-configuration.h" | 10 #include "src/ic/handler-configuration.h" |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 } | 683 } |
| 684 } | 684 } |
| 685 | 685 |
| 686 void AccessorAssemblerImpl::HandleStoreFieldAndReturn( | 686 void AccessorAssemblerImpl::HandleStoreFieldAndReturn( |
| 687 Node* handler_word, Node* holder, Representation representation, | 687 Node* handler_word, Node* holder, Representation representation, |
| 688 Node* value, Node* transition, Label* miss) { | 688 Node* value, Node* transition, Label* miss) { |
| 689 bool transition_to_field = transition != nullptr; | 689 bool transition_to_field = transition != nullptr; |
| 690 Node* prepared_value = PrepareValueForStore( | 690 Node* prepared_value = PrepareValueForStore( |
| 691 handler_word, holder, representation, transition, value, miss); | 691 handler_word, holder, representation, transition, value, miss); |
| 692 | 692 |
| 693 Node* offset = DecodeWord<StoreHandler::FieldOffsetBits>(handler_word); | |
| 694 Label if_inobject(this), if_out_of_object(this); | 693 Label if_inobject(this), if_out_of_object(this); |
| 695 Branch(IsSetWord<StoreHandler::IsInobjectBits>(handler_word), &if_inobject, | 694 Branch(IsSetWord<StoreHandler::IsInobjectBits>(handler_word), &if_inobject, |
| 696 &if_out_of_object); | 695 &if_out_of_object); |
| 697 | 696 |
| 698 Bind(&if_inobject); | 697 Bind(&if_inobject); |
| 699 { | 698 { |
| 700 StoreNamedField(holder, offset, true, representation, prepared_value, | 699 StoreNamedField(handler_word, holder, true, representation, prepared_value, |
| 701 transition_to_field); | 700 transition_to_field); |
| 702 if (transition_to_field) { | 701 if (transition_to_field) { |
| 703 StoreMap(holder, transition); | 702 StoreMap(holder, transition); |
| 704 } | 703 } |
| 705 Return(value); | 704 Return(value); |
| 706 } | 705 } |
| 707 | 706 |
| 708 Bind(&if_out_of_object); | 707 Bind(&if_out_of_object); |
| 709 { | 708 { |
| 710 if (transition_to_field) { | 709 if (transition_to_field) { |
| 711 Label storage_extended(this); | 710 Label storage_extended(this); |
| 712 GotoUnless(IsSetWord<StoreHandler::ExtendStorageBits>(handler_word), | 711 GotoUnless(IsSetWord<StoreHandler::ExtendStorageBits>(handler_word), |
| 713 &storage_extended); | 712 &storage_extended); |
| 714 Comment("[ Extend storage"); | 713 Comment("[ Extend storage"); |
| 715 ExtendPropertiesBackingStore(holder); | 714 ExtendPropertiesBackingStore(holder); |
| 716 Comment("] Extend storage"); | 715 Comment("] Extend storage"); |
| 717 Goto(&storage_extended); | 716 Goto(&storage_extended); |
| 718 | 717 |
| 719 Bind(&storage_extended); | 718 Bind(&storage_extended); |
| 720 } | 719 } |
| 721 | 720 |
| 722 StoreNamedField(holder, offset, false, representation, prepared_value, | 721 StoreNamedField(handler_word, holder, false, representation, prepared_value, |
| 723 transition_to_field); | 722 transition_to_field); |
| 724 if (transition_to_field) { | 723 if (transition_to_field) { |
| 725 StoreMap(holder, transition); | 724 StoreMap(holder, transition); |
| 726 } | 725 } |
| 727 Return(value); | 726 Return(value); |
| 728 } | 727 } |
| 729 } | 728 } |
| 730 | 729 |
| 731 Node* AccessorAssemblerImpl::PrepareValueForStore(Node* handler_word, | 730 Node* AccessorAssemblerImpl::PrepareValueForStore(Node* handler_word, |
| 732 Node* holder, | 731 Node* holder, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 Heap::kUndefinedValueRootIndex, mode); | 791 Heap::kUndefinedValueRootIndex, mode); |
| 793 | 792 |
| 794 // |new_properties| is guaranteed to be in new space, so we can skip | 793 // |new_properties| is guaranteed to be in new space, so we can skip |
| 795 // the write barrier. | 794 // the write barrier. |
| 796 CopyFixedArrayElements(kind, properties, new_properties, length, | 795 CopyFixedArrayElements(kind, properties, new_properties, length, |
| 797 SKIP_WRITE_BARRIER, mode); | 796 SKIP_WRITE_BARRIER, mode); |
| 798 | 797 |
| 799 StoreObjectField(object, JSObject::kPropertiesOffset, new_properties); | 798 StoreObjectField(object, JSObject::kPropertiesOffset, new_properties); |
| 800 } | 799 } |
| 801 | 800 |
| 802 void AccessorAssemblerImpl::StoreNamedField(Node* object, Node* offset, | 801 void AccessorAssemblerImpl::StoreNamedField(Node* handler_word, Node* object, |
| 803 bool is_inobject, | 802 bool is_inobject, |
| 804 Representation representation, | 803 Representation representation, |
| 805 Node* value, | 804 Node* value, |
| 806 bool transition_to_field) { | 805 bool transition_to_field) { |
| 807 bool store_value_as_double = representation.IsDouble(); | 806 bool store_value_as_double = representation.IsDouble(); |
| 808 Node* property_storage = object; | 807 Node* property_storage = object; |
| 809 if (!is_inobject) { | 808 if (!is_inobject) { |
| 810 property_storage = LoadProperties(object); | 809 property_storage = LoadProperties(object); |
| 811 } | 810 } |
| 812 | 811 |
| 812 Node* offset = DecodeWord<StoreHandler::FieldOffsetBits>(handler_word); |
| 813 if (representation.IsDouble()) { | 813 if (representation.IsDouble()) { |
| 814 if (!FLAG_unbox_double_fields || !is_inobject) { | 814 if (!FLAG_unbox_double_fields || !is_inobject) { |
| 815 if (transition_to_field) { | 815 if (transition_to_field) { |
| 816 Node* heap_number = AllocateHeapNumberWithValue(value, MUTABLE); | 816 Node* heap_number = AllocateHeapNumberWithValue(value, MUTABLE); |
| 817 // Store the new mutable heap number into the object. | 817 // Store the new mutable heap number into the object. |
| 818 value = heap_number; | 818 value = heap_number; |
| 819 store_value_as_double = false; | 819 store_value_as_double = false; |
| 820 } else { | 820 } else { |
| 821 // Load the heap number. | 821 // Load the heap number. |
| 822 property_storage = LoadObjectField(property_storage, offset); | 822 property_storage = LoadObjectField(property_storage, offset); |
| (...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1920 void AccessorAssembler::GenerateKeyedStoreICTrampolineTF( | 1920 void AccessorAssembler::GenerateKeyedStoreICTrampolineTF( |
| 1921 CodeAssemblerState* state, LanguageMode language_mode) { | 1921 CodeAssemblerState* state, LanguageMode language_mode) { |
| 1922 AccessorAssemblerImpl assembler(state); | 1922 AccessorAssemblerImpl assembler(state); |
| 1923 assembler.GenerateKeyedStoreICTrampolineTF(language_mode); | 1923 assembler.GenerateKeyedStoreICTrampolineTF(language_mode); |
| 1924 } | 1924 } |
| 1925 | 1925 |
| 1926 #undef ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE | 1926 #undef ACCESSOR_ASSEMBLER_PUBLIC_INTERFACE |
| 1927 | 1927 |
| 1928 } // namespace internal | 1928 } // namespace internal |
| 1929 } // namespace v8 | 1929 } // namespace v8 |
| OLD | NEW |