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

Unified Diff: src/factory.cc

Issue 355793003: Replace HeapNumber as doublebox with an explicit MutableHeapNumber. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/factory.h ('k') | src/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 29e396b8db4c002d472a6aa8012e7e1326976166..af419ef5fcb747b2063999dfff291ab79a90443e 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1008,7 +1008,7 @@ Handle<Object> Factory::NewNumber(double value,
// We need to distinguish the minus zero value and this cannot be
// done after conversion to int. Doing this by comparing bit
// patterns is faster than using fpclassify() et al.
- if (IsMinusZero(value)) return NewHeapNumber(-0.0, pretenure);
+ if (IsMinusZero(value)) return NewHeapNumber(-0.0, IMMUTABLE, pretenure);
int int_value = FastD2I(value);
if (value == int_value && Smi::IsValid(int_value)) {
@@ -1016,15 +1016,15 @@ Handle<Object> Factory::NewNumber(double value,
}
// Materialize the value in the heap.
- return NewHeapNumber(value, pretenure);
+ return NewHeapNumber(value, IMMUTABLE, pretenure);
}
Handle<Object> Factory::NewNumberFromInt(int32_t value,
PretenureFlag pretenure) {
if (Smi::IsValid(value)) return handle(Smi::FromInt(value), isolate());
- // Bypass NumberFromDouble to avoid various redundant checks.
- return NewHeapNumber(FastI2D(value), pretenure);
+ // Bypass NewNumber to avoid various redundant checks.
+ return NewHeapNumber(FastI2D(value), IMMUTABLE, pretenure);
}
@@ -1034,15 +1034,17 @@ Handle<Object> Factory::NewNumberFromUint(uint32_t value,
if (int32v >= 0 && Smi::IsValid(int32v)) {
return handle(Smi::FromInt(int32v), isolate());
}
- return NewHeapNumber(FastUI2D(value), pretenure);
+ return NewHeapNumber(FastUI2D(value), IMMUTABLE, pretenure);
}
Handle<HeapNumber> Factory::NewHeapNumber(double value,
+ MutableMode mode,
PretenureFlag pretenure) {
CALL_HEAP_FUNCTION(
isolate(),
- isolate()->heap()->AllocateHeapNumber(value, pretenure), HeapNumber);
+ isolate()->heap()->AllocateHeapNumber(value, mode, pretenure),
+ HeapNumber);
}
« no previous file with comments | « src/factory.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698