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

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: Really fix the merge conflicts. 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 Reduction JSTypedLowering::ReduceUI32Shift(Node* node,
594 Signedness left_signedness,
595 const Operator* shift_op) {
594 if (flags() & kDisableIntegerBinaryOpReduction) return NoChange(); 596 if (flags() & kDisableIntegerBinaryOpReduction) return NoChange();
595
596 JSBinopReduction r(this, node); 597 JSBinopReduction r(this, node);
597 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); 598 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
598 if (feedback != BinaryOperationHints::kAny) { 599 if (feedback != BinaryOperationHints::kAny) {
600 Operator const* speculative_op;
601 if (shift_op->opcode() == IrOpcode::kNumberShiftLeft) {
602 speculative_op = simplified()->SpeculativeNumberShiftLeft(feedback);
603 } else if (shift_op->opcode() == IrOpcode::kNumberShiftRightLogical) {
604 speculative_op =
605 simplified()->SpeculativeNumberShiftRightLogical(feedback);
606 } else {
607 DCHECK(shift_op->opcode() == IrOpcode::kNumberShiftRight);
608 speculative_op = simplified()->SpeculativeNumberShiftRight(feedback);
609 }
599 return r.ChangeToSpeculativeOperator( 610 return r.ChangeToSpeculativeOperator(
600 simplified()->SpeculativeNumberShiftLeft(feedback), Type::Signed32()); 611 speculative_op, shift_op->opcode() == IrOpcode::kNumberShiftRightLogical
612 ? Type::Unsigned32()
613 : Type::Signed32());
601 } 614 }
602 615
603 // If deoptimization is enabled we rely on type feedback. 616 // If deoptimization is enabled we rely on type feedback.
604 if (r.BothInputsAre(Type::PlainPrimitive()) || 617 if (r.BothInputsAre(Type::PlainPrimitive()) ||
605 !(flags() & kDeoptimizationEnabled)) { 618 !(flags() & kDeoptimizationEnabled)) {
606 r.ConvertInputsToNumber(); 619 r.ConvertInputsToNumber();
607 r.ConvertInputsToUI32(kSigned, kUnsigned); 620 r.ConvertInputsToUI32(left_signedness, kUnsigned);
608 return r.ChangeToPureOperator(simplified()->NumberShiftLeft(), 621 return r.ChangeToPureOperator(shift_op);
609 Type::Number());
610 } 622 }
611 return NoChange(); 623 return NoChange();
612 } 624 }
613 625
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
626 Reduction JSTypedLowering::ReduceJSComparison(Node* node) { 626 Reduction JSTypedLowering::ReduceJSComparison(Node* node) {
627 JSBinopReduction r(this, node); 627 JSBinopReduction r(this, node);
628 if (r.BothInputsAre(Type::String())) { 628 if (r.BothInputsAre(Type::String())) {
629 // If both inputs are definitely strings, perform a string comparison. 629 // If both inputs are definitely strings, perform a string comparison.
630 const Operator* stringOp; 630 const Operator* stringOp;
631 switch (node->opcode()) { 631 switch (node->opcode()) {
632 case IrOpcode::kJSLessThan: 632 case IrOpcode::kJSLessThan:
633 stringOp = simplified()->StringLessThan(); 633 stringOp = simplified()->StringLessThan();
634 break; 634 break;
635 case IrOpcode::kJSGreaterThan: 635 case IrOpcode::kJSGreaterThan:
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 case IrOpcode::kJSLessThanOrEqual: // fall through 2042 case IrOpcode::kJSLessThanOrEqual: // fall through
2043 case IrOpcode::kJSGreaterThanOrEqual: 2043 case IrOpcode::kJSGreaterThanOrEqual:
2044 return ReduceJSComparison(node); 2044 return ReduceJSComparison(node);
2045 case IrOpcode::kJSBitwiseOr: 2045 case IrOpcode::kJSBitwiseOr:
2046 return ReduceInt32Binop(node, simplified()->NumberBitwiseOr()); 2046 return ReduceInt32Binop(node, simplified()->NumberBitwiseOr());
2047 case IrOpcode::kJSBitwiseXor: 2047 case IrOpcode::kJSBitwiseXor:
2048 return ReduceInt32Binop(node, simplified()->NumberBitwiseXor()); 2048 return ReduceInt32Binop(node, simplified()->NumberBitwiseXor());
2049 case IrOpcode::kJSBitwiseAnd: 2049 case IrOpcode::kJSBitwiseAnd:
2050 return ReduceInt32Binop(node, simplified()->NumberBitwiseAnd()); 2050 return ReduceInt32Binop(node, simplified()->NumberBitwiseAnd());
2051 case IrOpcode::kJSShiftLeft: 2051 case IrOpcode::kJSShiftLeft:
2052 return ReduceShiftLeft(node); 2052 return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftLeft());
2053 case IrOpcode::kJSShiftRight: 2053 case IrOpcode::kJSShiftRight:
2054 return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftRight()); 2054 return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftRight());
2055 case IrOpcode::kJSShiftRightLogical: 2055 case IrOpcode::kJSShiftRightLogical:
2056 return ReduceUI32Shift(node, kUnsigned, 2056 return ReduceUI32Shift(node, kUnsigned,
2057 simplified()->NumberShiftRightLogical()); 2057 simplified()->NumberShiftRightLogical());
2058 case IrOpcode::kJSAdd: 2058 case IrOpcode::kJSAdd:
2059 return ReduceJSAdd(node); 2059 return ReduceJSAdd(node);
2060 case IrOpcode::kJSSubtract: 2060 case IrOpcode::kJSSubtract:
2061 return ReduceJSSubtract(node); 2061 return ReduceJSSubtract(node);
2062 case IrOpcode::kJSMultiply: 2062 case IrOpcode::kJSMultiply:
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
2162 } 2162 }
2163 2163
2164 2164
2165 CompilationDependencies* JSTypedLowering::dependencies() const { 2165 CompilationDependencies* JSTypedLowering::dependencies() const {
2166 return dependencies_; 2166 return dependencies_;
2167 } 2167 }
2168 2168
2169 } // namespace compiler 2169 } // namespace compiler
2170 } // namespace internal 2170 } // namespace internal
2171 } // namespace v8 2171 } // 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