Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 63a50f3c065214182cea28d92b3f7c22b88bf802..f996922b1a80647d9a82fdb8086ef4313c789c46 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -2270,6 +2270,9 @@ bool Heap::CreateInitialMaps() { |
ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, optimized_out); |
ALLOCATE_MAP(ODDBALL_TYPE, Oddball::kSize, stale_register); |
+ ALLOCATE_MAP(JS_PROMISE_CAPABILITY_TYPE, JSPromiseCapability::kSize, |
+ js_promise_capability); |
+ |
for (unsigned i = 0; i < arraysize(string_type_table); i++) { |
const StringTypeTable& entry = string_type_table[i]; |
{ |
@@ -2876,6 +2879,42 @@ void Heap::CreateInitialObjects() { |
// Initialize compilation cache. |
isolate_->compilation_cache()->Clear(); |
+ |
+ // Finish creating JSPromiseCapabilityMap |
+ { |
+ // TODO(caitp): This initialization can be removed once PromiseCapability |
+ // object is no longer used by builtins implemented in javascript. |
+ Handle<Map> map = factory->js_promise_capability_map(); |
+ map->set_inobject_properties_or_constructor_function_index(3); |
+ |
+ Map::EnsureDescriptorSlack(map, 3); |
+ |
+ PropertyAttributes attrs = |
+ static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); |
+ { // promise |
+ Descriptor d = Descriptor::DataField(factory->promise_string(), |
+ JSPromiseCapability::kPromiseIndex, |
+ attrs, Representation::Tagged()); |
+ map->AppendDescriptor(&d); |
+ } |
+ |
+ { // resolve |
+ Descriptor d = Descriptor::DataField(factory->resolve_string(), |
+ JSPromiseCapability::kResolveIndex, |
+ attrs, Representation::Tagged()); |
+ map->AppendDescriptor(&d); |
+ } |
+ |
+ { // reject |
+ Descriptor d = Descriptor::DataField(factory->reject_string(), |
+ JSPromiseCapability::kRejectIndex, |
+ attrs, Representation::Tagged()); |
+ map->AppendDescriptor(&d); |
+ } |
+ |
+ map->set_is_extensible(false); |
+ set_js_promise_capability_map(*map); |
+ } |
} |
bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { |