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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 531 |
532 HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField( | 532 HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField( |
533 HValue* object, FieldIndex index) { | 533 HValue* object, FieldIndex index) { |
534 Representation representation = index.is_double() | 534 Representation representation = index.is_double() |
535 ? Representation::Double() | 535 ? Representation::Double() |
536 : Representation::Tagged(); | 536 : Representation::Tagged(); |
537 int offset = index.offset(); | 537 int offset = index.offset(); |
538 HObjectAccess access = index.is_inobject() | 538 HObjectAccess access = index.is_inobject() |
539 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) | 539 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) |
540 : HObjectAccess::ForBackingStoreOffset(offset, representation); | 540 : HObjectAccess::ForBackingStoreOffset(offset, representation); |
541 if (index.is_double() && | 541 if (index.is_double()) { |
542 (!FLAG_unbox_double_fields || !index.is_inobject())) { | |
543 // Load the heap number. | 542 // Load the heap number. |
544 object = Add<HLoadNamedField>( | 543 object = Add<HLoadNamedField>( |
545 object, static_cast<HValue*>(NULL), | 544 object, static_cast<HValue*>(NULL), |
546 access.WithRepresentation(Representation::Tagged())); | 545 access.WithRepresentation(Representation::Tagged())); |
547 // Load the double value from it. | 546 // Load the double value from it. |
548 access = HObjectAccess::ForHeapNumberValue(); | 547 access = HObjectAccess::ForHeapNumberValue(); |
549 } | 548 } |
550 return Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), access); | 549 return Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), access); |
551 } | 550 } |
552 | 551 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 HValue* object, HValue* value, FieldIndex index, | 698 HValue* object, HValue* value, FieldIndex index, |
700 Representation representation, bool transition_to_field) { | 699 Representation representation, bool transition_to_field) { |
701 DCHECK(!index.is_double() || representation.IsDouble()); | 700 DCHECK(!index.is_double() || representation.IsDouble()); |
702 int offset = index.offset(); | 701 int offset = index.offset(); |
703 HObjectAccess access = | 702 HObjectAccess access = |
704 index.is_inobject() | 703 index.is_inobject() |
705 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) | 704 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) |
706 : HObjectAccess::ForBackingStoreOffset(offset, representation); | 705 : HObjectAccess::ForBackingStoreOffset(offset, representation); |
707 | 706 |
708 if (representation.IsDouble()) { | 707 if (representation.IsDouble()) { |
709 if (!FLAG_unbox_double_fields || !index.is_inobject()) { | 708 HObjectAccess heap_number_access = |
710 HObjectAccess heap_number_access = | 709 access.WithRepresentation(Representation::Tagged()); |
711 access.WithRepresentation(Representation::Tagged()); | 710 if (transition_to_field) { |
712 if (transition_to_field) { | 711 // The store requires a mutable HeapNumber to be allocated. |
713 // The store requires a mutable HeapNumber to be allocated. | 712 NoObservableSideEffectsScope no_side_effects(this); |
714 NoObservableSideEffectsScope no_side_effects(this); | 713 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); |
715 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); | |
716 | 714 |
717 // TODO(hpayer): Allocation site pretenuring support. | 715 // TODO(hpayer): Allocation site pretenuring support. |
718 HInstruction* heap_number = | 716 HInstruction* heap_number = |
719 Add<HAllocate>(heap_number_size, HType::HeapObject(), NOT_TENURED, | 717 Add<HAllocate>(heap_number_size, HType::HeapObject(), NOT_TENURED, |
720 MUTABLE_HEAP_NUMBER_TYPE); | 718 MUTABLE_HEAP_NUMBER_TYPE); |
721 AddStoreMapConstant(heap_number, | 719 AddStoreMapConstant(heap_number, |
722 isolate()->factory()->mutable_heap_number_map()); | 720 isolate()->factory()->mutable_heap_number_map()); |
723 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), | 721 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), |
724 value); | 722 value); |
725 // Store the new mutable heap number into the object. | 723 // Store the new mutable heap number into the object. |
726 access = heap_number_access; | 724 access = heap_number_access; |
727 value = heap_number; | 725 value = heap_number; |
728 } else { | 726 } else { |
729 // Load the heap number. | 727 // Load the heap number. |
730 object = Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), | 728 object = Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), |
731 heap_number_access); | 729 heap_number_access); |
732 // Store the double value into it. | 730 // Store the double value into it. |
733 access = HObjectAccess::ForHeapNumberValue(); | 731 access = HObjectAccess::ForHeapNumberValue(); |
734 } | |
735 } | 732 } |
736 } else if (representation.IsHeapObject()) { | 733 } else if (representation.IsHeapObject()) { |
737 BuildCheckHeapObject(value); | 734 BuildCheckHeapObject(value); |
738 } | 735 } |
739 | 736 |
740 Add<HStoreNamedField>(object, access, value, INITIALIZING_STORE); | 737 Add<HStoreNamedField>(object, access, value, INITIALIZING_STORE); |
741 } | 738 } |
742 | 739 |
743 | 740 |
744 template <> | 741 template <> |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2007 | 2004 |
2008 // Probe the stub cache. | 2005 // Probe the stub cache. |
2009 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 2006 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
2010 Code::ComputeHandlerFlags(Code::LOAD_IC)); | 2007 Code::ComputeHandlerFlags(Code::LOAD_IC)); |
2011 Add<HTailCallThroughMegamorphicCache>(receiver, name, flags); | 2008 Add<HTailCallThroughMegamorphicCache>(receiver, name, flags); |
2012 | 2009 |
2013 // We never continue. | 2010 // We never continue. |
2014 return graph()->GetConstant0(); | 2011 return graph()->GetConstant0(); |
2015 } | 2012 } |
2016 } } // namespace v8::internal | 2013 } } // namespace v8::internal |
OLD | NEW |