Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 2191883002: [turbofan] Adds speculative opcodes for shift right. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 583
584 Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) { 584 Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) {
585 if (flags() & kDisableIntegerBinaryOpReduction) return NoChange(); 585 if (flags() & kDisableIntegerBinaryOpReduction) return NoChange();
586 586
587 JSBinopReduction r(this, node); 587 JSBinopReduction r(this, node);
588 r.ConvertInputsToNumber(); 588 r.ConvertInputsToNumber();
589 r.ConvertInputsToUI32(kSigned, kSigned); 589 r.ConvertInputsToUI32(kSigned, kSigned);
590 return r.ChangeToPureOperator(intOp, Type::Integral32()); 590 return r.ChangeToPureOperator(intOp, Type::Integral32());
591 } 591 }
592 592
593 Reduction JSTypedLowering::ReduceShiftLeft(Node* node) { 593 static const Operator* SpeculativeVersionOf(
Benedikt Meurer 2016/07/28 16:43:02 Please make this a member function or even inline
epertoso 2016/07/29 09:35:13 Done.
594 SimplifiedOperatorBuilder* simplified, const Operator* shift_op,
595 BinaryOperationHints::Hint feedback) {
596 if (shift_op->opcode() == IrOpcode::kNumberShiftLeft) {
597 return simplified->SpeculativeNumberShiftLeft(feedback);
598 } else if (shift_op->opcode() == IrOpcode::kNumberShiftRightLogical) {
599 return simplified->SpeculativeNumberShiftRightLogical(feedback);
600 } else {
601 DCHECK(shift_op->opcode() == IrOpcode::kNumberShiftRight);
602 return simplified->SpeculativeNumberShiftRight(feedback);
603 }
604 }
605
606 Reduction JSTypedLowering::ReduceUI32Shift(Node* node,
607 Signedness left_signedness,
608 const Operator* shift_op) {
594 if (flags() & kDisableIntegerBinaryOpReduction) return NoChange(); 609 if (flags() & kDisableIntegerBinaryOpReduction) return NoChange();
595
596 JSBinopReduction r(this, node); 610 JSBinopReduction r(this, node);
597 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); 611 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
598 if (feedback != BinaryOperationHints::kAny) { 612 if (feedback != BinaryOperationHints::kAny) {
599 return r.ChangeToSpeculativeOperator( 613 return r.ChangeToSpeculativeOperator(
600 simplified()->SpeculativeNumberShiftLeft(feedback), Type::Signed32()); 614 SpeculativeVersionOf(simplified(), shift_op, feedback),
615 shift_op->opcode() == IrOpcode::kNumberShiftRightLogical
616 ? Type::Unsigned32()
617 : Type::Signed32());
601 } 618 }
602 619
603 // If deoptimization is enabled we rely on type feedback. 620 // If deoptimization is enabled we rely on type feedback.
604 if (r.BothInputsAre(Type::PlainPrimitive()) || 621 if (r.BothInputsAre(Type::PlainPrimitive()) ||
605 !(flags() & kDeoptimizationEnabled)) { 622 !(flags() & kDeoptimizationEnabled)) {
606 r.ConvertInputsToNumber(); 623 r.ConvertInputsToNumber();
607 r.ConvertInputsToUI32(kSigned, kUnsigned); 624 r.ConvertInputsToUI32(left_signedness, kUnsigned);
608 return r.ChangeToPureOperator(simplified()->NumberShiftLeft(), 625 return r.ChangeToPureOperator(shift_op);
609 Type::Number());
610 } 626 }
611 return NoChange(); 627 return NoChange();
612 } 628 }
613 629
614 Reduction JSTypedLowering::ReduceUI32Shift(Node* node,
615 Signedness left_signedness,
616 const Operator* shift_op) {
617 if (flags() & kDisableIntegerBinaryOpReduction) return NoChange();
618
619 JSBinopReduction r(this, node);
620 r.ConvertInputsToNumber();
621 r.ConvertInputsToUI32(left_signedness, kUnsigned);
622 return r.ChangeToPureOperator(shift_op);
623 }
624
625 630
626 Reduction JSTypedLowering::ReduceJSComparison(Node* node) { 631 Reduction JSTypedLowering::ReduceJSComparison(Node* node) {
627 JSBinopReduction r(this, node); 632 JSBinopReduction r(this, node);
628 if (r.BothInputsAre(Type::String())) { 633 if (r.BothInputsAre(Type::String())) {
629 // If both inputs are definitely strings, perform a string comparison. 634 // If both inputs are definitely strings, perform a string comparison.
630 const Operator* stringOp; 635 const Operator* stringOp;
631 switch (node->opcode()) { 636 switch (node->opcode()) {
632 case IrOpcode::kJSLessThan: 637 case IrOpcode::kJSLessThan:
633 stringOp = simplified()->StringLessThan(); 638 stringOp = simplified()->StringLessThan();
634 break; 639 break;
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1963 case IrOpcode::kJSLessThanOrEqual: // fall through 1968 case IrOpcode::kJSLessThanOrEqual: // fall through
1964 case IrOpcode::kJSGreaterThanOrEqual: 1969 case IrOpcode::kJSGreaterThanOrEqual:
1965 return ReduceJSComparison(node); 1970 return ReduceJSComparison(node);
1966 case IrOpcode::kJSBitwiseOr: 1971 case IrOpcode::kJSBitwiseOr:
1967 return ReduceInt32Binop(node, simplified()->NumberBitwiseOr()); 1972 return ReduceInt32Binop(node, simplified()->NumberBitwiseOr());
1968 case IrOpcode::kJSBitwiseXor: 1973 case IrOpcode::kJSBitwiseXor:
1969 return ReduceInt32Binop(node, simplified()->NumberBitwiseXor()); 1974 return ReduceInt32Binop(node, simplified()->NumberBitwiseXor());
1970 case IrOpcode::kJSBitwiseAnd: 1975 case IrOpcode::kJSBitwiseAnd:
1971 return ReduceInt32Binop(node, simplified()->NumberBitwiseAnd()); 1976 return ReduceInt32Binop(node, simplified()->NumberBitwiseAnd());
1972 case IrOpcode::kJSShiftLeft: 1977 case IrOpcode::kJSShiftLeft:
1973 return ReduceShiftLeft(node); 1978 return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftLeft());
1974 case IrOpcode::kJSShiftRight: 1979 case IrOpcode::kJSShiftRight:
1975 return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftRight()); 1980 return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftRight());
1976 case IrOpcode::kJSShiftRightLogical: 1981 case IrOpcode::kJSShiftRightLogical:
1977 return ReduceUI32Shift(node, kUnsigned, 1982 return ReduceUI32Shift(node, kUnsigned,
1978 simplified()->NumberShiftRightLogical()); 1983 simplified()->NumberShiftRightLogical());
1979 case IrOpcode::kJSAdd: 1984 case IrOpcode::kJSAdd:
1980 return ReduceJSAdd(node); 1985 return ReduceJSAdd(node);
1981 case IrOpcode::kJSSubtract: 1986 case IrOpcode::kJSSubtract:
1982 return ReduceJSSubtract(node); 1987 return ReduceJSSubtract(node);
1983 case IrOpcode::kJSMultiply: 1988 case IrOpcode::kJSMultiply:
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 } 2084 }
2080 2085
2081 2086
2082 CompilationDependencies* JSTypedLowering::dependencies() const { 2087 CompilationDependencies* JSTypedLowering::dependencies() const {
2083 return dependencies_; 2088 return dependencies_;
2084 } 2089 }
2085 2090
2086 } // namespace compiler 2091 } // namespace compiler
2087 } // namespace internal 2092 } // namespace internal
2088 } // namespace v8 2093 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698