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 <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 9871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9882 ExternalArrayType array_type, | 9882 ExternalArrayType array_type, |
9883 bool is_zero_byte_offset, | 9883 bool is_zero_byte_offset, |
9884 HValue* buffer, HValue* byte_offset, HValue* length) { | 9884 HValue* buffer, HValue* byte_offset, HValue* length) { |
9885 Handle<Map> external_array_map( | 9885 Handle<Map> external_array_map( |
9886 isolate()->heap()->MapForExternalArrayType(array_type)); | 9886 isolate()->heap()->MapForExternalArrayType(array_type)); |
9887 | 9887 |
9888 // The HForceRepresentation is to prevent possible deopt on int-smi | 9888 // The HForceRepresentation is to prevent possible deopt on int-smi |
9889 // conversion after allocation but before the new object fields are set. | 9889 // conversion after allocation but before the new object fields are set. |
9890 length = AddUncasted<HForceRepresentation>(length, Representation::Smi()); | 9890 length = AddUncasted<HForceRepresentation>(length, Representation::Smi()); |
9891 HValue* elements = | 9891 HValue* elements = |
9892 Add<HAllocate>( | 9892 Add<HAllocate>(Add<HConstant>(ExternalArray::kSize), HType::HeapObject(), |
9893 Add<HConstant>(ExternalArray::kAlignedSize), | 9893 NOT_TENURED, external_array_map->instance_type()); |
9894 HType::HeapObject(), | |
9895 NOT_TENURED, | |
9896 external_array_map->instance_type()); | |
9897 | 9894 |
9898 AddStoreMapConstant(elements, external_array_map); | 9895 AddStoreMapConstant(elements, external_array_map); |
9899 Add<HStoreNamedField>(elements, | 9896 Add<HStoreNamedField>(elements, |
9900 HObjectAccess::ForFixedArrayLength(), length); | 9897 HObjectAccess::ForFixedArrayLength(), length); |
9901 | 9898 |
9902 HValue* backing_store = Add<HLoadNamedField>( | 9899 HValue* backing_store = Add<HLoadNamedField>( |
9903 buffer, nullptr, HObjectAccess::ForJSArrayBufferBackingStore()); | 9900 buffer, nullptr, HObjectAccess::ForJSArrayBufferBackingStore()); |
9904 | 9901 |
9905 HValue* typed_array_start; | 9902 HValue* typed_array_start; |
9906 if (is_zero_byte_offset) { | 9903 if (is_zero_byte_offset) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9939 total_size = AddUncasted<HAdd>(byte_length, | 9936 total_size = AddUncasted<HAdd>(byte_length, |
9940 Add<HConstant>(FixedTypedArrayBase::kHeaderSize)); | 9937 Add<HConstant>(FixedTypedArrayBase::kHeaderSize)); |
9941 total_size->ClearFlag(HValue::kCanOverflow); | 9938 total_size->ClearFlag(HValue::kCanOverflow); |
9942 } | 9939 } |
9943 | 9940 |
9944 // The HForceRepresentation is to prevent possible deopt on int-smi | 9941 // The HForceRepresentation is to prevent possible deopt on int-smi |
9945 // conversion after allocation but before the new object fields are set. | 9942 // conversion after allocation but before the new object fields are set. |
9946 length = AddUncasted<HForceRepresentation>(length, Representation::Smi()); | 9943 length = AddUncasted<HForceRepresentation>(length, Representation::Smi()); |
9947 Handle<Map> fixed_typed_array_map( | 9944 Handle<Map> fixed_typed_array_map( |
9948 isolate()->heap()->MapForFixedTypedArray(array_type)); | 9945 isolate()->heap()->MapForFixedTypedArray(array_type)); |
9949 HValue* elements = | 9946 HAllocate* elements = |
9950 Add<HAllocate>(total_size, HType::HeapObject(), | 9947 Add<HAllocate>(total_size, HType::HeapObject(), NOT_TENURED, |
9951 NOT_TENURED, fixed_typed_array_map->instance_type()); | 9948 fixed_typed_array_map->instance_type()); |
| 9949 |
| 9950 #ifndef V8_HOST_ARCH_64_BIT |
| 9951 if (array_type == kExternalFloat64Array) { |
| 9952 elements->MakeDoubleAligned(); |
| 9953 } |
| 9954 #endif |
| 9955 |
9952 AddStoreMapConstant(elements, fixed_typed_array_map); | 9956 AddStoreMapConstant(elements, fixed_typed_array_map); |
9953 | 9957 |
9954 Add<HStoreNamedField>(elements, | 9958 Add<HStoreNamedField>(elements, |
9955 HObjectAccess::ForFixedArrayLength(), | 9959 HObjectAccess::ForFixedArrayLength(), |
9956 length); | 9960 length); |
9957 | 9961 |
9958 HValue* filler = Add<HConstant>(static_cast<int32_t>(0)); | 9962 HValue* filler = Add<HConstant>(static_cast<int32_t>(0)); |
9959 | 9963 |
9960 { | 9964 { |
9961 LoopBuilder builder(this, context(), LoopBuilder::kPostIncrement); | 9965 LoopBuilder builder(this, context(), LoopBuilder::kPostIncrement); |
(...skipping 3212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13174 if (ShouldProduceTraceOutput()) { | 13178 if (ShouldProduceTraceOutput()) { |
13175 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13179 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13176 } | 13180 } |
13177 | 13181 |
13178 #ifdef DEBUG | 13182 #ifdef DEBUG |
13179 graph_->Verify(false); // No full verify. | 13183 graph_->Verify(false); // No full verify. |
13180 #endif | 13184 #endif |
13181 } | 13185 } |
13182 | 13186 |
13183 } } // namespace v8::internal | 13187 } } // namespace v8::internal |
OLD | NEW |