| 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 8628d56c221ef80fbb96a72cdda41dc0124b4d8e..504ef12ec70b4d8d5c512cfc722b4eab7f684c4b 100644
|
| --- a/src/compiler/js-native-context-specialization.cc
|
| +++ b/src/compiler/js-native-context-specialization.cc
|
| @@ -652,6 +652,14 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
|
| graph()->NewNode(common()->EffectPhi(this_control_count),
|
| this_control_count + 1, &this_effects.front());
|
| }
|
| +
|
| + // TODO(turbofan): The effect/control linearization will not find a
|
| + // FrameState after the StoreField or Call that is generated for the
|
| + // elements kind transition above. This is because those operators
|
| + // don't have the kNoWrite flag on it, even though they are not
|
| + // observable by JavaScript.
|
| + this_effect = graph()->NewNode(common()->Checkpoint(), frame_state,
|
| + this_effect, this_control);
|
| }
|
|
|
| // Certain stores need a prototype chain check because shape changes
|
| @@ -762,42 +770,26 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
|
| if (elements_kind == FAST_HOLEY_ELEMENTS ||
|
| elements_kind == FAST_HOLEY_SMI_ELEMENTS) {
|
| // Perform the hole check on the result.
|
| - Node* check =
|
| - graph()->NewNode(simplified()->ReferenceEqual(element_access.type),
|
| - this_value, jsgraph()->TheHoleConstant());
|
| + CheckHoleMode mode = CheckHoleMode::kNeverReturnHole;
|
| // Check if we are allowed to turn the hole into undefined.
|
| Type* initial_holey_array_type = Type::Class(
|
| handle(isolate()->get_initial_js_array_map(elements_kind)),
|
| graph()->zone());
|
| if (receiver_type->NowIs(initial_holey_array_type) &&
|
| isolate()->IsFastArrayConstructorPrototypeChainIntact()) {
|
| - Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse),
|
| - check, this_control);
|
| - Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
|
| - Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
|
| // Add a code dependency on the array protector cell.
|
| AssumePrototypesStable(receiver_type, native_context,
|
| isolate()->initial_object_prototype());
|
| dependencies()->AssumePropertyCell(factory()->array_protector());
|
| // Turn the hole into undefined.
|
| - this_control =
|
| - graph()->NewNode(common()->Merge(2), if_true, if_false);
|
| - this_value = graph()->NewNode(
|
| - common()->Phi(MachineRepresentation::kTagged, 2),
|
| - jsgraph()->UndefinedConstant(), this_value, this_control);
|
| - element_type =
|
| - Type::Union(element_type, Type::Undefined(), graph()->zone());
|
| - } else {
|
| - // Deoptimize in case of the hole.
|
| - this_control = this_effect =
|
| - graph()->NewNode(common()->DeoptimizeIf(), check, frame_state,
|
| - this_effect, this_control);
|
| + mode = CheckHoleMode::kAllowReturnHole;
|
| }
|
| - // Rename the result to represent the actual type (not polluted by the
|
| - // hole).
|
| - this_value = graph()->NewNode(simplified()->TypeGuard(element_type),
|
| - this_value, this_control);
|
| + this_value = this_effect =
|
| + graph()->NewNode(simplified()->CheckHole(mode), this_value,
|
| + this_effect, this_control);
|
| } else if (elements_kind == FAST_HOLEY_DOUBLE_ELEMENTS) {
|
| + // Perform the hole check on the result.
|
| + CheckHoleMode mode = CheckHoleMode::kNeverReturnHole;
|
| // Check if we are allowed to return the hole directly.
|
| Type* initial_holey_array_type = Type::Class(
|
| handle(isolate()->get_initial_js_array_map(elements_kind)),
|
| @@ -809,17 +801,11 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
|
| isolate()->initial_object_prototype());
|
| dependencies()->AssumePropertyCell(factory()->array_protector());
|
| // Turn the hole into undefined.
|
| - this_value = graph()->NewNode(simplified()->NumberConvertHoleNaN(),
|
| - this_value);
|
| - } else {
|
| - // Perform the hole check on the result.
|
| - Node* check =
|
| - graph()->NewNode(simplified()->NumberIsHoleNaN(), this_value);
|
| - // Deoptimize in case of the hole.
|
| - this_control = this_effect =
|
| - graph()->NewNode(common()->DeoptimizeIf(), check, frame_state,
|
| - this_effect, this_control);
|
| + mode = CheckHoleMode::kAllowReturnHole;
|
| }
|
| + this_value = this_effect =
|
| + graph()->NewNode(simplified()->CheckHoleNaN(mode), this_value,
|
| + this_effect, this_control);
|
| }
|
| } else {
|
| DCHECK_EQ(AccessMode::kStore, access_mode);
|
|
|