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

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

Issue 2138633002: [turbofan] Introduce CheckedInt32Div and CheckedInt32Mod operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comments 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/effect-control-linearizer.cc ('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 94c209d3a48986f3cd628ce6a6d3cee8cbfc27a4..6b5cb95f558ca64775fe5185905ca7dab75249a2 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -539,34 +539,49 @@ Reduction JSTypedLowering::ReduceJSDivide(Node* node) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
JSBinopReduction r(this, node);
BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
+ if (feedback == BinaryOperationHints::kNumberOrUndefined &&
+ r.BothInputsAre(Type::PlainPrimitive())) {
+ // JSDivide(x:plain-primitive,
+ // y:plain-primitive) => NumberDivide(ToNumber(x), ToNumber(y))
+ r.ConvertInputsToNumber();
+ return r.ChangeToPureOperator(simplified()->NumberDivide(), Type::Number());
+ }
if (feedback != BinaryOperationHints::kAny) {
return r.ChangeToSpeculativeOperator(
simplified()->SpeculativeNumberDivide(feedback), Type::Number());
}
-
- // If deoptimization is enabled we rely on type feedback.
- if (r.BothInputsAre(Type::PlainPrimitive()) ||
- !(flags() & kDeoptimizationEnabled)) {
+ if (r.BothInputsAre(Type::PlainPrimitive())) {
+ // JSDivide(x:plain-primitive,
+ // y:plain-primitive) => NumberDivide(ToNumber(x), ToNumber(y))
r.ConvertInputsToNumber();
return r.ChangeToPureOperator(simplified()->NumberDivide(), Type::Number());
}
-
return NoChange();
}
Reduction JSTypedLowering::ReduceJSModulus(Node* node) {
if (flags() & kDisableBinaryOpReduction) return NoChange();
JSBinopReduction r(this, node);
- if (r.BothInputsAre(Type::Number())) {
- // JSModulus(x:number, x:number) => NumberModulus(x, y)
+ BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
+ if (feedback == BinaryOperationHints::kNumberOrUndefined &&
+ r.BothInputsAre(Type::PlainPrimitive())) {
+ // JSModulus(x:plain-primitive,
+ // y:plain-primitive) => NumberModulus(ToNumber(x), ToNumber(y))
+ r.ConvertInputsToNumber();
return r.ChangeToPureOperator(simplified()->NumberModulus(),
Type::Number());
}
- BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
if (feedback != BinaryOperationHints::kAny) {
return r.ChangeToSpeculativeOperator(
simplified()->SpeculativeNumberModulus(feedback), Type::Number());
}
+ if (r.BothInputsAre(Type::PlainPrimitive())) {
+ // JSModulus(x:plain-primitive,
+ // y:plain-primitive) => NumberModulus(ToNumber(x), ToNumber(y))
+ r.ConvertInputsToNumber();
+ return r.ChangeToPureOperator(simplified()->NumberModulus(),
+ Type::Number());
+ }
return NoChange();
}
« no previous file with comments | « src/compiler/effect-control-linearizer.cc ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698