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

Unified Diff: src/heap.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/heap.h ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index c4cf04ad1ed20bff3f813ee8ab220a01d416aa57..118e071fde51fd7c7570cfa39fd5fb64eb98efeb 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -2528,6 +2528,8 @@ bool Heap::CreateInitialMaps() {
ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, scope_info)
ALLOCATE_MAP(HEAP_NUMBER_TYPE, HeapNumber::kSize, heap_number)
+ ALLOCATE_MAP(
+ MUTABLE_HEAP_NUMBER_TYPE, HeapNumber::kSize, mutable_heap_number)
ALLOCATE_MAP(SYMBOL_TYPE, Symbol::kSize, symbol)
ALLOCATE_MAP(FOREIGN_TYPE, Foreign::kSize, foreign)
@@ -2652,6 +2654,7 @@ bool Heap::CreateInitialMaps() {
AllocationResult Heap::AllocateHeapNumber(double value,
+ MutableMode mode,
PretenureFlag pretenure) {
// Statically ensure that it is safe to allocate heap numbers in paged
// spaces.
@@ -2665,7 +2668,8 @@ AllocationResult Heap::AllocateHeapNumber(double value,
if (!allocation.To(&result)) return allocation;
}
- result->set_map_no_write_barrier(heap_number_map());
+ Map* map = mode == MUTABLE ? mutable_heap_number_map() : heap_number_map();
+ HeapObject::cast(result)->set_map_no_write_barrier(map);
HeapNumber::cast(result)->set_value(value);
return result;
}
@@ -2771,12 +2775,12 @@ void Heap::CreateInitialObjects() {
HandleScope scope(isolate());
Factory* factory = isolate()->factory();
- // The -0 value must be set before NumberFromDouble works.
- set_minus_zero_value(*factory->NewHeapNumber(-0.0, TENURED));
+ // The -0 value must be set before NewNumber works.
+ set_minus_zero_value(*factory->NewHeapNumber(-0.0, IMMUTABLE, TENURED));
ASSERT(std::signbit(minus_zero_value()->Number()) != 0);
- set_nan_value(*factory->NewHeapNumber(OS::nan_value(), TENURED));
- set_infinity_value(*factory->NewHeapNumber(V8_INFINITY, TENURED));
+ set_nan_value(*factory->NewHeapNumber(OS::nan_value(), IMMUTABLE, TENURED));
+ set_infinity_value(*factory->NewHeapNumber(V8_INFINITY, IMMUTABLE, TENURED));
// The hole has not been created yet, but we want to put something
// predictable in the gaps in the string table, so lets make that Smi zero.
« no previous file with comments | « src/heap.h ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698