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

Unified Diff: src/heap/heap.cc

Issue 2567333002: [promises] port NewPromiseCapability to TF (Closed)
Patch Set: fix cctests and stuff Created 4 years 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
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) {
« src/code-stub-assembler.cc ('K') | « src/heap/heap.h ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698