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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 isolate, function, Context::PROMISE_INTERNAL_CONSTRUCTOR_INDEX); 1928 isolate, function, Context::PROMISE_INTERNAL_CONSTRUCTOR_INDEX);
1929 } 1929 }
1930 1930
1931 { // Internal: IsPromise 1931 { // Internal: IsPromise
1932 Handle<JSFunction> function = SimpleCreateFunction( 1932 Handle<JSFunction> function = SimpleCreateFunction(
1933 isolate, factory->empty_string(), Builtins::kIsPromise, 1, false); 1933 isolate, factory->empty_string(), Builtins::kIsPromise, 1, false);
1934 InstallWithIntrinsicDefaultProto(isolate, function, 1934 InstallWithIntrinsicDefaultProto(isolate, function,
1935 Context::IS_PROMISE_INDEX); 1935 Context::IS_PROMISE_INDEX);
1936 } 1936 }
1937 1937
1938 { // Internal: PerformPromiseThen
1939 Handle<JSFunction> function =
1940 SimpleCreateFunction(isolate, factory->empty_string(),
1941 Builtins::kPerformPromiseThen, 4, false);
1942 InstallWithIntrinsicDefaultProto(isolate, function,
1943 Context::PERFORM_PROMISE_THEN_INDEX);
1944 }
1945
1946 { // Internal: ResolvePromise 1938 { // Internal: ResolvePromise
1947 // Also exposed as extrasUtils.resolvePromise. 1939 // Also exposed as extrasUtils.resolvePromise.
1948 Handle<JSFunction> function = SimpleCreateFunction( 1940 Handle<JSFunction> function = SimpleCreateFunction(
1949 isolate, factory->empty_string(), Builtins::kResolvePromise, 2, true); 1941 isolate, factory->empty_string(), Builtins::kResolvePromise, 2, true);
1950 InstallWithIntrinsicDefaultProto(isolate, function, 1942 InstallWithIntrinsicDefaultProto(isolate, function,
1951 Context::PROMISE_RESOLVE_INDEX); 1943 Context::PROMISE_RESOLVE_INDEX);
1952 } 1944 }
1953 1945
1954 { // Internal: PromiseHandle 1946 { // Internal: PromiseHandle
1955 Handle<JSFunction> function = SimpleCreateFunction( 1947 Handle<JSFunction> function = SimpleCreateFunction(
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
3343 } 3335 }
3344 3336
3345 Handle<AccessorInfo> script_source_mapping_url = 3337 Handle<AccessorInfo> script_source_mapping_url =
3346 Accessors::ScriptSourceMappingUrlInfo(isolate, attribs); 3338 Accessors::ScriptSourceMappingUrlInfo(isolate, attribs);
3347 { 3339 {
3348 Descriptor d = Descriptor::AccessorConstant( 3340 Descriptor d = Descriptor::AccessorConstant(
3349 Handle<Name>(Name::cast(script_source_mapping_url->name())), 3341 Handle<Name>(Name::cast(script_source_mapping_url->name())),
3350 script_source_mapping_url, attribs); 3342 script_source_mapping_url, attribs);
3351 script_map->AppendDescriptor(&d); 3343 script_map->AppendDescriptor(&d);
3352 } 3344 }
3345 }
3346
3347 { // -- A s y n c F u n c t i o n
3348 // Builtin functions for AsyncFunction.
3349 PrototypeIterator iter(native_context->async_function_map());
3350 Handle<JSObject> async_function_prototype(iter.GetCurrent<JSObject>());
3351
3352 static const bool kUseStrictFunctionMap = true;
3353 Handle<JSFunction> async_function_constructor = InstallFunction(
3354 container, "AsyncFunction", JS_FUNCTION_TYPE, JSFunction::kSize,
3355 async_function_prototype, Builtins::kAsyncFunctionConstructor,
3356 kUseStrictFunctionMap);
3357 async_function_constructor->shared()->DontAdaptArguments();
3358 async_function_constructor->shared()->SetConstructStub(
3359 *isolate->builtins()->AsyncFunctionConstructor());
3360 async_function_constructor->shared()->set_length(1);
3361 InstallWithIntrinsicDefaultProto(isolate, async_function_constructor,
3362 Context::ASYNC_FUNCTION_FUNCTION_INDEX);
3363 JSObject::ForceSetPrototype(async_function_constructor,
3364 isolate->function_function());
3365
3366 JSObject::AddProperty(
3367 async_function_prototype, factory->constructor_string(),
3368 async_function_constructor,
3369 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
3370
3371 JSFunction::SetPrototype(async_function_constructor,
3372 async_function_prototype);
3353 3373
3354 { 3374 {
3355 PrototypeIterator iter(native_context->async_function_map()); 3375 Handle<JSFunction> function =
3356 Handle<JSObject> async_function_prototype(iter.GetCurrent<JSObject>()); 3376 SimpleCreateFunction(isolate, factory->empty_string(),
3377 Builtins::kAsyncFunctionAwaitCaught, 3, false);
3378 InstallWithIntrinsicDefaultProto(
3379 isolate, function, Context::ASYNC_FUNCTION_AWAIT_CAUGHT_INDEX);
3380 }
3357 3381
3358 static const bool kUseStrictFunctionMap = true; 3382 {
3359 Handle<JSFunction> async_function_constructor = InstallFunction( 3383 Handle<JSFunction> function =
3360 container, "AsyncFunction", JS_FUNCTION_TYPE, JSFunction::kSize, 3384 SimpleCreateFunction(isolate, factory->empty_string(),
3361 async_function_prototype, Builtins::kAsyncFunctionConstructor, 3385 Builtins::kAsyncFunctionAwaitUncaught, 3, false);
3362 kUseStrictFunctionMap); 3386 InstallWithIntrinsicDefaultProto(
3363 async_function_constructor->shared()->DontAdaptArguments(); 3387 isolate, function, Context::ASYNC_FUNCTION_AWAIT_UNCAUGHT_INDEX);
3364 async_function_constructor->shared()->SetConstructStub( 3388 }
3365 *isolate->builtins()->AsyncFunctionConstructor());
3366 async_function_constructor->shared()->set_length(1);
3367 InstallWithIntrinsicDefaultProto(isolate, async_function_constructor,
3368 Context::ASYNC_FUNCTION_FUNCTION_INDEX);
3369 JSObject::ForceSetPrototype(async_function_constructor,
3370 isolate->function_function());
3371 3389
3372 JSObject::AddProperty( 3390 {
3373 async_function_prototype, factory->constructor_string(), 3391 Handle<Code> code =
3374 async_function_constructor, 3392 isolate->builtins()->AsyncFunctionAwaitRejectClosure();
3375 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); 3393 Handle<SharedFunctionInfo> info =
3394 factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
3395 info->set_internal_formal_parameter_count(1);
3396 info->set_length(1);
3397 native_context->set_async_function_await_reject_shared_fun(*info);
3398 }
3376 3399
3377 JSFunction::SetPrototype(async_function_constructor, 3400 {
3378 async_function_prototype); 3401 Handle<Code> code =
3402 isolate->builtins()->AsyncFunctionAwaitResolveClosure();
3403 Handle<SharedFunctionInfo> info =
3404 factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
3405 info->set_internal_formal_parameter_count(1);
3406 info->set_length(1);
3407 native_context->set_async_function_await_resolve_shared_fun(*info);
3408 }
3379 3409
3380 Handle<JSFunction> async_function_next = 3410 {
3381 SimpleInstallFunction(container, "AsyncFunctionNext", 3411 Handle<JSFunction> function =
3382 Builtins::kGeneratorPrototypeNext, 1, true); 3412 SimpleCreateFunction(isolate, factory->empty_string(),
3383 Handle<JSFunction> async_function_throw = 3413 Builtins::kAsyncFunctionPromiseCreate, 0, false);
3384 SimpleInstallFunction(container, "AsyncFunctionThrow", 3414 InstallWithIntrinsicDefaultProto(
3385 Builtins::kGeneratorPrototypeThrow, 1, true); 3415 isolate, function, Context::ASYNC_FUNCTION_PROMISE_CREATE_INDEX);
3386 async_function_next->shared()->set_native(false); 3416 }
3387 async_function_throw->shared()->set_native(false);
3388 3417
3389 { 3418 {
3390 Handle<JSFunction> function = SimpleCreateFunction( 3419 Handle<JSFunction> function = SimpleCreateFunction(
3391 isolate, factory->empty_string(), 3420 isolate, factory->empty_string(),
3392 Builtins::kAsyncFunctionPromiseCreate, 0, false); 3421 Builtins::kAsyncFunctionPromiseRelease, 1, false);
3393 InstallWithIntrinsicDefaultProto( 3422 InstallWithIntrinsicDefaultProto(
3394 isolate, function, Context::ASYNC_FUNCTION_PROMISE_CREATE_INDEX); 3423 isolate, function, Context::ASYNC_FUNCTION_PROMISE_RELEASE_INDEX);
3395 }
3396
3397 {
3398 Handle<JSFunction> function = SimpleCreateFunction(
3399 isolate, factory->empty_string(),
3400 Builtins::kAsyncFunctionPromiseRelease, 1, false);
3401 InstallWithIntrinsicDefaultProto(
3402 isolate, function, Context::ASYNC_FUNCTION_PROMISE_RELEASE_INDEX);
3403 }
3404 } 3424 }
3405 } 3425 }
3406 3426
3407 { // -- C a l l S i t e 3427 { // -- C a l l S i t e
3408 // Builtin functions for CallSite. 3428 // Builtin functions for CallSite.
3409 3429
3410 // CallSites are a special case; the constructor is for our private use 3430 // CallSites are a special case; the constructor is for our private use
3411 // only, therefore we set it up as a builtin that throws. Internally, we use 3431 // only, therefore we set it up as a builtin that throws. Internally, we use
3412 // CallSiteUtils::Construct to create CallSite objects. 3432 // CallSiteUtils::Construct to create CallSite objects.
3413 3433
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
4816 } 4836 }
4817 4837
4818 4838
4819 // Called when the top-level V8 mutex is destroyed. 4839 // Called when the top-level V8 mutex is destroyed.
4820 void Bootstrapper::FreeThreadResources() { 4840 void Bootstrapper::FreeThreadResources() {
4821 DCHECK(!IsActive()); 4841 DCHECK(!IsActive());
4822 } 4842 }
4823 4843
4824 } // namespace internal 4844 } // namespace internal
4825 } // namespace v8 4845 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698