Chromium Code Reviews| Index: src/heap/heap.cc |
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
| index 951199d8166568caac66afe426a4299c92e3d172..53d9569634ac6d09ebad96112f915d4003377482 100644 |
| --- a/src/heap/heap.cc |
| +++ b/src/heap/heap.cc |
| @@ -2267,6 +2267,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]; |
| { |
| @@ -2873,6 +2876,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 |
| + DataDescriptor d(factory->promise_string(), |
| + JSPromiseCapability::kPromiseIndex, attrs, |
| + Representation::Tagged()); |
| + map->AppendDescriptor(&d); |
| + } |
| + |
| + { // resolve |
| + DataDescriptor d(factory->resolve_string(), |
| + JSPromiseCapability::kResolveIndex, attrs, |
| + Representation::Tagged()); |
| + map->AppendDescriptor(&d); |
| + } |
| + |
| + { // reject |
| + DataDescriptor d(factory->reject_string(), |
| + JSPromiseCapability::kRejectIndex, attrs, |
| + Representation::Tagged()); |
| + map->AppendDescriptor(&d); |
| + } |
|
gsathya
2016/12/21 01:02:33
Honestly I feel like we could just use runtime cal
caitp
2016/12/21 21:01:13
To me, it seemed simpler to let it use in-object s
|
| + |
| + map->set_is_extensible(false); |
| + set_js_promise_capability_map(*map); |
| + } |
| } |
| bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { |