Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 468a01d6949bc2cdf20928dcb4eb33da3af36400..76084cfd58ac23b7b3a350049830a80bb9f664ed 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -2531,6 +2531,14 @@ bool Heap::CreateInitialMaps() { |
} |
set_message_object_map(Map::cast(obj)); |
+ Map* external_map; |
+ { MaybeObject* maybe_obj = |
+ AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize + kPointerSize); |
+ if (!maybe_obj->To(&external_map)) return false; |
+ } |
+ external_map->set_is_extensible(false); |
+ set_external_map(external_map); |
+ |
ASSERT(!InNewSpace(empty_fixed_array())); |
return true; |
} |
@@ -5133,6 +5141,20 @@ MaybeObject* Heap::AllocateScopeInfo(int length) { |
} |
+MaybeObject* Heap::AllocateExternal(void* value) { |
+ Foreign* foreign; |
+ { MaybeObject* maybe_result = AllocateForeign(static_cast<Address>(value)); |
+ if (!maybe_result->To(&foreign)) return maybe_result; |
+ } |
+ JSObject* external; |
+ { MaybeObject* maybe_result = AllocateJSObjectFromMap(external_map()); |
+ if (!maybe_result->To(&external)) return maybe_result; |
+ } |
+ external->SetInternalField(0, foreign); |
+ return external; |
+} |
+ |
+ |
MaybeObject* Heap::AllocateStruct(InstanceType type) { |
Map* map; |
switch (type) { |