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

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 2150553002: [turbofan] Introduces the SpeculativeNumberShiftLeft opcode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index 2fa4eb4fae72c7e54a9769b4f0451980ba1a708b..d8ddd93d3bb13538dafe6fafb3099ba1e3e81aab 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -587,6 +587,27 @@ Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) {
return r.ChangeToPureOperator(intOp, Type::Integral32());
}
+Reduction JSTypedLowering::ReduceShiftLeft(Node* node) {
+ if (flags() & kDisableIntegerBinaryOpReduction) return NoChange();
+
+ JSBinopReduction r(this, node);
+ BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
+ if (feedback == BinaryOperationHints::kSigned32 ||
+ feedback == BinaryOperationHints::kSignedSmall) {
+ return r.ChangeToSpeculativeOperator(
+ simplified()->SpeculativeNumberShiftLeft(feedback), Type::Signed32());
+ }
+
+ // If deoptimization is enabled we rely on type feedback.
+ if (r.BothInputsAre(Type::PlainPrimitive()) ||
+ !(flags() & kDeoptimizationEnabled)) {
+ r.ConvertInputsToNumber();
+ r.ConvertInputsToUI32(kSigned, kUnsigned);
+ return r.ChangeToPureOperator(simplified()->NumberShiftLeft(),
+ Type::Number());
+ }
+ return NoChange();
+}
Reduction JSTypedLowering::ReduceUI32Shift(Node* node,
Signedness left_signedness,
@@ -1943,7 +1964,7 @@ Reduction JSTypedLowering::Reduce(Node* node) {
case IrOpcode::kJSBitwiseAnd:
return ReduceInt32Binop(node, simplified()->NumberBitwiseAnd());
case IrOpcode::kJSShiftLeft:
- return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftLeft());
+ return ReduceShiftLeft(node);
case IrOpcode::kJSShiftRight:
return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftRight());
case IrOpcode::kJSShiftRightLogical:
« 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