Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index ed57b11dd03c3fecec4132a3978d94ec46df7e9e..c830bdbf88b5219f846c0c35edb0ee87058dbfb5 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -1816,9 +1816,25 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
prototype, factory->to_string_tag_symbol(), factory->Promise_string(), |
static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
- SimpleInstallFunction(prototype, "then", Builtins::kPromiseThen, 2, true, |
+ Handle<JSFunction> promise_then = |
+ SimpleCreateFunction(isolate, isolate->factory()->then_string(), |
+ Builtins::kPromiseThen, 2, true); |
+ JSObject::AddProperty(prototype, isolate->factory()->then_string(), |
+ promise_then, DONT_ENUM); |
+ InstallWithIntrinsicDefaultProto(isolate, promise_then, |
+ Context::PROMISE_THEN_INDEX); |
+ |
+ // TODO(gsathya): Move to TF |
+ SimpleInstallFunction(prototype, "catch", Builtins::kIllegal, 1, true, |
DONT_ENUM); |
+ Handle<Map> prototype_map(prototype->map()); |
+ Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); |
+ |
+ // Store the initial Promise.prototype map. This is used in fast-path |
+ // checks. Do not alter the prototype after this point. |
+ native_context()->set_promise_prototype_map(*prototype_map); |
+ |
{ // Internal: PromiseInternalConstructor |
Handle<JSFunction> function = |
SimpleCreateFunction(isolate, factory->empty_string(), |
@@ -1850,6 +1866,14 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, |
Context::PERFORM_PROMISE_THEN_INDEX); |
} |
+ { // Internal: ResolvePromise |
+ Handle<JSFunction> function = |
+ SimpleCreateFunction(isolate, factory->empty_string(), |
+ Builtins::kResolvePromise, 2, false); |
+ InstallWithIntrinsicDefaultProto(isolate, function, |
+ Context::RESOLVE_PROMISE_INDEX); |
+ } |
+ |
{ |
Handle<Code> code = |
handle(isolate->builtins()->builtin(Builtins::kPromiseResolveClosure), |