Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 756c6ee6d4b3e967190bd4db0bc8020f4bbd8651..2543fdc8d0c30529fc0be44fb3f91a5eea3b8df8 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -2465,19 +2465,21 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess( |
length_checker.End(); |
return result; |
} else { |
+ HValue* neuter_checked_object = checked_object; |
if (IsExternalArrayElementsKind(elements_kind)) { |
HInstruction* buffer = |
Add<HLoadNamedField>(checked_object, nullptr, |
HObjectAccess::ForJSArrayBufferViewBuffer()); |
HInstruction* buffer_length = Add<HLoadNamedField>( |
buffer, nullptr, HObjectAccess::ForJSArrayBufferByteLength()); |
- Add<HBoundsCheck>(graph()->GetConstant0(), buffer_length); |
+ neuter_checked_object = |
+ Add<HBoundsCheck>(graph()->GetConstant0(), buffer_length); |
} |
DCHECK(store_mode == STANDARD_STORE); |
checked_key = Add<HBoundsCheck>(key, length); |
- return AddElementAccess( |
- backing_store, checked_key, val, |
- checked_object, elements_kind, access_type); |
+ return AddElementAccess(backing_store, checked_key, val, |
+ neuter_checked_object, elements_kind, |
+ access_type); |
} |
} |
DCHECK(fast_smi_only_elements || |
@@ -6310,8 +6312,16 @@ HValue* HOptimizedGraphBuilder::BuildMonomorphicAccess( |
if (info->GetJSArrayBufferViewFieldAccess(&access)) { |
DCHECK(info->IsLoad()); |
- return BuildArrayBufferViewFieldAccessor( |
- object, checked_object, FieldIndex::ForInObjectOffset(access.offset())); |
+ HValue* neuter_checked_object = checked_object; |
+ if (IsExternalArrayElementsKind(info->map()->elements_kind())) { |
+ HInstruction* buffer = Add<HLoadNamedField>( |
+ checked_object, nullptr, HObjectAccess::ForJSArrayBufferViewBuffer()); |
+ HInstruction* buffer_length = Add<HLoadNamedField>( |
+ buffer, nullptr, HObjectAccess::ForJSArrayBufferByteLength()); |
+ neuter_checked_object = |
+ Add<HBoundsCheck>(graph()->GetConstant0(), buffer_length); |
+ } |
+ return New<HLoadNamedField>(object, neuter_checked_object, access); |
} |
if (info->name().is_identical_to(isolate()->factory()->prototype_string()) && |