Index: src/compiler/js-native-context-specialization.cc |
diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc |
index fcf954e5c28aacb12593b8800b7486b755961ef8..04911a208286c1744ec56f95688a4ae763482ab6 100644 |
--- a/src/compiler/js-native-context-specialization.cc |
+++ b/src/compiler/js-native-context-specialization.cc |
@@ -1213,12 +1213,20 @@ JSNativeContextSpecialization::BuildElementAccess( |
elements, effect, control); |
} |
- // Default to zero if the {receiver}s buffer was neutered. |
- Node* check = effect = graph()->NewNode( |
- simplified()->ArrayBufferWasNeutered(), buffer, effect, control); |
- length = graph()->NewNode( |
- common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse), |
- check, jsgraph()->ZeroConstant(), length); |
+ // See if we can skip the neutering check. |
+ if (isolate()->IsArrayBufferNeuteringIntact()) { |
+ // Add a code dependency so we are deoptimized in case an ArrayBuffer |
+ // gets neutered. |
+ dependencies()->AssumePropertyCell( |
+ factory()->array_buffer_neutering_protector()); |
+ } else { |
+ // Default to zero if the {receiver}s buffer was neutered. |
+ Node* check = effect = graph()->NewNode( |
+ simplified()->ArrayBufferWasNeutered(), buffer, effect, control); |
+ length = graph()->NewNode( |
+ common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse), |
+ check, jsgraph()->ZeroConstant(), length); |
+ } |
if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { |
// Check that the {index} is a valid array index, we do the actual |