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