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

Unified Diff: src/compiler/operation-typer.cc

Issue 2161013002: [turbofan] Fix typing rule for number addition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | test/mjsunit/regress/regress-crbug-629435.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/operation-typer.cc
diff --git a/src/compiler/operation-typer.cc b/src/compiler/operation-typer.cc
index e74e164bf9286669c662adb25bdc4c4b6c90aa1f..c189d5c854eb69beeb7088c67dc6bdad43736d91 100644
--- a/src/compiler/operation-typer.cc
+++ b/src/compiler/operation-typer.cc
@@ -299,7 +299,13 @@ Type* OperationTyper::NumberAdd(Type* lhs, Type* rhs) {
return Type::Number();
}
Type* int_lhs = Type::Intersect(lhs, cache_.kInteger, zone());
+ if (lhs->Maybe(Type::MinusZero())) {
+ int_lhs = Type::Union(int_lhs, cache_.kSingletonZero, zone());
+ }
Type* int_rhs = Type::Intersect(rhs, cache_.kInteger, zone());
+ if (rhs->Maybe(Type::MinusZero())) {
+ int_rhs = Type::Union(int_rhs, cache_.kSingletonZero, zone());
+ }
Type* result =
AddRanger(int_lhs->Min(), int_lhs->Max(), int_rhs->Min(), int_rhs->Max());
if (lhs->Maybe(Type::NaN()) || rhs->Maybe(Type::NaN())) {
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-629435.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698