summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/operation-typer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/compiler/operation-typer.cc')
-rw-r--r--deps/v8/src/compiler/operation-typer.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/deps/v8/src/compiler/operation-typer.cc b/deps/v8/src/compiler/operation-typer.cc
index 46d6557b21..5819655633 100644
--- a/deps/v8/src/compiler/operation-typer.cc
+++ b/deps/v8/src/compiler/operation-typer.cc
@@ -24,6 +24,8 @@ OperationTyper::OperationTyper(Isolate* isolate, Zone* zone)
Type* truncating_to_zero = Type::MinusZeroOrNaN();
DCHECK(!truncating_to_zero->Maybe(Type::Integral32()));
+ singleton_NaN_string_ = Type::HeapConstant(factory->NaN_string(), zone);
+ singleton_zero_string_ = Type::HeapConstant(factory->zero_string(), zone);
singleton_false_ = Type::HeapConstant(factory->false_value(), zone);
singleton_true_ = Type::HeapConstant(factory->true_value(), zone);
singleton_the_hole_ = Type::HeapConstant(factory->the_hole_value(), zone);
@@ -503,6 +505,14 @@ Type* OperationTyper::NumberToInt32(Type* type) {
return Type::Signed32();
}
+Type* OperationTyper::NumberToString(Type* type) {
+ DCHECK(type->Is(Type::Number()));
+
+ if (type->Is(Type::NaN())) return singleton_NaN_string_;
+ if (type->Is(cache_.kZeroOrMinusZero)) return singleton_zero_string_;
+ return Type::SeqString();
+}
+
Type* OperationTyper::NumberToUint32(Type* type) {
DCHECK(type->Is(Type::Number()));