Index: src/code-stubs-hydrogen.cc |
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
index 3b5002b7ff6a97adc5ddb62c76a1b13a40f14e08..800a09dd22bf3e446fb8c0203e6dab92674ccacd 100644 |
--- a/src/code-stubs-hydrogen.cc |
+++ b/src/code-stubs-hydrogen.cc |
@@ -2043,8 +2043,13 @@ void CodeStubGraphBuilderBase::HandleArrayCases(HValue* array, HValue* receiver, |
HValue* receiver_map = AddLoadMap(receiver, nullptr); |
HValue* start = |
keyed_load ? graph()->GetConstant1() : graph()->GetConstant0(); |
- HValue* array_map = Add<HLoadKeyed>(array, start, nullptr, FAST_ELEMENTS, |
+ HValue* weak_cell = Add<HLoadKeyed>(array, start, nullptr, FAST_ELEMENTS, |
ALLOW_RETURN_HOLE); |
+ // Load the weak cell value. It may be Smi(0), or a map. Compare nonetheless |
+ // against the receiver_map. |
+ HValue* array_map = Add<HLoadNamedField>(weak_cell, nullptr, |
+ HObjectAccess::ForWeakCellValue()); |
+ |
IfBuilder if_correct_map(this); |
if_correct_map.If<HCompareObjectEqAndBranch>(receiver_map, array_map); |
if_correct_map.Then(); |
@@ -2059,8 +2064,10 @@ void CodeStubGraphBuilderBase::HandleArrayCases(HValue* array, HValue* receiver, |
start = keyed_load ? constant_three : constant_two; |
HValue* key = builder.BeginBody(start, length, Token::LT); |
{ |
- HValue* array_map = Add<HLoadKeyed>(array, key, nullptr, FAST_ELEMENTS, |
+ HValue* weak_cell = Add<HLoadKeyed>(array, key, nullptr, FAST_ELEMENTS, |
ALLOW_RETURN_HOLE); |
+ HValue* array_map = Add<HLoadNamedField>( |
+ weak_cell, nullptr, HObjectAccess::ForWeakCellValue()); |
IfBuilder if_correct_poly_map(this); |
if_correct_poly_map.If<HCompareObjectEqAndBranch>(receiver_map, |
array_map); |