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/ast/modules.h" | 7 #include "src/ast/modules.h" |
8 #include "src/builtins/builtins-utils.h" | 8 #include "src/builtins/builtins-utils.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/compilation-dependencies.h" | 10 #include "src/compilation-dependencies.h" |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 return r.ChangeToPureOperator(simplified()->NumberEqual(), invert); | 882 return r.ChangeToPureOperator(simplified()->NumberEqual(), invert); |
883 } else if (r.GetCompareNumberOperationHint(&hint)) { | 883 } else if (r.GetCompareNumberOperationHint(&hint)) { |
884 return r.ChangeToSpeculativeOperator( | 884 return r.ChangeToSpeculativeOperator( |
885 simplified()->SpeculativeNumberEqual(hint), invert, Type::Boolean()); | 885 simplified()->SpeculativeNumberEqual(hint), invert, Type::Boolean()); |
886 } else if (r.BothInputsAre(Type::Number())) { | 886 } else if (r.BothInputsAre(Type::Number())) { |
887 return r.ChangeToPureOperator(simplified()->NumberEqual(), invert); | 887 return r.ChangeToPureOperator(simplified()->NumberEqual(), invert); |
888 } | 888 } |
889 return NoChange(); | 889 return NoChange(); |
890 } | 890 } |
891 | 891 |
| 892 Reduction JSTypedLowering::ReduceJSIsUndetectable(Node* node) { |
| 893 // ObjectIsUndetectable does not need a context input. So remove it. |
| 894 node->TrimInputCount(1); |
| 895 NodeProperties::ChangeOp(node, simplified()->ObjectIsUndetectable()); |
| 896 return Changed(node); |
| 897 } |
| 898 |
892 Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { | 899 Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) { |
893 JSBinopReduction r(this, node); | 900 JSBinopReduction r(this, node); |
894 if (r.left() == r.right()) { | 901 if (r.left() == r.right()) { |
895 // x === x is always true if x != NaN | 902 // x === x is always true if x != NaN |
896 if (!r.left_type()->Maybe(Type::NaN())) { | 903 if (!r.left_type()->Maybe(Type::NaN())) { |
897 Node* replacement = jsgraph()->BooleanConstant(!invert); | 904 Node* replacement = jsgraph()->BooleanConstant(!invert); |
898 ReplaceWithValue(node, replacement); | 905 ReplaceWithValue(node, replacement); |
899 return Replace(replacement); | 906 return Replace(replacement); |
900 } | 907 } |
901 } | 908 } |
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 } | 2209 } |
2203 | 2210 |
2204 Reduction JSTypedLowering::Reduce(Node* node) { | 2211 Reduction JSTypedLowering::Reduce(Node* node) { |
2205 switch (node->opcode()) { | 2212 switch (node->opcode()) { |
2206 case IrOpcode::kJSEqual: | 2213 case IrOpcode::kJSEqual: |
2207 return ReduceJSEqual(node, false); | 2214 return ReduceJSEqual(node, false); |
2208 case IrOpcode::kJSNotEqual: | 2215 case IrOpcode::kJSNotEqual: |
2209 return ReduceJSEqual(node, true); | 2216 return ReduceJSEqual(node, true); |
2210 case IrOpcode::kJSStrictEqual: | 2217 case IrOpcode::kJSStrictEqual: |
2211 return ReduceJSStrictEqual(node, false); | 2218 return ReduceJSStrictEqual(node, false); |
| 2219 case IrOpcode::kJSIsUndetectable: |
| 2220 return ReduceJSIsUndetectable(node); |
2212 case IrOpcode::kJSStrictNotEqual: | 2221 case IrOpcode::kJSStrictNotEqual: |
2213 return ReduceJSStrictEqual(node, true); | 2222 return ReduceJSStrictEqual(node, true); |
2214 case IrOpcode::kJSLessThan: // fall through | 2223 case IrOpcode::kJSLessThan: // fall through |
2215 case IrOpcode::kJSGreaterThan: // fall through | 2224 case IrOpcode::kJSGreaterThan: // fall through |
2216 case IrOpcode::kJSLessThanOrEqual: // fall through | 2225 case IrOpcode::kJSLessThanOrEqual: // fall through |
2217 case IrOpcode::kJSGreaterThanOrEqual: | 2226 case IrOpcode::kJSGreaterThanOrEqual: |
2218 return ReduceJSComparison(node); | 2227 return ReduceJSComparison(node); |
2219 case IrOpcode::kJSBitwiseOr: | 2228 case IrOpcode::kJSBitwiseOr: |
2220 case IrOpcode::kJSBitwiseXor: | 2229 case IrOpcode::kJSBitwiseXor: |
2221 case IrOpcode::kJSBitwiseAnd: | 2230 case IrOpcode::kJSBitwiseAnd: |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2308 } | 2317 } |
2309 | 2318 |
2310 | 2319 |
2311 CompilationDependencies* JSTypedLowering::dependencies() const { | 2320 CompilationDependencies* JSTypedLowering::dependencies() const { |
2312 return dependencies_; | 2321 return dependencies_; |
2313 } | 2322 } |
2314 | 2323 |
2315 } // namespace compiler | 2324 } // namespace compiler |
2316 } // namespace internal | 2325 } // namespace internal |
2317 } // namespace v8 | 2326 } // namespace v8 |
OLD | NEW |