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

Side by Side Diff: src/bootstrapper.cc

Issue 2643023002: [async-await] Move remaining async-await code to TF (Closed)
Patch Set: 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 3332 matching lines...) Expand 10 before | Expand all | Expand 10 after
3343 } 3343 }
3344 3344
3345 Handle<AccessorInfo> script_source_mapping_url = 3345 Handle<AccessorInfo> script_source_mapping_url =
3346 Accessors::ScriptSourceMappingUrlInfo(isolate, attribs); 3346 Accessors::ScriptSourceMappingUrlInfo(isolate, attribs);
3347 { 3347 {
3348 Descriptor d = Descriptor::AccessorConstant( 3348 Descriptor d = Descriptor::AccessorConstant(
3349 Handle<Name>(Name::cast(script_source_mapping_url->name())), 3349 Handle<Name>(Name::cast(script_source_mapping_url->name())),
3350 script_source_mapping_url, attribs); 3350 script_source_mapping_url, attribs);
3351 script_map->AppendDescriptor(&d); 3351 script_map->AppendDescriptor(&d);
3352 } 3352 }
3353 }
jgruber 2017/01/19 16:11:59 Sorry for the messy diff. I moved the AsyncFunctio
3354
3355 { // -- A s y n c F u n c t i o n
3356 // Builtin functions for AsyncFunction.
3357 PrototypeIterator iter(native_context->async_function_map());
3358 Handle<JSObject> async_function_prototype(iter.GetCurrent<JSObject>());
3359
3360 static const bool kUseStrictFunctionMap = true;
3361 Handle<JSFunction> async_function_constructor = InstallFunction(
3362 container, "AsyncFunction", JS_FUNCTION_TYPE, JSFunction::kSize,
3363 async_function_prototype, Builtins::kAsyncFunctionConstructor,
3364 kUseStrictFunctionMap);
3365 async_function_constructor->shared()->DontAdaptArguments();
3366 async_function_constructor->shared()->SetConstructStub(
3367 *isolate->builtins()->AsyncFunctionConstructor());
3368 async_function_constructor->shared()->set_length(1);
3369 InstallWithIntrinsicDefaultProto(isolate, async_function_constructor,
3370 Context::ASYNC_FUNCTION_FUNCTION_INDEX);
3371 JSObject::ForceSetPrototype(async_function_constructor,
3372 isolate->function_function());
3373
3374 JSObject::AddProperty(
3375 async_function_prototype, factory->constructor_string(),
3376 async_function_constructor,
3377 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY));
3378
3379 JSFunction::SetPrototype(async_function_constructor,
3380 async_function_prototype);
3353 3381
3354 { 3382 {
3355 PrototypeIterator iter(native_context->async_function_map()); 3383 Handle<JSFunction> function =
3356 Handle<JSObject> async_function_prototype(iter.GetCurrent<JSObject>()); 3384 SimpleCreateFunction(isolate, factory->empty_string(),
3385 Builtins::kAsyncFunctionAwaitCaught, 3, false);
3386 InstallWithIntrinsicDefaultProto(
3387 isolate, function, Context::ASYNC_FUNCTION_AWAIT_CAUGHT_INDEX);
3388 }
3357 3389
3358 static const bool kUseStrictFunctionMap = true; 3390 {
3359 Handle<JSFunction> async_function_constructor = InstallFunction( 3391 Handle<JSFunction> function =
3360 container, "AsyncFunction", JS_FUNCTION_TYPE, JSFunction::kSize, 3392 SimpleCreateFunction(isolate, factory->empty_string(),
3361 async_function_prototype, Builtins::kAsyncFunctionConstructor, 3393 Builtins::kAsyncFunctionAwaitUncaught, 3, false);
3362 kUseStrictFunctionMap); 3394 InstallWithIntrinsicDefaultProto(
3363 async_function_constructor->shared()->DontAdaptArguments(); 3395 isolate, function, Context::ASYNC_FUNCTION_AWAIT_UNCAUGHT_INDEX);
3364 async_function_constructor->shared()->SetConstructStub( 3396 }
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 3397
3372 JSObject::AddProperty( 3398 {
3373 async_function_prototype, factory->constructor_string(), 3399 Handle<Code> code =
3374 async_function_constructor, 3400 isolate->builtins()->AsyncFunctionAwaitRejectClosure();
3375 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); 3401 Handle<SharedFunctionInfo> info =
3402 factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
3403 info->set_internal_formal_parameter_count(1);
3404 info->set_length(1);
3405 native_context->set_async_function_await_reject_shared_fun(*info);
3406 }
3376 3407
3377 JSFunction::SetPrototype(async_function_constructor, 3408 {
3378 async_function_prototype); 3409 Handle<Code> code =
3410 isolate->builtins()->AsyncFunctionAwaitResolveClosure();
3411 Handle<SharedFunctionInfo> info =
3412 factory->NewSharedFunctionInfo(factory->empty_string(), code, false);
3413 info->set_internal_formal_parameter_count(1);
3414 info->set_length(1);
3415 native_context->set_async_function_await_resolve_shared_fun(*info);
3416 }
3379 3417
3380 Handle<JSFunction> async_function_next = 3418 {
3381 SimpleInstallFunction(container, "AsyncFunctionNext", 3419 Handle<JSFunction> function =
3382 Builtins::kGeneratorPrototypeNext, 1, true); 3420 SimpleCreateFunction(isolate, factory->empty_string(),
3383 Handle<JSFunction> async_function_throw = 3421 Builtins::kAsyncFunctionPromiseCreate, 0, false);
3384 SimpleInstallFunction(container, "AsyncFunctionThrow", 3422 InstallWithIntrinsicDefaultProto(
3385 Builtins::kGeneratorPrototypeThrow, 1, true); 3423 isolate, function, Context::ASYNC_FUNCTION_PROMISE_CREATE_INDEX);
3386 async_function_next->shared()->set_native(false); 3424 }
3387 async_function_throw->shared()->set_native(false);
3388 3425
3389 { 3426 {
3390 Handle<JSFunction> function = SimpleCreateFunction( 3427 Handle<JSFunction> function = SimpleCreateFunction(
3391 isolate, factory->empty_string(), 3428 isolate, factory->empty_string(),
3392 Builtins::kAsyncFunctionPromiseCreate, 0, false); 3429 Builtins::kAsyncFunctionPromiseRelease, 1, false);
3393 InstallWithIntrinsicDefaultProto( 3430 InstallWithIntrinsicDefaultProto(
3394 isolate, function, Context::ASYNC_FUNCTION_PROMISE_CREATE_INDEX); 3431 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 } 3432 }
3405 } 3433 }
3406 3434
3407 { // -- C a l l S i t e 3435 { // -- C a l l S i t e
3408 // Builtin functions for CallSite. 3436 // Builtin functions for CallSite.
3409 3437
3410 // CallSites are a special case; the constructor is for our private use 3438 // 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 3439 // only, therefore we set it up as a builtin that throws. Internally, we use
3412 // CallSiteUtils::Construct to create CallSite objects. 3440 // CallSiteUtils::Construct to create CallSite objects.
3413 3441
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
4816 } 4844 }
4817 4845
4818 4846
4819 // Called when the top-level V8 mutex is destroyed. 4847 // Called when the top-level V8 mutex is destroyed.
4820 void Bootstrapper::FreeThreadResources() { 4848 void Bootstrapper::FreeThreadResources() {
4821 DCHECK(!IsActive()); 4849 DCHECK(!IsActive());
4822 } 4850 }
4823 4851
4824 } // namespace internal 4852 } // namespace internal
4825 } // namespace v8 4853 } // namespace v8
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/builtins/builtins.h » ('j') | src/builtins/builtins-async-function.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698