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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 9861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9872 | 9872 |
9873 | 9873 |
9874 HValue* HGraphBuilder::BuildAllocateEmptyArrayBuffer(HValue* byte_length) { | 9874 HValue* HGraphBuilder::BuildAllocateEmptyArrayBuffer(HValue* byte_length) { |
9875 // We HForceRepresentation here to avoid allocations during an *-to-tagged | 9875 // We HForceRepresentation here to avoid allocations during an *-to-tagged |
9876 // HChange that could cause GC while the array buffer object is not fully | 9876 // HChange that could cause GC while the array buffer object is not fully |
9877 // initialized. | 9877 // initialized. |
9878 HObjectAccess byte_length_access(HObjectAccess::ForJSArrayBufferByteLength()); | 9878 HObjectAccess byte_length_access(HObjectAccess::ForJSArrayBufferByteLength()); |
9879 byte_length = AddUncasted<HForceRepresentation>( | 9879 byte_length = AddUncasted<HForceRepresentation>( |
9880 byte_length, byte_length_access.representation()); | 9880 byte_length, byte_length_access.representation()); |
9881 HAllocate* result = | 9881 HAllocate* result = |
9882 BuildAllocate(Add<HConstant>(JSArrayBuffer::kSizeWithInternalFields), | 9882 BuildAllocate(Add<HConstant>(JSArrayBuffer::kSizeWithEmbedderFields), |
9883 HType::JSObject(), JS_ARRAY_BUFFER_TYPE, HAllocationMode()); | 9883 HType::JSObject(), JS_ARRAY_BUFFER_TYPE, HAllocationMode()); |
9884 | 9884 |
9885 HValue* native_context = BuildGetNativeContext(); | 9885 HValue* native_context = BuildGetNativeContext(); |
9886 Add<HStoreNamedField>( | 9886 Add<HStoreNamedField>( |
9887 result, HObjectAccess::ForMap(), | 9887 result, HObjectAccess::ForMap(), |
9888 Add<HLoadNamedField>( | 9888 Add<HLoadNamedField>( |
9889 native_context, nullptr, | 9889 native_context, nullptr, |
9890 HObjectAccess::ForContextSlot(Context::ARRAY_BUFFER_MAP_INDEX))); | 9890 HObjectAccess::ForContextSlot(Context::ARRAY_BUFFER_MAP_INDEX))); |
9891 | 9891 |
9892 HConstant* empty_fixed_array = | 9892 HConstant* empty_fixed_array = |
9893 Add<HConstant>(isolate()->factory()->empty_fixed_array()); | 9893 Add<HConstant>(isolate()->factory()->empty_fixed_array()); |
9894 Add<HStoreNamedField>( | 9894 Add<HStoreNamedField>( |
9895 result, HObjectAccess::ForJSArrayOffset(JSArray::kPropertiesOffset), | 9895 result, HObjectAccess::ForJSArrayOffset(JSArray::kPropertiesOffset), |
9896 empty_fixed_array); | 9896 empty_fixed_array); |
9897 Add<HStoreNamedField>( | 9897 Add<HStoreNamedField>( |
9898 result, HObjectAccess::ForJSArrayOffset(JSArray::kElementsOffset), | 9898 result, HObjectAccess::ForJSArrayOffset(JSArray::kElementsOffset), |
9899 empty_fixed_array); | 9899 empty_fixed_array); |
9900 Add<HStoreNamedField>( | 9900 Add<HStoreNamedField>( |
9901 result, HObjectAccess::ForJSArrayBufferBackingStore().WithRepresentation( | 9901 result, HObjectAccess::ForJSArrayBufferBackingStore().WithRepresentation( |
9902 Representation::Smi()), | 9902 Representation::Smi()), |
9903 graph()->GetConstant0()); | 9903 graph()->GetConstant0()); |
9904 Add<HStoreNamedField>(result, byte_length_access, byte_length); | 9904 Add<HStoreNamedField>(result, byte_length_access, byte_length); |
9905 Add<HStoreNamedField>(result, HObjectAccess::ForJSArrayBufferBitFieldSlot(), | 9905 Add<HStoreNamedField>(result, HObjectAccess::ForJSArrayBufferBitFieldSlot(), |
9906 graph()->GetConstant0()); | 9906 graph()->GetConstant0()); |
9907 Add<HStoreNamedField>( | 9907 Add<HStoreNamedField>( |
9908 result, HObjectAccess::ForJSArrayBufferBitField(), | 9908 result, HObjectAccess::ForJSArrayBufferBitField(), |
9909 Add<HConstant>((1 << JSArrayBuffer::IsExternal::kShift) | | 9909 Add<HConstant>((1 << JSArrayBuffer::IsExternal::kShift) | |
9910 (1 << JSArrayBuffer::IsNeuterable::kShift))); | 9910 (1 << JSArrayBuffer::IsNeuterable::kShift))); |
9911 | 9911 |
9912 for (int field = 0; field < v8::ArrayBuffer::kInternalFieldCount; ++field) { | 9912 for (int field = 0; field < v8::ArrayBuffer::kEmbedderFieldCount; ++field) { |
9913 Add<HStoreNamedField>( | 9913 Add<HStoreNamedField>( |
9914 result, | 9914 result, |
9915 HObjectAccess::ForObservableJSObjectOffset( | 9915 HObjectAccess::ForObservableJSObjectOffset( |
9916 JSArrayBuffer::kSize + field * kPointerSize, Representation::Smi()), | 9916 JSArrayBuffer::kSize + field * kPointerSize, Representation::Smi()), |
9917 graph()->GetConstant0()); | 9917 graph()->GetConstant0()); |
9918 } | 9918 } |
9919 | 9919 |
9920 return result; | 9920 return result; |
9921 } | 9921 } |
9922 | 9922 |
9923 | 9923 |
9924 template <class ViewClass> | 9924 template <class ViewClass> |
9925 void HGraphBuilder::BuildArrayBufferViewInitialization( | 9925 void HGraphBuilder::BuildArrayBufferViewInitialization( |
9926 HValue* obj, | 9926 HValue* obj, |
9927 HValue* buffer, | 9927 HValue* buffer, |
9928 HValue* byte_offset, | 9928 HValue* byte_offset, |
9929 HValue* byte_length) { | 9929 HValue* byte_length) { |
9930 | |
9931 for (int offset = ViewClass::kSize; | 9930 for (int offset = ViewClass::kSize; |
9932 offset < ViewClass::kSizeWithInternalFields; | 9931 offset < ViewClass::kSizeWithEmbedderFields; offset += kPointerSize) { |
9933 offset += kPointerSize) { | |
9934 Add<HStoreNamedField>(obj, | 9932 Add<HStoreNamedField>(obj, |
9935 HObjectAccess::ForObservableJSObjectOffset(offset), | 9933 HObjectAccess::ForObservableJSObjectOffset(offset), |
9936 graph()->GetConstant0()); | 9934 graph()->GetConstant0()); |
9937 } | 9935 } |
9938 | 9936 |
9939 Add<HStoreNamedField>( | 9937 Add<HStoreNamedField>( |
9940 obj, | 9938 obj, |
9941 HObjectAccess::ForJSArrayBufferViewByteOffset(), | 9939 HObjectAccess::ForJSArrayBufferViewByteOffset(), |
9942 byte_offset); | 9940 byte_offset); |
9943 Add<HStoreNamedField>( | 9941 Add<HStoreNamedField>( |
(...skipping 3111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13055 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13053 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13056 } | 13054 } |
13057 | 13055 |
13058 #ifdef DEBUG | 13056 #ifdef DEBUG |
13059 graph_->Verify(false); // No full verify. | 13057 graph_->Verify(false); // No full verify. |
13060 #endif | 13058 #endif |
13061 } | 13059 } |
13062 | 13060 |
13063 } // namespace internal | 13061 } // namespace internal |
13064 } // namespace v8 | 13062 } // namespace v8 |
OLD | NEW |