| Index: src/bootstrapper.cc
|
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
|
| index 7ab076aa2d4c5facaba8471d492be81c22a0ba56..bcf11f4b855681c658985323cda4cf3d4b94a803 100644
|
| --- a/src/bootstrapper.cc
|
| +++ b/src/bootstrapper.cc
|
| @@ -3624,6 +3624,57 @@ void Genesis::InitializeGlobal_harmony_async_iteration() {
|
| factory()->async_iterator_symbol());
|
| }
|
|
|
| +void Genesis::InitializeGlobal_harmony_promise_finally() {
|
| + if (!FLAG_harmony_promise_finally) return;
|
| +
|
| + Handle<JSFunction> constructor(native_context()->promise_function());
|
| + Handle<JSObject> prototype(JSObject::cast(constructor->instance_prototype()));
|
| + SimpleInstallFunction(prototype, "finally", Builtins::kPromiseFinally, 1,
|
| + true, DONT_ENUM);
|
| +
|
| + // The promise prototype map has changed because we added a property
|
| + // to prototype, so we update the saved map.
|
| + Handle<Map> prototype_map(prototype->map());
|
| + Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate());
|
| + native_context()->set_promise_prototype_map(*prototype_map);
|
| +
|
| + Handle<Code> code = handle(
|
| + isolate()->builtins()->builtin(Builtins::kPromiseThenFinally), isolate());
|
| + Handle<SharedFunctionInfo> info =
|
| + factory()->NewSharedFunctionInfo(factory()->empty_string(), code, false);
|
| + info->set_internal_formal_parameter_count(1);
|
| + info->set_length(1);
|
| + info->set_native(true);
|
| + native_context()->set_promise_then_finally_shared_fun(*info);
|
| +
|
| + code = handle(isolate()->builtins()->builtin(Builtins::kPromiseCatchFinally),
|
| + isolate());
|
| + info =
|
| + factory()->NewSharedFunctionInfo(factory()->empty_string(), code, false);
|
| + info->set_internal_formal_parameter_count(1);
|
| + info->set_length(1);
|
| + info->set_native(true);
|
| + native_context()->set_promise_catch_finally_shared_fun(*info);
|
| +
|
| + code = handle(
|
| + isolate()->builtins()->builtin(Builtins::kPromiseValueThunkFinally),
|
| + isolate());
|
| + info =
|
| + factory()->NewSharedFunctionInfo(factory()->empty_string(), code, false);
|
| + info->set_internal_formal_parameter_count(0);
|
| + info->set_length(0);
|
| + native_context()->set_promise_value_thunk_finally_shared_fun(*info);
|
| +
|
| + code =
|
| + handle(isolate()->builtins()->builtin(Builtins::kPromiseThrowerFinally),
|
| + isolate());
|
| + info =
|
| + factory()->NewSharedFunctionInfo(factory()->empty_string(), code, false);
|
| + info->set_internal_formal_parameter_count(0);
|
| + info->set_length(0);
|
| + native_context()->set_promise_thrower_finally_shared_fun(*info);
|
| +}
|
| +
|
| Handle<JSFunction> Genesis::InstallArrayBuffer(Handle<JSObject> target,
|
| const char* name,
|
| Builtins::Name call,
|
| @@ -4090,6 +4141,7 @@ bool Genesis::InstallExperimentalNatives() {
|
| static const char* harmony_object_rest_spread_natives[] = {nullptr};
|
| static const char* harmony_async_iteration_natives[] = {nullptr};
|
| static const char* harmony_dynamic_import_natives[] = {nullptr};
|
| + static const char* harmony_promise_finally_natives[] = {nullptr};
|
|
|
| for (int i = ExperimentalNatives::GetDebuggerCount();
|
| i < ExperimentalNatives::GetBuiltinsCount(); i++) {
|
|
|