Index: src/factory.h |
diff --git a/src/factory.h b/src/factory.h |
index 5e8970835b3d7dfc425496df4bc69bddaf42d804..233b3b01c824973f6376edccffa2d0aac131b89e 100644 |
--- a/src/factory.h |
+++ b/src/factory.h |
@@ -266,10 +266,12 @@ class Factory { |
PretenureFlag pretenure = NOT_TENURED); |
Handle<Object> NewNumberFromUint(uint32_t value, |
PretenureFlag pretenure = NOT_TENURED); |
- |
+ inline Handle<Object> NewNumberFromSize(size_t value, |
+ PretenureFlag pretenure = NOT_TENURED); |
Handle<HeapNumber> NewHeapNumber(double value, |
PretenureFlag pretenure = NOT_TENURED); |
+ |
// These objects are used by the api to create env-independent data |
// structures in the heap. |
Handle<JSObject> NewNeanderObject(); |
@@ -539,6 +541,18 @@ class Factory { |
}; |
+Handle<Object> Factory::NewNumberFromSize(size_t value, |
+ PretenureFlag pretenure) { |
+ if (Smi::IsValid(static_cast<intptr_t>(value))) { |
+ return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)), |
+ isolate()); |
+ } else { |
+ return NewNumber(static_cast<double>(value), pretenure); |
+ } |
+} |
+ |
+ |
+ |
} } // namespace v8::internal |
#endif // V8_FACTORY_H_ |