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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 return r.ChangeToPureOperator(simplified()->NumberSubtract(), | 507 return r.ChangeToPureOperator(simplified()->NumberSubtract(), |
508 Type::Number()); | 508 Type::Number()); |
509 } | 509 } |
510 | 510 |
511 return NoChange(); | 511 return NoChange(); |
512 } | 512 } |
513 | 513 |
514 Reduction JSTypedLowering::ReduceJSMultiply(Node* node) { | 514 Reduction JSTypedLowering::ReduceJSMultiply(Node* node) { |
515 JSBinopReduction r(this, node); | 515 JSBinopReduction r(this, node); |
516 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); | 516 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); |
| 517 if (feedback == BinaryOperationHints::kNumberOrOddball && |
| 518 r.BothInputsAre(Type::PlainPrimitive())) { |
| 519 // JSMultiply(x:plain-primitive, |
| 520 // y:plain-primitive) => NumberMultiply(ToNumber(x), ToNumber(y)) |
| 521 r.ConvertInputsToNumber(); |
| 522 return r.ChangeToPureOperator(simplified()->NumberMultiply(), |
| 523 Type::Number()); |
| 524 } |
517 if (feedback != BinaryOperationHints::kAny) { | 525 if (feedback != BinaryOperationHints::kAny) { |
518 return r.ChangeToSpeculativeOperator( | 526 return r.ChangeToSpeculativeOperator( |
519 simplified()->SpeculativeNumberMultiply(feedback), Type::Number()); | 527 simplified()->SpeculativeNumberMultiply(feedback), Type::Number()); |
520 } | 528 } |
521 | 529 |
522 // If deoptimization is enabled we rely on type feedback. | 530 // If deoptimization is enabled we rely on type feedback. |
523 if (r.BothInputsAre(Type::PlainPrimitive()) || | 531 if (r.BothInputsAre(Type::PlainPrimitive()) || |
524 !(flags() & kDeoptimizationEnabled)) { | 532 !(flags() & kDeoptimizationEnabled)) { |
525 r.ConvertInputsToNumber(); | 533 r.ConvertInputsToNumber(); |
526 return r.ChangeToPureOperator(simplified()->NumberMultiply(), | 534 return r.ChangeToPureOperator(simplified()->NumberMultiply(), |
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2059 } | 2067 } |
2060 | 2068 |
2061 | 2069 |
2062 CompilationDependencies* JSTypedLowering::dependencies() const { | 2070 CompilationDependencies* JSTypedLowering::dependencies() const { |
2063 return dependencies_; | 2071 return dependencies_; |
2064 } | 2072 } |
2065 | 2073 |
2066 } // namespace compiler | 2074 } // namespace compiler |
2067 } // namespace internal | 2075 } // namespace internal |
2068 } // namespace v8 | 2076 } // namespace v8 |
OLD | NEW |