Index: src/factory.h |
diff --git a/src/factory.h b/src/factory.h |
index 98472ba0b83b152510a26d2d2180e25c1ba24269..4908d5fad85313cb0088582483a6d52ce11f6b71 100644 |
--- a/src/factory.h |
+++ b/src/factory.h |
@@ -380,6 +380,16 @@ class Factory final { |
} |
return NewNumber(static_cast<double>(value), pretenure); |
} |
+ Handle<Object> NewNumberFromInt64(int64_t value, |
+ PretenureFlag pretenure = NOT_TENURED) { |
+ if (value <= std::numeric_limits<int32_t>::max() && |
+ value >= std::numeric_limits<int32_t>::min() && |
+ Smi::IsValid(static_cast<int32_t>(value))) { |
+ return Handle<Object>(Smi::FromInt(static_cast<int32_t>(value)), |
+ isolate()); |
+ } |
+ return NewNumber(static_cast<double>(value), pretenure); |
+ } |
Handle<HeapNumber> NewHeapNumber(double value, |
MutableMode mode = IMMUTABLE, |
PretenureFlag pretenure = NOT_TENURED); |