Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index fb1d6e7beaf44b50e3e785ce5f57a7aa2e566c15..7fc2a303439a51fc5114424b79d8a8df1da92021 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1069,10 +1069,12 @@ Handle<Object> Factory::NewNumberFromInt(int32_t value, |
Handle<Object> Factory::NewNumberFromUint(uint32_t value, |
- PretenureFlag pretenure) { |
- CALL_HEAP_FUNCTION( |
- isolate(), |
- isolate()->heap()->NumberFromUint32(value, pretenure), Object); |
+ PretenureFlag pretenure) { |
+ int32_t int32v = static_cast<int32_t>(value); |
+ if (int32v >= 0 && Smi::IsValid(int32v)) { |
+ return handle(Smi::FromInt(int32v), isolate()); |
+ } |
+ return NewHeapNumber(FastUI2D(value), pretenure); |
} |
@@ -1416,9 +1418,7 @@ Handle<Code> Factory::NewCode(const CodeDesc& desc, |
code->CopyFrom(desc); |
#ifdef VERIFY_HEAP |
- if (FLAG_verify_heap) { |
- code->Verify(); |
- } |
+ if (FLAG_verify_heap) code->ObjectVerify(); |
#endif |
return code; |
} |