OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/bailout-reason.h" | 7 #include "src/bailout-reason.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/field-index.h" | 9 #include "src/field-index.h" |
10 #include "src/hydrogen.h" | 10 #include "src/hydrogen.h" |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 562 |
563 HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField( | 563 HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField( |
564 HValue* object, FieldIndex index) { | 564 HValue* object, FieldIndex index) { |
565 Representation representation = index.is_double() | 565 Representation representation = index.is_double() |
566 ? Representation::Double() | 566 ? Representation::Double() |
567 : Representation::Tagged(); | 567 : Representation::Tagged(); |
568 int offset = index.offset(); | 568 int offset = index.offset(); |
569 HObjectAccess access = index.is_inobject() | 569 HObjectAccess access = index.is_inobject() |
570 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) | 570 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) |
571 : HObjectAccess::ForBackingStoreOffset(offset, representation); | 571 : HObjectAccess::ForBackingStoreOffset(offset, representation); |
572 if (index.is_double()) { | 572 if (index.is_double() && |
| 573 (!FLAG_unbox_double_fields || !index.is_inobject())) { |
573 // Load the heap number. | 574 // Load the heap number. |
574 object = Add<HLoadNamedField>( | 575 object = Add<HLoadNamedField>( |
575 object, static_cast<HValue*>(NULL), | 576 object, static_cast<HValue*>(NULL), |
576 access.WithRepresentation(Representation::Tagged())); | 577 access.WithRepresentation(Representation::Tagged())); |
577 // Load the double value from it. | 578 // Load the double value from it. |
578 access = HObjectAccess::ForHeapNumberValue(); | 579 access = HObjectAccess::ForHeapNumberValue(); |
579 } | 580 } |
580 return Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), access); | 581 return Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), access); |
581 } | 582 } |
582 | 583 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 HValue* object, HValue* value, FieldIndex index, | 730 HValue* object, HValue* value, FieldIndex index, |
730 Representation representation, bool transition_to_field) { | 731 Representation representation, bool transition_to_field) { |
731 DCHECK(!index.is_double() || representation.IsDouble()); | 732 DCHECK(!index.is_double() || representation.IsDouble()); |
732 int offset = index.offset(); | 733 int offset = index.offset(); |
733 HObjectAccess access = | 734 HObjectAccess access = |
734 index.is_inobject() | 735 index.is_inobject() |
735 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) | 736 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) |
736 : HObjectAccess::ForBackingStoreOffset(offset, representation); | 737 : HObjectAccess::ForBackingStoreOffset(offset, representation); |
737 | 738 |
738 if (representation.IsDouble()) { | 739 if (representation.IsDouble()) { |
739 HObjectAccess heap_number_access = | 740 if (!FLAG_unbox_double_fields || !index.is_inobject()) { |
740 access.WithRepresentation(Representation::Tagged()); | 741 HObjectAccess heap_number_access = |
741 if (transition_to_field) { | 742 access.WithRepresentation(Representation::Tagged()); |
742 // The store requires a mutable HeapNumber to be allocated. | 743 if (transition_to_field) { |
743 NoObservableSideEffectsScope no_side_effects(this); | 744 // The store requires a mutable HeapNumber to be allocated. |
744 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); | 745 NoObservableSideEffectsScope no_side_effects(this); |
| 746 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); |
745 | 747 |
746 // TODO(hpayer): Allocation site pretenuring support. | 748 // TODO(hpayer): Allocation site pretenuring support. |
747 HInstruction* heap_number = | 749 HInstruction* heap_number = |
748 Add<HAllocate>(heap_number_size, HType::HeapObject(), NOT_TENURED, | 750 Add<HAllocate>(heap_number_size, HType::HeapObject(), NOT_TENURED, |
749 MUTABLE_HEAP_NUMBER_TYPE); | 751 MUTABLE_HEAP_NUMBER_TYPE); |
750 AddStoreMapConstant(heap_number, | 752 AddStoreMapConstant(heap_number, |
751 isolate()->factory()->mutable_heap_number_map()); | 753 isolate()->factory()->mutable_heap_number_map()); |
752 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), | 754 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), |
753 value); | 755 value); |
754 // Store the new mutable heap number into the object. | 756 // Store the new mutable heap number into the object. |
755 access = heap_number_access; | 757 access = heap_number_access; |
756 value = heap_number; | 758 value = heap_number; |
757 } else { | 759 } else { |
758 // Load the heap number. | 760 // Load the heap number. |
759 object = Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), | 761 object = Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), |
760 heap_number_access); | 762 heap_number_access); |
761 // Store the double value into it. | 763 // Store the double value into it. |
762 access = HObjectAccess::ForHeapNumberValue(); | 764 access = HObjectAccess::ForHeapNumberValue(); |
| 765 } |
763 } | 766 } |
764 } else if (representation.IsHeapObject()) { | 767 } else if (representation.IsHeapObject()) { |
765 BuildCheckHeapObject(value); | 768 BuildCheckHeapObject(value); |
766 } | 769 } |
767 | 770 |
768 Add<HStoreNamedField>(object, access, value, INITIALIZING_STORE); | 771 Add<HStoreNamedField>(object, access, value, INITIALIZING_STORE); |
769 } | 772 } |
770 | 773 |
771 | 774 |
772 template <> | 775 template <> |
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 | 2022 |
2020 // Probe the stub cache. | 2023 // Probe the stub cache. |
2021 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 2024 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
2022 Code::ComputeHandlerFlags(Code::LOAD_IC)); | 2025 Code::ComputeHandlerFlags(Code::LOAD_IC)); |
2023 Add<HTailCallThroughMegamorphicCache>(receiver, name, flags); | 2026 Add<HTailCallThroughMegamorphicCache>(receiver, name, flags); |
2024 | 2027 |
2025 // We never continue. | 2028 // We never continue. |
2026 return graph()->GetConstant0(); | 2029 return graph()->GetConstant0(); |
2027 } | 2030 } |
2028 } } // namespace v8::internal | 2031 } } // namespace v8::internal |
OLD | NEW |