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 5763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5774 field_access.WithRepresentation(Representation::Tagged()); | 5774 field_access.WithRepresentation(Representation::Tagged()); |
5775 if (transition_to_field) { | 5775 if (transition_to_field) { |
5776 // The store requires a mutable HeapNumber to be allocated. | 5776 // The store requires a mutable HeapNumber to be allocated. |
5777 NoObservableSideEffectsScope no_side_effects(this); | 5777 NoObservableSideEffectsScope no_side_effects(this); |
5778 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); | 5778 HInstruction* heap_number_size = Add<HConstant>(HeapNumber::kSize); |
5779 | 5779 |
5780 // TODO(hpayer): Allocation site pretenuring support. | 5780 // TODO(hpayer): Allocation site pretenuring support. |
5781 HInstruction* heap_number = Add<HAllocate>(heap_number_size, | 5781 HInstruction* heap_number = Add<HAllocate>(heap_number_size, |
5782 HType::HeapObject(), | 5782 HType::HeapObject(), |
5783 NOT_TENURED, | 5783 NOT_TENURED, |
5784 MUTABLE_HEAP_NUMBER_TYPE); | 5784 HEAP_NUMBER_TYPE); |
5785 AddStoreMapConstant( | 5785 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); |
5786 heap_number, isolate()->factory()->mutable_heap_number_map()); | |
5787 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), | 5786 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), |
5788 value); | 5787 value); |
5789 instr = New<HStoreNamedField>(checked_object->ActualValue(), | 5788 instr = New<HStoreNamedField>(checked_object->ActualValue(), |
5790 heap_number_access, | 5789 heap_number_access, |
5791 heap_number); | 5790 heap_number); |
5792 } else { | 5791 } else { |
5793 // Already holds a HeapNumber; load the box and write its value field. | 5792 // Already holds a HeapNumber; load the box and write its value field. |
5794 HInstruction* heap_number = Add<HLoadNamedField>( | 5793 HInstruction* heap_number = Add<HLoadNamedField>( |
5795 checked_object, static_cast<HValue*>(NULL), heap_number_access); | 5794 checked_object, static_cast<HValue*>(NULL), heap_number_access); |
5796 instr = New<HStoreNamedField>(heap_number, | 5795 instr = New<HStoreNamedField>(heap_number, |
(...skipping 5150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10947 | 10946 |
10948 if (representation.IsDouble()) { | 10947 if (representation.IsDouble()) { |
10949 // Allocate a HeapNumber box and store the value into it. | 10948 // Allocate a HeapNumber box and store the value into it. |
10950 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); | 10949 HValue* heap_number_constant = Add<HConstant>(HeapNumber::kSize); |
10951 // This heap number alloc does not have a corresponding | 10950 // This heap number alloc does not have a corresponding |
10952 // AllocationSite. That is okay because | 10951 // AllocationSite. That is okay because |
10953 // 1) it's a child object of another object with a valid allocation site | 10952 // 1) it's a child object of another object with a valid allocation site |
10954 // 2) we can just use the mode of the parent object for pretenuring | 10953 // 2) we can just use the mode of the parent object for pretenuring |
10955 HInstruction* double_box = | 10954 HInstruction* double_box = |
10956 Add<HAllocate>(heap_number_constant, HType::HeapObject(), | 10955 Add<HAllocate>(heap_number_constant, HType::HeapObject(), |
10957 pretenure_flag, MUTABLE_HEAP_NUMBER_TYPE); | 10956 pretenure_flag, HEAP_NUMBER_TYPE); |
10958 AddStoreMapConstant(double_box, | 10957 AddStoreMapConstant(double_box, |
10959 isolate()->factory()->mutable_heap_number_map()); | 10958 isolate()->factory()->heap_number_map()); |
10960 // Unwrap the mutable heap number from the boilerplate. | 10959 Add<HStoreNamedField>(double_box, HObjectAccess::ForHeapNumberValue(), |
10961 HValue* double_value = | 10960 Add<HConstant>(value)); |
10962 Add<HConstant>(Handle<HeapNumber>::cast(value)->value()); | |
10963 Add<HStoreNamedField>( | |
10964 double_box, HObjectAccess::ForHeapNumberValue(), double_value); | |
10965 value_instruction = double_box; | 10961 value_instruction = double_box; |
10966 } else if (representation.IsSmi()) { | 10962 } else if (representation.IsSmi()) { |
10967 value_instruction = value->IsUninitialized() | 10963 value_instruction = value->IsUninitialized() |
10968 ? graph()->GetConstant0() | 10964 ? graph()->GetConstant0() |
10969 : Add<HConstant>(value); | 10965 : Add<HConstant>(value); |
10970 // Ensure that value is stored as smi. | 10966 // Ensure that value is stored as smi. |
10971 access = access.WithRepresentation(representation); | 10967 access = access.WithRepresentation(representation); |
10972 } else { | 10968 } else { |
10973 value_instruction = Add<HConstant>(value); | 10969 value_instruction = Add<HConstant>(value); |
10974 } | 10970 } |
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12377 if (ShouldProduceTraceOutput()) { | 12373 if (ShouldProduceTraceOutput()) { |
12378 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12374 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12379 } | 12375 } |
12380 | 12376 |
12381 #ifdef DEBUG | 12377 #ifdef DEBUG |
12382 graph_->Verify(false); // No full verify. | 12378 graph_->Verify(false); // No full verify. |
12383 #endif | 12379 #endif |
12384 } | 12380 } |
12385 | 12381 |
12386 } } // namespace v8::internal | 12382 } } // namespace v8::internal |
OLD | NEW |