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 9704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9715 int property_offset = initial_map->GetInObjectPropertyOffset(i); | 9715 int property_offset = initial_map->GetInObjectPropertyOffset(i); |
9716 Add<HStoreNamedField>(receiver, HObjectAccess::ForMapAndOffset( | 9716 Add<HStoreNamedField>(receiver, HObjectAccess::ForMapAndOffset( |
9717 initial_map, property_offset), | 9717 initial_map, property_offset), |
9718 undefined); | 9718 undefined); |
9719 } | 9719 } |
9720 } | 9720 } |
9721 } | 9721 } |
9722 | 9722 |
9723 | 9723 |
9724 HValue* HGraphBuilder::BuildAllocateEmptyArrayBuffer(HValue* byte_length) { | 9724 HValue* HGraphBuilder::BuildAllocateEmptyArrayBuffer(HValue* byte_length) { |
| 9725 // We HForceRepresentation here to avoid allocations during an *-to-tagged |
| 9726 // HChange that could cause GC while the array buffer object is not fully |
| 9727 // initialized. |
| 9728 HObjectAccess byte_length_access(HObjectAccess::ForJSArrayBufferByteLength()); |
| 9729 byte_length = AddUncasted<HForceRepresentation>( |
| 9730 byte_length, byte_length_access.representation()); |
9725 HAllocate* result = | 9731 HAllocate* result = |
9726 BuildAllocate(Add<HConstant>(JSArrayBuffer::kSizeWithInternalFields), | 9732 BuildAllocate(Add<HConstant>(JSArrayBuffer::kSizeWithInternalFields), |
9727 HType::JSObject(), JS_ARRAY_BUFFER_TYPE, HAllocationMode()); | 9733 HType::JSObject(), JS_ARRAY_BUFFER_TYPE, HAllocationMode()); |
9728 | 9734 |
9729 HValue* global_object = Add<HLoadNamedField>( | 9735 HValue* global_object = Add<HLoadNamedField>( |
9730 context(), nullptr, | 9736 context(), nullptr, |
9731 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); | 9737 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); |
9732 HValue* native_context = Add<HLoadNamedField>( | 9738 HValue* native_context = Add<HLoadNamedField>( |
9733 global_object, nullptr, HObjectAccess::ForGlobalObjectNativeContext()); | 9739 global_object, nullptr, HObjectAccess::ForGlobalObjectNativeContext()); |
9734 Add<HStoreNamedField>( | 9740 Add<HStoreNamedField>( |
9735 result, HObjectAccess::ForMap(), | 9741 result, HObjectAccess::ForMap(), |
9736 Add<HLoadNamedField>( | 9742 Add<HLoadNamedField>( |
9737 native_context, nullptr, | 9743 native_context, nullptr, |
9738 HObjectAccess::ForContextSlot(Context::ARRAY_BUFFER_MAP_INDEX))); | 9744 HObjectAccess::ForContextSlot(Context::ARRAY_BUFFER_MAP_INDEX))); |
9739 | 9745 |
9740 HConstant* empty_fixed_array = | 9746 HConstant* empty_fixed_array = |
9741 Add<HConstant>(isolate()->factory()->empty_fixed_array()); | 9747 Add<HConstant>(isolate()->factory()->empty_fixed_array()); |
9742 Add<HStoreNamedField>( | 9748 Add<HStoreNamedField>( |
9743 result, HObjectAccess::ForJSArrayOffset(JSArray::kPropertiesOffset), | 9749 result, HObjectAccess::ForJSArrayOffset(JSArray::kPropertiesOffset), |
9744 empty_fixed_array); | 9750 empty_fixed_array); |
9745 Add<HStoreNamedField>( | 9751 Add<HStoreNamedField>( |
9746 result, HObjectAccess::ForJSArrayOffset(JSArray::kElementsOffset), | 9752 result, HObjectAccess::ForJSArrayOffset(JSArray::kElementsOffset), |
9747 empty_fixed_array); | 9753 empty_fixed_array); |
9748 Add<HStoreNamedField>( | 9754 Add<HStoreNamedField>( |
9749 result, HObjectAccess::ForJSArrayBufferBackingStore().WithRepresentation( | 9755 result, HObjectAccess::ForJSArrayBufferBackingStore().WithRepresentation( |
9750 Representation::Smi()), | 9756 Representation::Smi()), |
9751 graph()->GetConstant0()); | 9757 graph()->GetConstant0()); |
9752 Add<HStoreNamedField>(result, HObjectAccess::ForJSArrayBufferByteLength(), | 9758 Add<HStoreNamedField>(result, byte_length_access, byte_length); |
9753 byte_length); | |
9754 Add<HStoreNamedField>(result, HObjectAccess::ForJSArrayBufferBitFieldSlot(), | 9759 Add<HStoreNamedField>(result, HObjectAccess::ForJSArrayBufferBitFieldSlot(), |
9755 graph()->GetConstant0()); | 9760 graph()->GetConstant0()); |
9756 Add<HStoreNamedField>( | 9761 Add<HStoreNamedField>( |
9757 result, HObjectAccess::ForJSArrayBufferBitField(), | 9762 result, HObjectAccess::ForJSArrayBufferBitField(), |
9758 Add<HConstant>((1 << JSArrayBuffer::IsExternal::kShift) | | 9763 Add<HConstant>((1 << JSArrayBuffer::IsExternal::kShift) | |
9759 (1 << JSArrayBuffer::IsNeuterable::kShift))); | 9764 (1 << JSArrayBuffer::IsNeuterable::kShift))); |
9760 | 9765 |
9761 for (int field = 0; field < v8::ArrayBuffer::kInternalFieldCount; ++field) { | 9766 for (int field = 0; field < v8::ArrayBuffer::kInternalFieldCount; ++field) { |
9762 Add<HStoreNamedField>( | 9767 Add<HStoreNamedField>( |
9763 result, | 9768 result, |
(...skipping 3440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13204 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13209 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13205 } | 13210 } |
13206 | 13211 |
13207 #ifdef DEBUG | 13212 #ifdef DEBUG |
13208 graph_->Verify(false); // No full verify. | 13213 graph_->Verify(false); // No full verify. |
13209 #endif | 13214 #endif |
13210 } | 13215 } |
13211 | 13216 |
13212 } // namespace internal | 13217 } // namespace internal |
13213 } // namespace v8 | 13218 } // namespace v8 |
OLD | NEW |