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

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

Issue 2227463003: [WIP] NumberToString operator in TF. Base URL: https://chromium.googlesource.com/v8/v8.git@TurboFan_BuiltinTypingRules
Patch Set: Created 4 years, 4 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 f3ef778dc020d40213b1f5b2bb984031421816e5..564b3981020d72787fcf98d818b150cdd428bc7c 100644
--- a/src/compiler/operation-typer.cc
+++ b/src/compiler/operation-typer.cc
@@ -17,7 +17,7 @@ namespace internal {
namespace compiler {
OperationTyper::OperationTyper(Isolate* isolate, Zone* zone)
- : zone_(zone), cache_(TypeCache::Get()) {
+ : isolate_(isolate), zone_(zone), cache_(TypeCache::Get()) {
Factory* factory = isolate->factory();
infinity_ = Type::Constant(factory->infinity_value(), zone);
minus_infinity_ = Type::Constant(factory->minus_infinity_value(), zone);
@@ -484,6 +484,25 @@ Type* OperationTyper::NumberToUint32(Type* type) {
return Type::Unsigned32();
}
+Type* OperationTyper::NumberToString(Type* lhs, Type* rhs) {
+ DCHECK(lhs->Is(Type::Number()));
+ DCHECK(rhs->Is(Type::Unsigned30()));
+ if (!lhs->IsInhabited()) return Type::None();
+ if (lhs->Is(Type::NaN())) {
+ return Type::Constant(factory()->nan_string(), zone());
+ }
+ if (lhs->Is(cache_.kZeroish)) {
+ return Type::Constant(factory()->zero_string(), zone());
+ }
+ if (lhs->Is(infinity_)) {
+ return Type::Constant(factory()->infinity_string(), zone());
+ }
+ if (lhs->Is(minus_infinity_)) {
+ return Type::Constant(factory()->minus_infinity_string(), zone());
+ }
+ return Type::String();
+}
+
Type* OperationTyper::NumberSilenceNaN(Type* type) {
DCHECK(type->Is(Type::Number()));
// TODO(jarin): This is a terrible hack; we definitely need a dedicated type
@@ -963,6 +982,8 @@ Type* OperationTyper::TypeTypeGuard(const Operator* sigma_op, Type* input) {
return Type::Intersect(input, TypeGuardTypeOf(sigma_op), zone());
}
+Factory* OperationTyper::factory() const { return isolate()->factory(); }
+
} // namespace compiler
} // namespace internal
} // namespace v8
« 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