Commit 2ae5894d authored by jarin's avatar jarin Committed by Commit bot

Revert of [turbofan] Connect ObjectIsNumber to effect and control chains....

Revert of [turbofan] Connect ObjectIsNumber to effect and control chains. (patchset #1 id:1 of https://codereview.chromium.org/1709093002/ )

Reason for revert:
Tanks benchmarks (e.g., Octane box2d TF).

Original issue's description:
> [turbofan] Connect ObjectIsNumber to effect and control chains.
>
> In theory, we could connect the nodes when doing
> the schedule-in-the-middle pass, but that would require creating two
> versions of the operator (effectful and pure). I believe we do not
> lose anything by wiring the node up eagerly.
>
> Committed: https://crrev.com/2894e80a0a4a51a0d72e72aa48fcd01968f7949f
> Cr-Commit-Position: refs/heads/master@{#34141}

TBR=bmeurer@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1718483002

Cr-Commit-Position: refs/heads/master@{#34147}
parent 3b1211ac
...@@ -596,42 +596,36 @@ Node* ChangeLowering::IsSmi(Node* value) { ...@@ -596,42 +596,36 @@ Node* ChangeLowering::IsSmi(Node* value) {
jsgraph()->IntPtrConstant(kSmiTag)); jsgraph()->IntPtrConstant(kSmiTag));
} }
Node* ChangeLowering::LoadHeapObjectMap(Node* object, Node* effect, Node* ChangeLowering::LoadHeapObjectMap(Node* object, Node* control) {
Node* control) {
return graph()->NewNode( return graph()->NewNode(
machine()->Load(MachineType::AnyTagged()), object, machine()->Load(MachineType::AnyTagged()), object,
jsgraph()->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag), jsgraph()->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag),
effect, control); graph()->start(), control);
} }
Node* ChangeLowering::LoadMapInstanceType(Node* map, Node* effect, Node* ChangeLowering::LoadMapInstanceType(Node* map) {
Node* control) {
return graph()->NewNode( return graph()->NewNode(
machine()->Load(MachineType::Uint8()), map, machine()->Load(MachineType::Uint8()), map,
jsgraph()->IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag), jsgraph()->IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag),
effect, control); graph()->start(), graph()->start());
} }
Reduction ChangeLowering::ObjectIsNumber(Node* node) { Reduction ChangeLowering::ObjectIsNumber(Node* node) {
Node* input = NodeProperties::GetValueInput(node, 0); Node* input = NodeProperties::GetValueInput(node, 0);
Node* control = NodeProperties::GetControlInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node, 0);
// TODO(bmeurer): Optimize somewhat based on input type. // TODO(bmeurer): Optimize somewhat based on input type.
Node* check = IsSmi(input); Node* check = IsSmi(input);
Node* branch = graph()->NewNode(common()->Branch(), check, control); Node* branch = graph()->NewNode(common()->Branch(), check, graph()->start());
Node* if_true = graph()->NewNode(common()->IfTrue(), branch); Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
Node* vtrue = jsgraph()->Int32Constant(1); Node* vtrue = jsgraph()->Int32Constant(1);
Node* if_false = graph()->NewNode(common()->IfFalse(), branch); Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
Node* load_map = LoadHeapObjectMap(input, effect, if_false);
Node* vfalse = graph()->NewNode( Node* vfalse = graph()->NewNode(
machine()->WordEqual(), load_map, machine()->WordEqual(), LoadHeapObjectMap(input, if_false),
jsgraph()->HeapConstant(isolate()->factory()->heap_number_map())); jsgraph()->HeapConstant(isolate()->factory()->heap_number_map()));
Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); Node* control = graph()->NewNode(common()->Merge(2), if_true, if_false);
Node* ephi = node->ReplaceInput(0, vtrue);
graph()->NewNode(common()->EffectPhi(2), effect, load_map, merge); node->AppendInput(graph()->zone(), vfalse);
Node* phi = graph()->NewNode(common()->Phi(MachineRepresentation::kBit, 2), node->AppendInput(graph()->zone(), control);
vtrue, vfalse, merge); NodeProperties::ChangeOp(node, common()->Phi(MachineRepresentation::kBit, 2));
ReplaceWithValue(node, phi, ephi, merge);
return Changed(node); return Changed(node);
} }
...@@ -644,12 +638,10 @@ Reduction ChangeLowering::ObjectIsReceiver(Node* node) { ...@@ -644,12 +638,10 @@ Reduction ChangeLowering::ObjectIsReceiver(Node* node) {
Node* if_true = graph()->NewNode(common()->IfTrue(), branch); Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
Node* vtrue = jsgraph()->Int32Constant(0); Node* vtrue = jsgraph()->Int32Constant(0);
Node* if_false = graph()->NewNode(common()->IfFalse(), branch); Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
Node* load_map = LoadHeapObjectMap(input, graph()->start(), if_false); Node* vfalse =
Node* load_instance_type = graph()->NewNode(machine()->Uint32LessThanOrEqual(),
LoadMapInstanceType(load_map, graph()->start(), graph()->start()); jsgraph()->Uint32Constant(FIRST_JS_RECEIVER_TYPE),
Node* vfalse = graph()->NewNode( LoadMapInstanceType(LoadHeapObjectMap(input, if_false)));
machine()->Uint32LessThanOrEqual(),
jsgraph()->Uint32Constant(FIRST_JS_RECEIVER_TYPE), load_instance_type);
Node* control = graph()->NewNode(common()->Merge(2), if_true, if_false); Node* control = graph()->NewNode(common()->Merge(2), if_true, if_false);
node->ReplaceInput(0, vtrue); node->ReplaceInput(0, vtrue);
node->AppendInput(graph()->zone(), vfalse); node->AppendInput(graph()->zone(), vfalse);
......
...@@ -19,10 +19,9 @@ class Linkage; ...@@ -19,10 +19,9 @@ class Linkage;
class MachineOperatorBuilder; class MachineOperatorBuilder;
class Operator; class Operator;
class ChangeLowering final : public AdvancedReducer { class ChangeLowering final : public Reducer {
public: public:
ChangeLowering(Editor* editor, JSGraph* jsgraph) explicit ChangeLowering(JSGraph* jsgraph) : jsgraph_(jsgraph) {}
: AdvancedReducer(editor), jsgraph_(jsgraph) {}
~ChangeLowering() final; ~ChangeLowering() final;
Reduction Reduce(Node* node) final; Reduction Reduce(Node* node) final;
...@@ -58,8 +57,8 @@ class ChangeLowering final : public AdvancedReducer { ...@@ -58,8 +57,8 @@ class ChangeLowering final : public AdvancedReducer {
Reduction Allocate(Node* node); Reduction Allocate(Node* node);
Node* IsSmi(Node* value); Node* IsSmi(Node* value);
Node* LoadHeapObjectMap(Node* object, Node* effect, Node* control); Node* LoadHeapObjectMap(Node* object, Node* control);
Node* LoadMapInstanceType(Node* map, Node* effect, Node* control); Node* LoadMapInstanceType(Node* map);
Reduction ObjectIsNumber(Node* node); Reduction ObjectIsNumber(Node* node);
Reduction ObjectIsReceiver(Node* node); Reduction ObjectIsReceiver(Node* node);
......
...@@ -222,8 +222,7 @@ void GraphReducer::ReplaceWithValue(Node* node, Node* value, Node* effect, ...@@ -222,8 +222,7 @@ void GraphReducer::ReplaceWithValue(Node* node, Node* value, Node* effect,
edge.UpdateTo(dead_); edge.UpdateTo(dead_);
Revisit(user); Revisit(user);
} else { } else {
edge.UpdateTo(control); UNREACHABLE();
Revisit(user);
} }
} else if (NodeProperties::IsEffectEdge(edge)) { } else if (NodeProperties::IsEffectEdge(edge)) {
DCHECK_NOT_NULL(effect); DCHECK_NOT_NULL(effect);
......
...@@ -290,9 +290,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -290,9 +290,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
} else { } else {
DCHECK_EQ(AccessMode::kStore, access_mode); DCHECK_EQ(AccessMode::kStore, access_mode);
if (field_type->Is(Type::UntaggedFloat64())) { if (field_type->Is(Type::UntaggedFloat64())) {
Node* check = this_control = this_effect = Node* check =
graph()->NewNode(simplified()->ObjectIsNumber(), this_value, graph()->NewNode(simplified()->ObjectIsNumber(), this_value);
this_effect, this_control);
Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue),
check, this_control); check, this_control);
exit_controls.push_back( exit_controls.push_back(
...@@ -653,9 +652,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -653,9 +652,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
// Check that the {index} is actually a Number. // Check that the {index} is actually a Number.
if (!NumberMatcher(this_index).HasValue()) { if (!NumberMatcher(this_index).HasValue()) {
Node* check = this_control = this_effect = Node* check =
graph()->NewNode(simplified()->ObjectIsNumber(), this_index, graph()->NewNode(simplified()->ObjectIsNumber(), this_index);
this_effect, this_control);
Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue),
check, this_control); check, this_control);
exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch));
...@@ -827,9 +825,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -827,9 +825,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
this_value = graph()->NewNode(common()->Guard(type_cache_.kSmi), this_value = graph()->NewNode(common()->Guard(type_cache_.kSmi),
this_value, this_control); this_value, this_control);
} else if (IsFastDoubleElementsKind(elements_kind)) { } else if (IsFastDoubleElementsKind(elements_kind)) {
Node* check = this_control = this_effect = Node* check =
graph()->NewNode(simplified()->ObjectIsNumber(), this_value, graph()->NewNode(simplified()->ObjectIsNumber(), this_value);
this_effect, this_control);
Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue),
check, this_control); check, this_control);
exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch));
......
...@@ -730,7 +730,7 @@ struct ChangeLoweringPhase { ...@@ -730,7 +730,7 @@ struct ChangeLoweringPhase {
data->common()); data->common());
SimplifiedOperatorReducer simple_reducer(data->jsgraph()); SimplifiedOperatorReducer simple_reducer(data->jsgraph());
ValueNumberingReducer value_numbering(temp_zone); ValueNumberingReducer value_numbering(temp_zone);
ChangeLowering lowering(&graph_reducer, data->jsgraph()); ChangeLowering lowering(data->jsgraph());
MachineOperatorReducer machine_reducer(data->jsgraph()); MachineOperatorReducer machine_reducer(data->jsgraph());
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine()); data->common(), data->machine());
......
...@@ -1240,7 +1240,6 @@ class RepresentationSelector { ...@@ -1240,7 +1240,6 @@ class RepresentationSelector {
} }
case IrOpcode::kObjectIsNumber: { case IrOpcode::kObjectIsNumber: {
ProcessInput(node, 0, UseInfo::AnyTagged()); ProcessInput(node, 0, UseInfo::AnyTagged());
ProcessRemainingInputs(node, 1);
SetOutput(node, NodeOutputInfo::Bool()); SetOutput(node, NodeOutputInfo::Bool());
break; break;
} }
......
...@@ -186,6 +186,7 @@ const ElementAccess& ElementAccessOf(const Operator* op) { ...@@ -186,6 +186,7 @@ const ElementAccess& ElementAccessOf(const Operator* op) {
V(ChangeFloat64ToTagged, Operator::kNoProperties, 1) \ V(ChangeFloat64ToTagged, Operator::kNoProperties, 1) \
V(ChangeBoolToBit, Operator::kNoProperties, 1) \ V(ChangeBoolToBit, Operator::kNoProperties, 1) \
V(ChangeBitToBool, Operator::kNoProperties, 1) \ V(ChangeBitToBool, Operator::kNoProperties, 1) \
V(ObjectIsNumber, Operator::kNoProperties, 1) \
V(ObjectIsReceiver, Operator::kNoProperties, 1) \ V(ObjectIsReceiver, Operator::kNoProperties, 1) \
V(ObjectIsSmi, Operator::kNoProperties, 1) V(ObjectIsSmi, Operator::kNoProperties, 1)
...@@ -194,8 +195,6 @@ const ElementAccess& ElementAccessOf(const Operator* op) { ...@@ -194,8 +195,6 @@ const ElementAccess& ElementAccessOf(const Operator* op) {
V(StringLessThan, Operator::kNoThrow, 2) \ V(StringLessThan, Operator::kNoThrow, 2) \
V(StringLessThanOrEqual, Operator::kNoThrow, 2) V(StringLessThanOrEqual, Operator::kNoThrow, 2)
#define STATEFUL_OP_LIST(V) V(ObjectIsNumber)
struct SimplifiedOperatorGlobalCache final { struct SimplifiedOperatorGlobalCache final {
#define PURE(Name, properties, input_count) \ #define PURE(Name, properties, input_count) \
struct Name##Operator final : public Operator { \ struct Name##Operator final : public Operator { \
...@@ -207,16 +206,6 @@ struct SimplifiedOperatorGlobalCache final { ...@@ -207,16 +206,6 @@ struct SimplifiedOperatorGlobalCache final {
PURE_OP_LIST(PURE) PURE_OP_LIST(PURE)
#undef PURE #undef PURE
#define STATEFUL(Name) \
struct Name##Operator final : public Operator { \
Name##Operator() \
: Operator(IrOpcode::k##Name, Operator::kNoProperties, #Name, 1, 1, 1, \
1, 1, 1) {} \
}; \
Name##Operator k##Name;
STATEFUL_OP_LIST(STATEFUL)
#undef STATEFUL
#define NO_THROW(Name, properties, input_count) \ #define NO_THROW(Name, properties, input_count) \
struct Name##Operator final : public Operator { \ struct Name##Operator final : public Operator { \
Name##Operator() \ Name##Operator() \
...@@ -263,10 +252,6 @@ PURE_OP_LIST(GET_FROM_CACHE) ...@@ -263,10 +252,6 @@ PURE_OP_LIST(GET_FROM_CACHE)
NO_THROW_OP_LIST(GET_FROM_CACHE) NO_THROW_OP_LIST(GET_FROM_CACHE)
#undef GET_FROM_CACHE #undef GET_FROM_CACHE
#define GET_FROM_CACHE(Name) \
const Operator* SimplifiedOperatorBuilder::Name() { return &cache_.k##Name; }
STATEFUL_OP_LIST(GET_FROM_CACHE)
#undef GET_FROM_CACHE
const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) {
return new (zone()) Operator(IrOpcode::kReferenceEqual, return new (zone()) Operator(IrOpcode::kReferenceEqual,
......
...@@ -1987,9 +1987,9 @@ Handle<JSFunction> CompileJSToWasmWrapper( ...@@ -1987,9 +1987,9 @@ Handle<JSFunction> CompileJSToWasmWrapper(
typer.Run(roots); typer.Run(roots);
// Run generic and change lowering. // Run generic and change lowering.
GraphReducer graph_reducer(&zone, &graph, jsgraph.Dead());
JSGenericLowering generic(true, &jsgraph); JSGenericLowering generic(true, &jsgraph);
ChangeLowering changes(&graph_reducer, &jsgraph); ChangeLowering changes(&jsgraph);
GraphReducer graph_reducer(&zone, &graph, jsgraph.Dead());
graph_reducer.AddReducer(&changes); graph_reducer.AddReducer(&changes);
graph_reducer.AddReducer(&generic); graph_reducer.AddReducer(&generic);
graph_reducer.ReduceGraph(); graph_reducer.ReduceGraph();
...@@ -2072,9 +2072,9 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module, ...@@ -2072,9 +2072,9 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
typer.Run(roots); typer.Run(roots);
// Run generic and change lowering. // Run generic and change lowering.
GraphReducer graph_reducer(&zone, &graph, jsgraph.Dead());
JSGenericLowering generic(true, &jsgraph); JSGenericLowering generic(true, &jsgraph);
ChangeLowering changes(&graph_reducer, &jsgraph); ChangeLowering changes(&jsgraph);
GraphReducer graph_reducer(&zone, &graph, jsgraph.Dead());
graph_reducer.AddReducer(&changes); graph_reducer.AddReducer(&changes);
graph_reducer.AddReducer(&generic); graph_reducer.AddReducer(&generic);
graph_reducer.ReduceGraph(); graph_reducer.ReduceGraph();
......
...@@ -129,9 +129,9 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> { ...@@ -129,9 +129,9 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
// Run the graph reducer with changes lowering on a single node. // Run the graph reducer with changes lowering on a single node.
Typer typer(this->isolate(), this->graph()); Typer typer(this->isolate(), this->graph());
typer.Run(); typer.Run();
GraphReducer reducer(this->zone(), this->graph()); ChangeLowering change_lowering(&jsgraph);
ChangeLowering change_lowering(&reducer, &jsgraph);
SelectLowering select_lowering(this->graph(), this->common()); SelectLowering select_lowering(this->graph(), this->common());
GraphReducer reducer(this->zone(), this->graph());
reducer.AddReducer(&change_lowering); reducer.AddReducer(&change_lowering);
reducer.AddReducer(&select_lowering); reducer.AddReducer(&select_lowering);
reducer.ReduceNode(change); reducer.ReduceNode(change);
......
...@@ -60,8 +60,8 @@ class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> { ...@@ -60,8 +60,8 @@ class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> {
typer.Run(); typer.Run();
lowering.LowerAllNodes(); lowering.LowerAllNodes();
ChangeLowering lowering(&jsgraph);
GraphReducer reducer(this->zone(), this->graph()); GraphReducer reducer(this->zone(), this->graph());
ChangeLowering lowering(&reducer, &jsgraph);
reducer.AddReducer(&lowering); reducer.AddReducer(&lowering);
reducer.ReduceGraph(); reducer.ReduceGraph();
Verifier::Run(this->graph()); Verifier::Run(this->graph());
...@@ -726,8 +726,8 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { ...@@ -726,8 +726,8 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders {
SourcePositionTable table(jsgraph.graph()); SourcePositionTable table(jsgraph.graph());
SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes(); SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes();
ChangeLowering lowering(&jsgraph);
GraphReducer reducer(this->zone(), this->graph()); GraphReducer reducer(this->zone(), this->graph());
ChangeLowering lowering(&reducer, &jsgraph);
reducer.AddReducer(&lowering); reducer.AddReducer(&lowering);
reducer.ReduceGraph(); reducer.ReduceGraph();
Verifier::Run(this->graph()); Verifier::Run(this->graph());
......
...@@ -42,8 +42,7 @@ class ChangeLoweringTest : public TypedGraphTest { ...@@ -42,8 +42,7 @@ class ChangeLoweringTest : public TypedGraphTest {
JSOperatorBuilder javascript(zone()); JSOperatorBuilder javascript(zone());
JSGraph jsgraph(isolate(), graph(), common(), &javascript, nullptr, JSGraph jsgraph(isolate(), graph(), common(), &javascript, nullptr,
&machine); &machine);
GraphReducer graph_reducer(zone(), graph()); ChangeLowering reducer(&jsgraph);
ChangeLowering reducer(&graph_reducer, &jsgraph);
return reducer.Reduce(node); return reducer.Reduce(node);
} }
......
...@@ -65,6 +65,7 @@ const PureOperator kPureOperators[] = { ...@@ -65,6 +65,7 @@ const PureOperator kPureOperators[] = {
PURE(ChangeFloat64ToTagged, Operator::kNoProperties, 1), PURE(ChangeFloat64ToTagged, Operator::kNoProperties, 1),
PURE(ChangeBoolToBit, Operator::kNoProperties, 1), PURE(ChangeBoolToBit, Operator::kNoProperties, 1),
PURE(ChangeBitToBool, Operator::kNoProperties, 1), PURE(ChangeBitToBool, Operator::kNoProperties, 1),
PURE(ObjectIsNumber, Operator::kNoProperties, 1),
PURE(ObjectIsReceiver, Operator::kNoProperties, 1), PURE(ObjectIsReceiver, Operator::kNoProperties, 1),
PURE(ObjectIsSmi, Operator::kNoProperties, 1) PURE(ObjectIsSmi, Operator::kNoProperties, 1)
#undef PURE #undef PURE
......
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