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

[turbofan] Introduce simplified operators directly in BytecodeGraphBuilder.

Instead of doing the dance via JSStrictEqual for comparisons with null,
undefined or the hole, we can just go to ReferenceEqual directly. Also
avoid the Select(x, false, true) dance for negation and use BooleanNot
directly.

R=mstarzinger@chromium.org

Review-Url: https://codereview.chromium.org/2646763004
Cr-Commit-Position: refs/heads/master@{#42500}
parent 097e1ac6
...@@ -844,8 +844,8 @@ BytecodeGraphBuilder::Environment* BytecodeGraphBuilder::CheckContextExtensions( ...@@ -844,8 +844,8 @@ BytecodeGraphBuilder::Environment* BytecodeGraphBuilder::CheckContextExtensions(
NewNode(javascript()->LoadContext(d, Context::EXTENSION_INDEX, false)); NewNode(javascript()->LoadContext(d, Context::EXTENSION_INDEX, false));
Node* check_no_extension = Node* check_no_extension =
NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), NewNode(simplified()->ReferenceEqual(), extension_slot,
extension_slot, jsgraph()->TheHoleConstant()); jsgraph()->TheHoleConstant());
NewBranch(check_no_extension); NewBranch(check_no_extension);
Environment* true_environment = environment()->Copy(); Environment* true_environment = environment()->Copy();
...@@ -1599,16 +1599,14 @@ void BytecodeGraphBuilder::VisitDec() { ...@@ -1599,16 +1599,14 @@ void BytecodeGraphBuilder::VisitDec() {
void BytecodeGraphBuilder::VisitLogicalNot() { void BytecodeGraphBuilder::VisitLogicalNot() {
Node* value = environment()->LookupAccumulator(); Node* value = environment()->LookupAccumulator();
Node* node = NewNode(common()->Select(MachineRepresentation::kTagged), value, Node* node = NewNode(simplified()->BooleanNot(), value);
jsgraph()->FalseConstant(), jsgraph()->TrueConstant());
environment()->BindAccumulator(node); environment()->BindAccumulator(node);
} }
void BytecodeGraphBuilder::VisitToBooleanLogicalNot() { void BytecodeGraphBuilder::VisitToBooleanLogicalNot() {
Node* value = NewNode(javascript()->ToBoolean(ToBooleanHint::kAny), Node* value = NewNode(javascript()->ToBoolean(ToBooleanHint::kAny),
environment()->LookupAccumulator()); environment()->LookupAccumulator());
Node* node = NewNode(common()->Select(MachineRepresentation::kTagged), value, Node* node = NewNode(simplified()->BooleanNot(), value);
jsgraph()->FalseConstant(), jsgraph()->TrueConstant());
environment()->BindAccumulator(node); environment()->BindAccumulator(node);
} }
...@@ -1698,16 +1696,16 @@ void BytecodeGraphBuilder::VisitTestUndetectable() { ...@@ -1698,16 +1696,16 @@ void BytecodeGraphBuilder::VisitTestUndetectable() {
void BytecodeGraphBuilder::VisitTestNull() { void BytecodeGraphBuilder::VisitTestNull() {
Node* object = Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
Node* result = NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), Node* result = NewNode(simplified()->ReferenceEqual(), object,
object, jsgraph()->NullConstant()); jsgraph()->NullConstant());
environment()->BindAccumulator(result); environment()->BindAccumulator(result);
} }
void BytecodeGraphBuilder::VisitTestUndefined() { void BytecodeGraphBuilder::VisitTestUndefined() {
Node* object = Node* object =
environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
Node* result = NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), Node* result = NewNode(simplified()->ReferenceEqual(), object,
object, jsgraph()->UndefinedConstant()); jsgraph()->UndefinedConstant());
environment()->BindAccumulator(result); environment()->BindAccumulator(result);
} }
...@@ -2056,8 +2054,7 @@ void BytecodeGraphBuilder::BuildJumpIfNot(Node* condition) { ...@@ -2056,8 +2054,7 @@ void BytecodeGraphBuilder::BuildJumpIfNot(Node* condition) {
void BytecodeGraphBuilder::BuildJumpIfEqual(Node* comperand) { void BytecodeGraphBuilder::BuildJumpIfEqual(Node* comperand) {
Node* accumulator = environment()->LookupAccumulator(); Node* accumulator = environment()->LookupAccumulator();
Node* condition = Node* condition =
NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), NewNode(simplified()->ReferenceEqual(), accumulator, comperand);
accumulator, comperand);
BuildJumpIf(condition); BuildJumpIf(condition);
} }
...@@ -2085,9 +2082,8 @@ void BytecodeGraphBuilder::BuildJumpIfToBooleanFalse() { ...@@ -2085,9 +2082,8 @@ void BytecodeGraphBuilder::BuildJumpIfToBooleanFalse() {
void BytecodeGraphBuilder::BuildJumpIfNotHole() { void BytecodeGraphBuilder::BuildJumpIfNotHole() {
Node* accumulator = environment()->LookupAccumulator(); Node* accumulator = environment()->LookupAccumulator();
Node* condition = Node* condition = NewNode(simplified()->ReferenceEqual(), accumulator,
NewNode(javascript()->StrictEqual(CompareOperationHint::kAny), jsgraph()->TheHoleConstant());
accumulator, jsgraph()->TheHoleConstant());
BuildJumpIfNot(condition); BuildJumpIfNot(condition);
} }
......
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