 Chromium Code Reviews
 Chromium Code Reviews Issue 2643023002:
  [async-await] Move remaining async-await code to TF  (Closed)
    
  
    Issue 2643023002:
  [async-await] Move remaining async-await code to TF  (Closed) 
  | Index: src/bootstrapper.cc | 
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc | 
| index 1eb1f06e26fa453569dd909bc3f55a80c477922c..295b932feedb8050876643c0620f35232476bb5e 100644 | 
| --- a/src/bootstrapper.cc | 
| +++ b/src/bootstrapper.cc | 
| @@ -3350,57 +3350,85 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate, | 
| script_source_mapping_url, attribs); | 
| script_map->AppendDescriptor(&d); | 
| } | 
| + } | 
| 
jgruber
2017/01/19 16:11:59
Sorry for the messy diff. I moved the AsyncFunctio
 | 
| + | 
| + { // -- 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); | 
| } | 
| } |