| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/js-typed-lowering.h" | 5 #include "src/compiler/js-typed-lowering.h" |
| 6 | 6 |
| 7 #include "src/builtins/builtins-utils.h" | 7 #include "src/builtins/builtins-utils.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
| 10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 return Replace(input); | 770 return Replace(input); |
| 771 } else if (input_type->Is(Type::OrderedNumber())) { | 771 } else if (input_type->Is(Type::OrderedNumber())) { |
| 772 // JSToBoolean(x:ordered-number) => BooleanNot(NumberEqual(x,#0)) | 772 // JSToBoolean(x:ordered-number) => BooleanNot(NumberEqual(x,#0)) |
| 773 RelaxEffectsAndControls(node); | 773 RelaxEffectsAndControls(node); |
| 774 node->ReplaceInput(0, graph()->NewNode(simplified()->NumberEqual(), input, | 774 node->ReplaceInput(0, graph()->NewNode(simplified()->NumberEqual(), input, |
| 775 jsgraph()->ZeroConstant())); | 775 jsgraph()->ZeroConstant())); |
| 776 node->TrimInputCount(1); | 776 node->TrimInputCount(1); |
| 777 NodeProperties::ChangeOp(node, simplified()->BooleanNot()); | 777 NodeProperties::ChangeOp(node, simplified()->BooleanNot()); |
| 778 return Changed(node); | 778 return Changed(node); |
| 779 } else if (input_type->Is(Type::Number())) { | 779 } else if (input_type->Is(Type::Number())) { |
| 780 // JSToBoolean(x:number) => NumberLessThan(#0,NumberAbs(x)) | 780 // JSToBoolean(x:number) => NumberToBoolean(x) |
| 781 RelaxEffectsAndControls(node); | 781 RelaxEffectsAndControls(node); |
| 782 node->ReplaceInput(0, jsgraph()->ZeroConstant()); | 782 node->TrimInputCount(1); |
| 783 node->ReplaceInput(1, graph()->NewNode(simplified()->NumberAbs(), input)); | 783 NodeProperties::ChangeOp(node, simplified()->NumberToBoolean()); |
| 784 node->TrimInputCount(2); | |
| 785 NodeProperties::ChangeOp(node, simplified()->NumberLessThan()); | |
| 786 return Changed(node); | 784 return Changed(node); |
| 787 } else if (input_type->Is(Type::String())) { | 785 } else if (input_type->Is(Type::String())) { |
| 788 // JSToBoolean(x:string) => NumberLessThan(#0,x.length) | 786 // JSToBoolean(x:string) => NumberLessThan(#0,x.length) |
| 789 FieldAccess const access = AccessBuilder::ForStringLength(); | 787 FieldAccess const access = AccessBuilder::ForStringLength(); |
| 790 Node* length = graph()->NewNode(simplified()->LoadField(access), input, | 788 Node* length = graph()->NewNode(simplified()->LoadField(access), input, |
| 791 graph()->start(), graph()->start()); | 789 graph()->start(), graph()->start()); |
| 792 ReplaceWithValue(node, node, length); | 790 ReplaceWithValue(node, node, length); |
| 793 node->ReplaceInput(0, jsgraph()->ZeroConstant()); | 791 node->ReplaceInput(0, jsgraph()->ZeroConstant()); |
| 794 node->ReplaceInput(1, length); | 792 node->ReplaceInput(1, length); |
| 795 NodeProperties::ChangeOp(node, simplified()->NumberLessThan()); | 793 NodeProperties::ChangeOp(node, simplified()->NumberLessThan()); |
| (...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2008 } | 2006 } |
| 2009 | 2007 |
| 2010 | 2008 |
| 2011 CompilationDependencies* JSTypedLowering::dependencies() const { | 2009 CompilationDependencies* JSTypedLowering::dependencies() const { |
| 2012 return dependencies_; | 2010 return dependencies_; |
| 2013 } | 2011 } |
| 2014 | 2012 |
| 2015 } // namespace compiler | 2013 } // namespace compiler |
| 2016 } // namespace internal | 2014 } // namespace internal |
| 2017 } // namespace v8 | 2015 } // namespace v8 |
| OLD | NEW |