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

Unified Diff: src/compiler/simplified-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, 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/opcodes.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index 46cf22c2e60748927e4e49ff1e279df2eeb00b4c..093b09ecc0f711bd466af097dc88750097a1431f 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -1692,6 +1692,35 @@ class RepresentationSelector {
}
return;
}
+ case IrOpcode::kSpeculativeNumberShiftRight: {
+ // ToNumber(x) can throw if x is either a Receiver or a Symbol, so we
+ // can only eliminate an unused speculative number operation if we know
+ // that the inputs are PlainPrimitive, which excludes everything that's
+ // might have side effects or throws during a ToNumber conversion.
+ if (BothInputsAre(node, Type::PlainPrimitive())) {
+ if (truncation.IsUnused()) return VisitUnused(node);
+ }
+ if (BothInputsAre(node, Type::NumberOrOddball())) {
+ Type* rhs_type = GetUpperBound(node->InputAt(1));
+ VisitBinop(node, UseInfo::TruncatingWord32(),
+ UseInfo::TruncatingWord32(),
+ MachineRepresentation::kWord32);
+ if (lower()) {
+ lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type);
+ }
+ return;
+ }
+ BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op());
+ Type* rhs_type = GetUpperBound(node->InputAt(1));
+ VisitBinop(node, hint == BinaryOperationHints::kNumberOrOddball
+ ? UseInfo::CheckedNumberOrOddballAsWord32()
+ : UseInfo::CheckedSigned32AsWord32(),
+ MachineRepresentation::kWord32, Type::Signed32());
+ if (lower()) {
+ lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type);
+ }
+ return;
+ }
case IrOpcode::kNumberShiftRightLogical: {
Type* rhs_type = GetUpperBound(node->InputAt(1));
VisitBinop(node, UseInfo::TruncatingWord32(),
@@ -1701,6 +1730,35 @@ class RepresentationSelector {
}
return;
}
+ case IrOpcode::kSpeculativeNumberShiftRightLogical: {
+ // ToNumber(x) can throw if x is either a Receiver or a Symbol, so we
+ // can only eliminate an unused speculative number operation if we know
+ // that the inputs are PlainPrimitive, which excludes everything that's
+ // might have side effects or throws during a ToNumber conversion.
+ if (BothInputsAre(node, Type::PlainPrimitive())) {
+ if (truncation.IsUnused()) return VisitUnused(node);
+ }
+ if (BothInputsAre(node, Type::NumberOrOddball())) {
+ Type* rhs_type = GetUpperBound(node->InputAt(1));
+ VisitBinop(node, UseInfo::TruncatingWord32(),
+ UseInfo::TruncatingWord32(),
+ MachineRepresentation::kWord32);
+ if (lower()) {
+ lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type);
+ }
+ return;
+ }
+ BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op());
+ Type* rhs_type = GetUpperBound(node->InputAt(1));
+ VisitBinop(node, hint == BinaryOperationHints::kNumberOrOddball
+ ? UseInfo::CheckedNumberOrOddballAsWord32()
+ : UseInfo::CheckedSigned32AsWord32(),
+ MachineRepresentation::kWord32, Type::Unsigned32());
+ if (lower()) {
+ lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type);
+ }
+ return;
+ }
case IrOpcode::kNumberAbs: {
if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32())) {
VisitUnop(node, UseInfo::TruncatingWord32(),
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698