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

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

Issue 2802113003: [turbofan] Introduce a SpeculativeToNumber operator. (Closed)
Patch Set: Paint it green! Created 3 years, 8 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/operation-typer.h ('k') | src/compiler/simplified-lowering.cc » ('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 73768dae733e70c9e4f2b5a81f698cb034edd62c..4576c8840d18ab15307d659ec3383e9dfa246ecb 100644
--- a/src/compiler/operation-typer.cc
+++ b/src/compiler/operation-typer.cc
@@ -968,11 +968,11 @@ Type* OperationTyper::NumberPow(Type* lhs, Type* rhs) {
return Type::Number();
}
-#define SPECULATIVE_NUMBER_BINOP(Name) \
- Type* OperationTyper::Speculative##Name(Type* lhs, Type* rhs) { \
- lhs = ToNumber(Type::Intersect(lhs, Type::NumberOrOddball(), zone())); \
- rhs = ToNumber(Type::Intersect(rhs, Type::NumberOrOddball(), zone())); \
- return Name(lhs, rhs); \
+#define SPECULATIVE_NUMBER_BINOP(Name) \
+ Type* OperationTyper::Speculative##Name(Type* lhs, Type* rhs) { \
+ lhs = SpeculativeToNumber(lhs); \
+ rhs = SpeculativeToNumber(rhs); \
+ return Name(lhs, rhs); \
}
SPECULATIVE_NUMBER_BINOP(NumberAdd)
SPECULATIVE_NUMBER_BINOP(NumberSubtract)
@@ -987,6 +987,10 @@ SPECULATIVE_NUMBER_BINOP(NumberShiftRight)
SPECULATIVE_NUMBER_BINOP(NumberShiftRightLogical)
#undef SPECULATIVE_NUMBER_BINOP
+Type* OperationTyper::SpeculativeToNumber(Type* type) {
+ return ToNumber(Type::Intersect(type, Type::NumberOrOddball(), zone()));
+}
+
Type* OperationTyper::ToPrimitive(Type* type) {
if (type->Is(Type::Primitive()) && !type->Maybe(Type::Receiver())) {
return type;
« no previous file with comments | « src/compiler/operation-typer.h ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698