Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 0019b6d578c803af9f19376d253cfc8945165ef6..6f63b76ba97693cdea6946ec98e6004a191f7b37 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -9722,6 +9722,12 @@ void HOptimizedGraphBuilder::BuildInitializeInobjectProperties( |
HValue* HGraphBuilder::BuildAllocateEmptyArrayBuffer(HValue* byte_length) { |
+ // We HForceRepresentation here to avoid allocations during an *-to-tagged |
+ // HChange that could cause GC while the array buffer object is not fully |
+ // initialized. |
+ HObjectAccess byte_length_access(HObjectAccess::ForJSArrayBufferByteLength()); |
+ byte_length = AddUncasted<HForceRepresentation>( |
+ byte_length, byte_length_access.representation()); |
HAllocate* result = |
BuildAllocate(Add<HConstant>(JSArrayBuffer::kSizeWithInternalFields), |
HType::JSObject(), JS_ARRAY_BUFFER_TYPE, HAllocationMode()); |
@@ -9749,8 +9755,7 @@ HValue* HGraphBuilder::BuildAllocateEmptyArrayBuffer(HValue* byte_length) { |
result, HObjectAccess::ForJSArrayBufferBackingStore().WithRepresentation( |
Representation::Smi()), |
graph()->GetConstant0()); |
- Add<HStoreNamedField>(result, HObjectAccess::ForJSArrayBufferByteLength(), |
- byte_length); |
+ Add<HStoreNamedField>(result, byte_length_access, byte_length); |
Add<HStoreNamedField>(result, HObjectAccess::ForJSArrayBufferBitFieldSlot(), |
graph()->GetConstant0()); |
Add<HStoreNamedField>( |