Commit 1dace259 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Properly connect DeoptimizeIf/Unless to effect chain.

The DeoptimizeIf and DeoptimizeUnless operators should actually produce
an effect in addition to the control output.

R=jarin@chromium.org

Review-Url: https://codereview.chromium.org/2002253003
Cr-Commit-Position: refs/heads/master@{#36477}
parent 5c602c6f
...@@ -99,17 +99,17 @@ Reduction BranchElimination::ReduceDeoptimizeConditional(Node* node) { ...@@ -99,17 +99,17 @@ Reduction BranchElimination::ReduceDeoptimizeConditional(Node* node) {
if (condition_value.IsJust()) { if (condition_value.IsJust()) {
// If we know the condition we can discard the branch. // If we know the condition we can discard the branch.
if (condition_is_true == condition_value.FromJust()) { if (condition_is_true == condition_value.FromJust()) {
// We don't to update the conditions here, because we're replacing with // We don't update the conditions here, because we're replacing {node}
// the {control} node that already contains the right information. // with the {control} node that already contains the right information.
return Replace(control); ReplaceWithValue(node, dead(), effect, control);
} else { } else {
control = graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), control = graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
frame_state, effect, control); frame_state, effect, control);
// TODO(bmeurer): This should be on the AdvancedReducer somehow. // TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), control); NodeProperties::MergeControlToEnd(graph(), common(), control);
Revisit(graph()->end()); Revisit(graph()->end());
return Replace(dead());
} }
return Replace(dead());
} }
return UpdateConditions( return UpdateConditions(
node, conditions->AddCondition(zone_, condition, condition_is_true)); node, conditions->AddCondition(zone_, condition, condition_is_true));
......
...@@ -142,13 +142,14 @@ Reduction CommonOperatorReducer::ReduceDeoptimizeConditional(Node* node) { ...@@ -142,13 +142,14 @@ Reduction CommonOperatorReducer::ReduceDeoptimizeConditional(Node* node) {
Decision const decision = DecideCondition(condition); Decision const decision = DecideCondition(condition);
if (decision == Decision::kUnknown) return NoChange(); if (decision == Decision::kUnknown) return NoChange();
if (condition_is_true == (decision == Decision::kTrue)) { if (condition_is_true == (decision == Decision::kTrue)) {
return Replace(control); ReplaceWithValue(node, dead(), effect, control);
} else {
control = graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
frame_state, effect, control);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), control);
Revisit(graph()->end());
} }
control = graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
frame_state, effect, control);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), control);
Revisit(graph()->end());
return Replace(dead()); return Replace(dead());
} }
......
...@@ -169,8 +169,8 @@ std::ostream& operator<<(std::ostream& os, ...@@ -169,8 +169,8 @@ std::ostream& operator<<(std::ostream& os,
#define CACHED_OP_LIST(V) \ #define CACHED_OP_LIST(V) \
V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \
V(DeoptimizeIf, Operator::kFoldable, 2, 1, 1, 0, 0, 1) \ V(DeoptimizeIf, Operator::kFoldable, 2, 1, 1, 0, 1, 1) \
V(DeoptimizeUnless, Operator::kFoldable, 2, 1, 1, 0, 0, 1) \ V(DeoptimizeUnless, Operator::kFoldable, 2, 1, 1, 0, 1, 1) \
V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \
......
...@@ -328,8 +328,8 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) { ...@@ -328,8 +328,8 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) {
// Check that the {target} is still the {array_function}. // Check that the {target} is still the {array_function}.
Node* check = graph()->NewNode(javascript()->StrictEqual(), target, Node* check = graph()->NewNode(javascript()->StrictEqual(), target,
array_function, context); array_function, context);
control = graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state, control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
effect, control); frame_state, effect, control);
// Turn the {node} into a {JSCreateArray} call. // Turn the {node} into a {JSCreateArray} call.
NodeProperties::ReplaceValueInput(node, array_function, 0); NodeProperties::ReplaceValueInput(node, array_function, 0);
...@@ -345,11 +345,12 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) { ...@@ -345,11 +345,12 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) {
// Check that the {target} is still the {target_function}. // Check that the {target} is still the {target_function}.
Node* check = graph()->NewNode(javascript()->StrictEqual(), target, Node* check = graph()->NewNode(javascript()->StrictEqual(), target,
target_function, context); target_function, context);
control = graph()->NewNode(common()->DeoptimizeUnless(), check, control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
frame_state, effect, control); frame_state, effect, control);
// Specialize the JSCallFunction node to the {target_function}. // Specialize the JSCallFunction node to the {target_function}.
NodeProperties::ReplaceValueInput(node, target_function, 0); NodeProperties::ReplaceValueInput(node, target_function, 0);
NodeProperties::ReplaceEffectInput(node, effect);
NodeProperties::ReplaceControlInput(node, control); NodeProperties::ReplaceControlInput(node, control);
// Try to further reduce the JSCallFunction {node}. // Try to further reduce the JSCallFunction {node}.
...@@ -453,8 +454,8 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) { ...@@ -453,8 +454,8 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) {
// Check that the {target} is still the {array_function}. // Check that the {target} is still the {array_function}.
Node* check = graph()->NewNode(javascript()->StrictEqual(), target, Node* check = graph()->NewNode(javascript()->StrictEqual(), target,
array_function, context); array_function, context);
control = graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state, control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
effect, control); frame_state, effect, control);
// Turn the {node} into a {JSCreateArray} call. // Turn the {node} into a {JSCreateArray} call.
NodeProperties::ReplaceEffectInput(node, effect); NodeProperties::ReplaceEffectInput(node, effect);
...@@ -476,8 +477,8 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) { ...@@ -476,8 +477,8 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) {
// Check that the {target} is still the {target_function}. // Check that the {target} is still the {target_function}.
Node* check = graph()->NewNode(javascript()->StrictEqual(), target, Node* check = graph()->NewNode(javascript()->StrictEqual(), target,
target_function, context); target_function, context);
control = graph()->NewNode(common()->DeoptimizeUnless(), check, control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
frame_state, effect, control); frame_state, effect, control);
// Specialize the JSCallConstruct node to the {target_function}. // Specialize the JSCallConstruct node to the {target_function}.
NodeProperties::ReplaceValueInput(node, target_function, 0); NodeProperties::ReplaceValueInput(node, target_function, 0);
......
...@@ -173,8 +173,8 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) { ...@@ -173,8 +173,8 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
Node* check = Node* check =
graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()), value, graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()), value,
jsgraph()->Constant(property_cell_value)); jsgraph()->Constant(property_cell_value));
control = graph()->NewNode(common()->DeoptimizeUnless(), check, control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
frame_state, effect, control); frame_state, effect, control);
break; break;
} }
case PropertyCellType::kConstantType: { case PropertyCellType::kConstantType: {
...@@ -185,8 +185,8 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) { ...@@ -185,8 +185,8 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
Type* property_cell_value_type = Type::TaggedSigned(); Type* property_cell_value_type = Type::TaggedSigned();
if (property_cell_value->IsHeapObject()) { if (property_cell_value->IsHeapObject()) {
// Deoptimize if the {value} is a Smi. // Deoptimize if the {value} is a Smi.
control = graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, control = effect = graph()->NewNode(common()->DeoptimizeIf(), check,
effect, control); frame_state, effect, control);
// Load the {value} map check against the {property_cell} map. // Load the {value} map check against the {property_cell} map.
Node* value_map = effect = Node* value_map = effect =
...@@ -199,8 +199,8 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) { ...@@ -199,8 +199,8 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
jsgraph()->HeapConstant(property_cell_value_map)); jsgraph()->HeapConstant(property_cell_value_map));
property_cell_value_type = Type::TaggedPointer(); property_cell_value_type = Type::TaggedPointer();
} }
control = graph()->NewNode(common()->DeoptimizeUnless(), check, control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
frame_state, effect, control); frame_state, effect, control);
effect = graph()->NewNode( effect = graph()->NewNode(
simplified()->StoreField( simplified()->StoreField(
AccessBuilder::ForPropertyCellValue(property_cell_value_type)), AccessBuilder::ForPropertyCellValue(property_cell_value_type)),
......
...@@ -112,8 +112,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -112,8 +112,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
if (index != nullptr) { if (index != nullptr) {
Node* check = graph()->NewNode(simplified()->ReferenceEqual(Type::Name()), Node* check = graph()->NewNode(simplified()->ReferenceEqual(Type::Name()),
index, jsgraph()->HeapConstant(name)); index, jsgraph()->HeapConstant(name));
control = graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state, control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check,
effect, control); frame_state, effect, control);
} }
// Check if {receiver} may be a number. // Check if {receiver} may be a number.
...@@ -135,8 +135,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -135,8 +135,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
receiverissmi_control = graph()->NewNode(common()->IfTrue(), branch); receiverissmi_control = graph()->NewNode(common()->IfTrue(), branch);
receiverissmi_effect = effect; receiverissmi_effect = effect;
} else { } else {
control = graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, control = effect = graph()->NewNode(common()->DeoptimizeIf(), check,
effect, control); frame_state, effect, control);
} }
// Load the {receiver} map. The resulting effect is the dominating effect for // Load the {receiver} map. The resulting effect is the dominating effect for
...@@ -159,7 +159,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -159,7 +159,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
if (receiver_type->Is(Type::String())) { if (receiver_type->Is(Type::String())) {
Node* check = graph()->NewNode(simplified()->ObjectIsString(), receiver); Node* check = graph()->NewNode(simplified()->ObjectIsString(), receiver);
if (j == access_infos.size() - 1) { if (j == access_infos.size() - 1) {
this_control = this_control = this_effect =
graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state, graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, fallthrough_control); this_effect, fallthrough_control);
fallthrough_control = nullptr; fallthrough_control = nullptr;
...@@ -182,10 +182,11 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -182,10 +182,11 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
graph()->NewNode(simplified()->ReferenceEqual(Type::Internal()), graph()->NewNode(simplified()->ReferenceEqual(Type::Internal()),
receiver_map, jsgraph()->Constant(map)); receiver_map, jsgraph()->Constant(map));
if (--num_classes == 0 && j == access_infos.size() - 1) { if (--num_classes == 0 && j == access_infos.size() - 1) {
this_controls.push_back( Node* deoptimize =
graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state, graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, fallthrough_control)); this_effect, fallthrough_control);
this_effects.push_back(this_effect); this_controls.push_back(deoptimize);
this_effects.push_back(deoptimize);
fallthrough_control = nullptr; fallthrough_control = nullptr;
} else { } else {
Node* branch = Node* branch =
...@@ -237,8 +238,9 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -237,8 +238,9 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
if (access_mode == AccessMode::kStore) { if (access_mode == AccessMode::kStore) {
Node* check = graph()->NewNode( Node* check = graph()->NewNode(
simplified()->ReferenceEqual(Type::Tagged()), value, this_value); simplified()->ReferenceEqual(Type::Tagged()), value, this_value);
this_control = graph()->NewNode(common()->DeoptimizeUnless(), check, this_control = this_effect =
frame_state, this_effect, this_control); graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, this_control);
} }
} else { } else {
DCHECK(access_info.IsDataField()); DCHECK(access_info.IsDataField());
...@@ -263,7 +265,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -263,7 +265,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
jsgraph()->Int32Constant( jsgraph()->Int32Constant(
1 << JSArrayBuffer::WasNeutered::kShift)), 1 << JSArrayBuffer::WasNeutered::kShift)),
jsgraph()->Int32Constant(0)); jsgraph()->Int32Constant(0));
this_control = this_control = this_effect =
graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state, graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, this_control); this_effect, this_control);
break; break;
...@@ -302,7 +304,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -302,7 +304,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
if (field_type->Is(Type::UntaggedFloat64())) { if (field_type->Is(Type::UntaggedFloat64())) {
Node* check = Node* check =
graph()->NewNode(simplified()->ObjectIsNumber(), this_value); graph()->NewNode(simplified()->ObjectIsNumber(), this_value);
this_control = this_control = this_effect =
graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state, graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, this_control); this_effect, this_control);
this_value = graph()->NewNode(simplified()->TypeGuard(Type::Number()), this_value = graph()->NewNode(simplified()->TypeGuard(Type::Number()),
...@@ -345,7 +347,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -345,7 +347,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
} else if (field_type->Is(Type::TaggedSigned())) { } else if (field_type->Is(Type::TaggedSigned())) {
Node* check = Node* check =
graph()->NewNode(simplified()->ObjectIsSmi(), this_value); graph()->NewNode(simplified()->ObjectIsSmi(), this_value);
this_control = this_control = this_effect =
graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state, graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, this_control); this_effect, this_control);
this_value = this_value =
...@@ -354,7 +356,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -354,7 +356,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
} else if (field_type->Is(Type::TaggedPointer())) { } else if (field_type->Is(Type::TaggedPointer())) {
Node* check = Node* check =
graph()->NewNode(simplified()->ObjectIsSmi(), this_value); graph()->NewNode(simplified()->ObjectIsSmi(), this_value);
this_control = this_control = this_effect =
graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, graph()->NewNode(common()->DeoptimizeIf(), check, frame_state,
this_effect, this_control); this_effect, this_control);
if (field_type->NumClasses() == 1) { if (field_type->NumClasses() == 1) {
...@@ -365,7 +367,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -365,7 +367,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
Node* check = graph()->NewNode( Node* check = graph()->NewNode(
simplified()->ReferenceEqual(Type::Internal()), this_value_map, simplified()->ReferenceEqual(Type::Internal()), this_value_map,
jsgraph()->Constant(field_type->Classes().Current())); jsgraph()->Constant(field_type->Classes().Current()));
this_control = this_control = this_effect =
graph()->NewNode(common()->DeoptimizeUnless(), check, graph()->NewNode(common()->DeoptimizeUnless(), check,
frame_state, this_effect, this_control); frame_state, this_effect, this_control);
} else { } else {
...@@ -556,8 +558,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -556,8 +558,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
// Ensure that {receiver} is a heap object. // Ensure that {receiver} is a heap object.
Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), receiver); Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), receiver);
control = graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, control = effect = graph()->NewNode(common()->DeoptimizeIf(), check,
effect, control); frame_state, effect, control);
// Load the {receiver} map. The resulting effect is the dominating effect for // Load the {receiver} map. The resulting effect is the dominating effect for
// all (polymorphic) branches. // all (polymorphic) branches.
...@@ -597,17 +599,19 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -597,17 +599,19 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
// TODO(turbofan): This is ugly as hell! We should probably introduce // TODO(turbofan): This is ugly as hell! We should probably introduce
// macro-ish operators for property access that encapsulate this whole // macro-ish operators for property access that encapsulate this whole
// mess. // mess.
this_controls.push_back(graph()->NewNode(common()->DeoptimizeUnless(), Node* deoptimize =
check, frame_state, effect, graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
fallthrough_control)); effect, fallthrough_control);
this_controls.push_back(deoptimize);
this_effects.push_back(deoptimize);
fallthrough_control = nullptr; fallthrough_control = nullptr;
} else { } else {
Node* branch = Node* branch =
graph()->NewNode(common()->Branch(), check, fallthrough_control); graph()->NewNode(common()->Branch(), check, fallthrough_control);
this_controls.push_back(graph()->NewNode(common()->IfTrue(), branch)); this_controls.push_back(graph()->NewNode(common()->IfTrue(), branch));
this_effects.push_back(effect);
fallthrough_control = graph()->NewNode(common()->IfFalse(), branch); fallthrough_control = graph()->NewNode(common()->IfFalse(), branch);
} }
this_effects.push_back(effect);
if (!map->IsJSArrayMap()) receiver_is_jsarray = false; if (!map->IsJSArrayMap()) receiver_is_jsarray = false;
} }
...@@ -624,7 +628,7 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -624,7 +628,7 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
simplified()->ReferenceEqual(Type::Any()), receiver_map, simplified()->ReferenceEqual(Type::Any()), receiver_map,
jsgraph()->HeapConstant(transition_source)); jsgraph()->HeapConstant(transition_source));
if (--num_transitions == 0 && j == access_infos.size() - 1) { if (--num_transitions == 0 && j == access_infos.size() - 1) {
transition_control = transition_control = transition_effect =
graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state, graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
transition_effect, fallthrough_control); transition_effect, fallthrough_control);
fallthrough_control = nullptr; fallthrough_control = nullptr;
...@@ -689,8 +693,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -689,8 +693,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
if (!NumberMatcher(this_index).HasValue()) { if (!NumberMatcher(this_index).HasValue()) {
Node* check = Node* check =
graph()->NewNode(simplified()->ObjectIsNumber(), this_index); graph()->NewNode(simplified()->ObjectIsNumber(), this_index);
this_control = graph()->NewNode(common()->DeoptimizeUnless(), check, this_control = this_effect =
frame_state, this_effect, this_control); graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, this_control);
this_index = graph()->NewNode(simplified()->TypeGuard(Type::Number()), this_index = graph()->NewNode(simplified()->TypeGuard(Type::Number()),
this_index, this_control); this_index, this_control);
} }
...@@ -702,8 +707,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -702,8 +707,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
graph()->NewNode(simplified()->NumberToUint32(), this_index); graph()->NewNode(simplified()->NumberToUint32(), this_index);
Node* check = graph()->NewNode(simplified()->NumberEqual(), this_index32, Node* check = graph()->NewNode(simplified()->NumberEqual(), this_index32,
this_index); this_index);
this_control = graph()->NewNode(common()->DeoptimizeUnless(), check, this_control = this_effect =
frame_state, this_effect, this_control); graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, this_control);
this_index = this_index32; this_index = this_index32;
} }
...@@ -725,8 +731,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -725,8 +731,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
Node* check = graph()->NewNode( Node* check = graph()->NewNode(
simplified()->ReferenceEqual(Type::Any()), this_elements_map, simplified()->ReferenceEqual(Type::Any()), this_elements_map,
jsgraph()->HeapConstant(factory()->fixed_array_map())); jsgraph()->HeapConstant(factory()->fixed_array_map()));
this_control = graph()->NewNode(common()->DeoptimizeUnless(), check, this_control = this_effect =
frame_state, this_effect, this_control); graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, this_control);
} }
// Load the length of the {receiver}. // Load the length of the {receiver}.
...@@ -743,8 +750,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -743,8 +750,9 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
// Check that the {index} is in the valid range for the {receiver}. // Check that the {index} is in the valid range for the {receiver}.
Node* check = graph()->NewNode(simplified()->NumberLessThan(), this_index, Node* check = graph()->NewNode(simplified()->NumberLessThan(), this_index,
this_length); this_length);
this_control = graph()->NewNode(common()->DeoptimizeUnless(), check, this_control = this_effect =
frame_state, this_effect, this_control); graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, this_control);
// Compute the element access. // Compute the element access.
Type* element_type = Type::Any(); Type* element_type = Type::Any();
...@@ -808,7 +816,7 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -808,7 +816,7 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
Type::Union(element_type, Type::Undefined(), graph()->zone()); Type::Union(element_type, Type::Undefined(), graph()->zone());
} else { } else {
// Deoptimize in case of the hole. // Deoptimize in case of the hole.
this_control = this_control = this_effect =
graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, graph()->NewNode(common()->DeoptimizeIf(), check, frame_state,
this_effect, this_control); this_effect, this_control);
} }
...@@ -837,7 +845,7 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -837,7 +845,7 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
check, jsgraph()->UndefinedConstant(), this_value); check, jsgraph()->UndefinedConstant(), this_value);
} else { } else {
// Deoptimize in case of the hole. // Deoptimize in case of the hole.
this_control = this_control = this_effect =
graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, graph()->NewNode(common()->DeoptimizeIf(), check, frame_state,
this_effect, this_control); this_effect, this_control);
} }
...@@ -846,15 +854,17 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -846,15 +854,17 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
DCHECK_EQ(AccessMode::kStore, access_mode); DCHECK_EQ(AccessMode::kStore, access_mode);
if (IsFastSmiElementsKind(elements_kind)) { if (IsFastSmiElementsKind(elements_kind)) {
Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), this_value); Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), this_value);
this_control = graph()->NewNode(common()->DeoptimizeUnless(), check, this_control = this_effect =
frame_state, this_effect, this_control); graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, this_control);
this_value = graph()->NewNode(simplified()->TypeGuard(type_cache_.kSmi), this_value = graph()->NewNode(simplified()->TypeGuard(type_cache_.kSmi),
this_value, this_control); this_value, this_control);
} else if (IsFastDoubleElementsKind(elements_kind)) { } else if (IsFastDoubleElementsKind(elements_kind)) {
Node* check = Node* check =
graph()->NewNode(simplified()->ObjectIsNumber(), this_value); graph()->NewNode(simplified()->ObjectIsNumber(), this_value);
this_control = graph()->NewNode(common()->DeoptimizeUnless(), check, this_control = this_effect =
frame_state, this_effect, this_control); graph()->NewNode(common()->DeoptimizeUnless(), check, frame_state,
this_effect, this_control);
this_value = graph()->NewNode(simplified()->TypeGuard(Type::Number()), this_value = graph()->NewNode(simplified()->TypeGuard(Type::Number()),
this_value, this_control); this_value, this_control);
} }
......
...@@ -87,6 +87,8 @@ void MemoryOptimizer::VisitNode(Node* node, AllocationState const* state) { ...@@ -87,6 +87,8 @@ void MemoryOptimizer::VisitNode(Node* node, AllocationState const* state) {
return VisitStoreField(node, state); return VisitStoreField(node, state);
case IrOpcode::kCheckedLoad: case IrOpcode::kCheckedLoad:
case IrOpcode::kCheckedStore: case IrOpcode::kCheckedStore:
case IrOpcode::kDeoptimizeIf:
case IrOpcode::kDeoptimizeUnless:
case IrOpcode::kIfException: case IrOpcode::kIfException:
case IrOpcode::kLoad: case IrOpcode::kLoad:
case IrOpcode::kStore: case IrOpcode::kStore:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment