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

Unified Diff: src/bootstrapper.cc

Issue 2643023002: [async-await] Move remaining async-await code to TF (Closed)
Patch Set: Typo Created 3 years, 11 months 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/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 1eb1f06e26fa453569dd909bc3f55a80c477922c..8fe3358e2f79ad878e1dd53d8d4480710941b441 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1935,14 +1935,6 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Context::IS_PROMISE_INDEX);
}
- { // Internal: PerformPromiseThen
- Handle<JSFunction> function =
- SimpleCreateFunction(isolate, factory->empty_string(),
- Builtins::kPerformPromiseThen, 4, false);
- InstallWithIntrinsicDefaultProto(isolate, function,
- Context::PERFORM_PROMISE_THEN_INDEX);
- }
-
{ // Internal: ResolvePromise
// Also exposed as extrasUtils.resolvePromise.
Handle<JSFunction> function = SimpleCreateFunction(
@@ -3350,57 +3342,85 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
script_source_mapping_url, attribs);
script_map->AppendDescriptor(&d);
}
+ }
+
+ { // -- A s y n c F u n c t i o n
+ // Builtin functions for AsyncFunction.
+ PrototypeIterator iter(native_context->async_function_map());
+ Handle<JSObject> async_function_prototype(iter.GetCurrent<JSObject>());
+
+ static const bool kUseStrictFunctionMap = true;
+ Handle<JSFunction> async_function_constructor = InstallFunction(
+ container, "AsyncFunction", JS_FUNCTION_TYPE, JSFunction::kSize,
+ async_function_prototype, Builtins::kAsyncFunctionConstructor,
+ kUseStrictFunctionMap);
+ async_function_constructor->shared()->DontAdaptArguments();
+ async_function_constructor->shared()->SetConstructStub(
+ *isolate->builtins()->AsyncFunctionConstructor());
+ async_function_constructor->shared()->set_length(1);
+ InstallWithIntrinsicDefaultProto(isolate, async_function_constructor,
+ Context::ASYNC_FUNCTION_FUNCTION_INDEX);
+ JSObject::ForceSetPrototype(async_function_constructor,
+ isolate->function_function());
+
+ JSObject::AddProperty(
+ async_function_prototype, factory->constructor_string(),
+ async_function_constructor,
+ static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
+
+ JSFunction::SetPrototype(async_function_constructor,
+ async_function_prototype);
{
- PrototypeIterator iter(native_context->async_function_map());
- Handle<JSObject> async_function_prototype(iter.GetCurrent<JSObject>());
-
- static const bool kUseStrictFunctionMap = true;
- Handle<JSFunction> async_function_constructor = InstallFunction(
- container, "AsyncFunction", JS_FUNCTION_TYPE, JSFunction::kSize,
- async_function_prototype, Builtins::kAsyncFunctionConstructor,
- kUseStrictFunctionMap);
- async_function_constructor->shared()->DontAdaptArguments();
- async_function_constructor->shared()->SetConstructStub(
- *isolate->builtins()->AsyncFunctionConstructor());
- async_function_constructor->shared()->set_length(1);
- InstallWithIntrinsicDefaultProto(isolate, async_function_constructor,
- Context::ASYNC_FUNCTION_FUNCTION_INDEX);
- JSObject::ForceSetPrototype(async_function_constructor,
- isolate->function_function());
-
- JSObject::AddProperty(
- async_function_prototype, factory->constructor_string(),
- async_function_constructor,
- static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
-
- JSFunction::SetPrototype(async_function_constructor,
- async_function_prototype);
-
- Handle<JSFunction> async_function_next =
- SimpleInstallFunction(container, "AsyncFunctionNext",
- Builtins::kGeneratorPrototypeNext, 1, true);
- Handle<JSFunction> async_function_throw =
- SimpleInstallFunction(container, "AsyncFunctionThrow",
- Builtins::kGeneratorPrototypeThrow, 1, true);
- async_function_next->shared()->set_native(false);
- async_function_throw->shared()->set_native(false);
+ Handle<JSFunction> function =
+ SimpleCreateFunction(isolate, factory->empty_string(),
+ Builtins::kAsyncFunctionAwaitCaught, 3, false);
+ InstallWithIntrinsicDefaultProto(
+ isolate, function, Context::ASYNC_FUNCTION_AWAIT_CAUGHT_INDEX);
+ }
- {
- Handle<JSFunction> function = SimpleCreateFunction(
- isolate, factory->empty_string(),
- Builtins::kAsyncFunctionPromiseCreate, 0, false);
- InstallWithIntrinsicDefaultProto(
- isolate, function, Context::ASYNC_FUNCTION_PROMISE_CREATE_INDEX);
- }
+ {
+ Handle<JSFunction> function =
+ SimpleCreateFunction(isolate, factory->empty_string(),
+ Builtins::kAsyncFunctionAwaitUncaught, 3, false);
+ InstallWithIntrinsicDefaultProto(
+ isolate, function, Context::ASYNC_FUNCTION_AWAIT_UNCAUGHT_INDEX);
+ }
- {
- Handle<JSFunction> function = SimpleCreateFunction(
- isolate, factory->empty_string(),
- Builtins::kAsyncFunctionPromiseRelease, 1, false);
- InstallWithIntrinsicDefaultProto(
- isolate, function, Context::ASYNC_FUNCTION_PROMISE_RELEASE_INDEX);
- }
+ {
+ Handle<Code> code =
+ isolate->builtins()->AsyncFunctionAwaitRejectClosure();
+ Handle<SharedFunctionInfo> info =
+ factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
+ info->set_internal_formal_parameter_count(1);
+ info->set_length(1);
+ native_context->set_async_function_await_reject_shared_fun(*info);
+ }
+
+ {
+ Handle<Code> code =
+ isolate->builtins()->AsyncFunctionAwaitResolveClosure();
+ Handle<SharedFunctionInfo> info =
+ factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
+ info->set_internal_formal_parameter_count(1);
+ info->set_length(1);
+ native_context->set_async_function_await_resolve_shared_fun(*info);
+ }
+
+ {
+ Handle<JSFunction> function =
+ SimpleCreateFunction(isolate, factory->empty_string(),
+ Builtins::kAsyncFunctionPromiseCreate, 0, false);
+ InstallWithIntrinsicDefaultProto(
+ isolate, function, Context::ASYNC_FUNCTION_PROMISE_CREATE_INDEX);
+ }
+
+ {
+ Handle<JSFunction> function = SimpleCreateFunction(
+ isolate, factory->empty_string(),
+ Builtins::kAsyncFunctionPromiseRelease, 1, false);
+ InstallWithIntrinsicDefaultProto(
+ isolate, function, Context::ASYNC_FUNCTION_PROMISE_RELEASE_INDEX);
}
}

Powered by Google App Engine
This is Rietveld 408576698