Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index fa358c53929127218fbd4fd719d5bec8d3bab3b0..1d87c4d1ac7b85a450383aa5f82daa3dfb914477 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -3279,12 +3279,12 @@ bool Heap::CreateInitialObjects() { |
} |
set_observation_state(JSObject::cast(obj)); |
- { MaybeObject* maybe_obj = AllocateSymbol(); |
+ { MaybeObject* maybe_obj = AllocatePrivate(); |
if (!maybe_obj->ToObject(&obj)) return false; |
} |
set_frozen_symbol(Symbol::cast(obj)); |
- { MaybeObject* maybe_obj = AllocateSymbol(); |
+ { MaybeObject* maybe_obj = AllocatePrivate(); |
if (!maybe_obj->ToObject(&obj)) return false; |
} |
set_elements_transition_symbol(Symbol::cast(obj)); |
@@ -3295,7 +3295,7 @@ bool Heap::CreateInitialObjects() { |
SeededNumberDictionary::cast(obj)->set_requires_slow_elements(); |
set_empty_slow_element_dictionary(SeededNumberDictionary::cast(obj)); |
- { MaybeObject* maybe_obj = AllocateSymbol(); |
+ { MaybeObject* maybe_obj = AllocatePrivate(); |
if (!maybe_obj->ToObject(&obj)) return false; |
} |
set_observed_symbol(Symbol::cast(obj)); |
@@ -5596,7 +5596,21 @@ MaybeObject* Heap::AllocateSymbol() { |
Name::kIsNotArrayIndexMask | (hash << Name::kHashShift)); |
Symbol::cast(result)->set_name(undefined_value()); |
- ASSERT(result->IsSymbol()); |
+ ASSERT(result->IsSymbol() && !result->IsPrivate()); |
+ return result; |
+} |
+ |
+ |
+MaybeObject* Heap::AllocatePrivate() { |
+ STATIC_ASSERT(Private::kSize == Symbol::kSize); |
+ MaybeObject* maybe = AllocateSymbol(); |
+ Symbol* result; |
+ if (!maybe->To(&result)) return maybe; |
+ maybe = AllocateBox(undefined_value(), TENURED); |
+ Box* box; |
+ if (!maybe->To(&box)) return maybe; |
+ result->set_name(box); // Marker for private. |
+ ASSERT(result->IsPrivate()); |
return result; |
} |