OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 5781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5792 Handle<JSObject>::cast(object)->Lookup(info->name(), &lookup); | 5792 Handle<JSObject>::cast(object)->Lookup(info->name(), &lookup); |
5793 Handle<Object> value(lookup.GetLazyValue(), isolate()); | 5793 Handle<Object> value(lookup.GetLazyValue(), isolate()); |
5794 | 5794 |
5795 if (!value->IsTheHole()) { | 5795 if (!value->IsTheHole()) { |
5796 return New<HConstant>(value); | 5796 return New<HConstant>(value); |
5797 } | 5797 } |
5798 } | 5798 } |
5799 } | 5799 } |
5800 | 5800 |
5801 HObjectAccess access = info->access(); | 5801 HObjectAccess access = info->access(); |
5802 if (access.representation().IsDouble()) { | 5802 if (access.representation().IsDouble() && |
| 5803 (!FLAG_unbox_double_fields || !access.IsInobject())) { |
5803 // Load the heap number. | 5804 // Load the heap number. |
5804 checked_object = Add<HLoadNamedField>( | 5805 checked_object = Add<HLoadNamedField>( |
5805 checked_object, static_cast<HValue*>(NULL), | 5806 checked_object, static_cast<HValue*>(NULL), |
5806 access.WithRepresentation(Representation::Tagged())); | 5807 access.WithRepresentation(Representation::Tagged())); |
5807 // Load the double value from it. | 5808 // Load the double value from it. |
5808 access = HObjectAccess::ForHeapNumberValue(); | 5809 access = HObjectAccess::ForHeapNumberValue(); |
5809 } | 5810 } |
5810 | 5811 |
5811 SmallMapList* map_list = info->field_maps(); | 5812 SmallMapList* map_list = info->field_maps(); |
5812 if (map_list->length() == 0) { | 5813 if (map_list->length() == 0) { |
(...skipping 11 matching lines...) Expand all Loading... |
5824 | 5825 |
5825 HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField( | 5826 HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField( |
5826 PropertyAccessInfo* info, | 5827 PropertyAccessInfo* info, |
5827 HValue* checked_object, | 5828 HValue* checked_object, |
5828 HValue* value) { | 5829 HValue* value) { |
5829 bool transition_to_field = info->lookup()->IsTransition(); | 5830 bool transition_to_field = info->lookup()->IsTransition(); |
5830 // TODO(verwaest): Move this logic into PropertyAccessInfo. | 5831 // TODO(verwaest): Move this logic into PropertyAccessInfo. |
5831 HObjectAccess field_access = info->access(); | 5832 HObjectAccess field_access = info->access(); |
5832 | 5833 |
5833 HStoreNamedField *instr; | 5834 HStoreNamedField *instr; |
5834 if (field_access.representation().IsDouble()) { | 5835 if (field_access.representation().IsDouble() && |
| 5836 (!FLAG_unbox_double_fields || !field_access.IsInobject())) { |
5835 HObjectAccess heap_number_access = | 5837 HObjectAccess heap_number_access = |
5836 field_access.WithRepresentation(Representation::Tagged()); | 5838 field_access.WithRepresentation(Representation::Tagged()); |
5837 if (transition_to_field) { | 5839 if (transition_to_field) { |
5838 // The store requires a mutable HeapNumber to be allocated. | 5840 // The store requires a mutable HeapNumber to be allocated. |
5839 NoObservableSideEffectsScope no_side_effects(this); | 5841 NoObservableSideEffectsScope no_side_effects(this); |
5840 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); | 5842 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); |
5841 | 5843 |
5842 // TODO(hpayer): Allocation site pretenuring support. | 5844 // TODO(hpayer): Allocation site pretenuring support. |
5843 HInstruction* heap_number = Add<HAllocate>(heap_number_size, | 5845 HInstruction* heap_number = Add<HAllocate>(heap_number_size, |
5844 HType::HeapObject(), | 5846 HType::HeapObject(), |
(...skipping 5152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10997 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 10999 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
10998 Handle<AllocationSite> current_site = site_context->EnterNewScope(); | 11000 Handle<AllocationSite> current_site = site_context->EnterNewScope(); |
10999 HInstruction* result = | 11001 HInstruction* result = |
11000 BuildFastLiteral(value_object, site_context); | 11002 BuildFastLiteral(value_object, site_context); |
11001 site_context->ExitScope(current_site, value_object); | 11003 site_context->ExitScope(current_site, value_object); |
11002 Add<HStoreNamedField>(object, access, result); | 11004 Add<HStoreNamedField>(object, access, result); |
11003 } else { | 11005 } else { |
11004 Representation representation = details.representation(); | 11006 Representation representation = details.representation(); |
11005 HInstruction* value_instruction; | 11007 HInstruction* value_instruction; |
11006 | 11008 |
11007 if (representation.IsDouble()) { | 11009 if (representation.IsDouble() && |
| 11010 (!FLAG_unbox_double_fields || !access.IsInobject())) { |
11008 // Allocate a HeapNumber box and store the value into it. | 11011 // Allocate a HeapNumber box and store the value into it. |
11009 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); | 11012 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); |
11010 // This heap number alloc does not have a corresponding | 11013 // This heap number alloc does not have a corresponding |
11011 // AllocationSite. That is okay because | 11014 // AllocationSite. That is okay because |
11012 // 1) it's a child object of another object with a valid allocation site | 11015 // 1) it's a child object of another object with a valid allocation site |
11013 // 2) we can just use the mode of the parent object for pretenuring | 11016 // 2) we can just use the mode of the parent object for pretenuring |
11014 HInstruction* double_box = | 11017 HInstruction* double_box = |
11015 Add<HAllocate>(heap_number_constant, HType::HeapObject(), | 11018 Add<HAllocate>(heap_number_constant, HType::HeapObject(), |
11016 pretenure_flag, MUTABLE_HEAP_NUMBER_TYPE); | 11019 pretenure_flag, MUTABLE_HEAP_NUMBER_TYPE); |
11017 AddStoreMapConstant(double_box, | 11020 AddStoreMapConstant(double_box, |
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12424 if (ShouldProduceTraceOutput()) { | 12427 if (ShouldProduceTraceOutput()) { |
12425 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12428 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12426 } | 12429 } |
12427 | 12430 |
12428 #ifdef DEBUG | 12431 #ifdef DEBUG |
12429 graph_->Verify(false); // No full verify. | 12432 graph_->Verify(false); // No full verify. |
12430 #endif | 12433 #endif |
12431 } | 12434 } |
12432 | 12435 |
12433 } } // namespace v8::internal | 12436 } } // namespace v8::internal |
OLD | NEW |