| OLD | NEW |
| 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 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2027 InstallWithIntrinsicDefaultProto(isolate, promise_then, | 2027 InstallWithIntrinsicDefaultProto(isolate, promise_then, |
| 2028 Context::PROMISE_THEN_INDEX); | 2028 Context::PROMISE_THEN_INDEX); |
| 2029 | 2029 |
| 2030 Handle<JSFunction> promise_catch = SimpleInstallFunction( | 2030 Handle<JSFunction> promise_catch = SimpleInstallFunction( |
| 2031 prototype, "catch", Builtins::kPromiseCatch, 1, true, DONT_ENUM); | 2031 prototype, "catch", Builtins::kPromiseCatch, 1, true, DONT_ENUM); |
| 2032 InstallWithIntrinsicDefaultProto(isolate, promise_catch, | 2032 InstallWithIntrinsicDefaultProto(isolate, promise_catch, |
| 2033 Context::PROMISE_CATCH_INDEX); | 2033 Context::PROMISE_CATCH_INDEX); |
| 2034 | 2034 |
| 2035 InstallSpeciesGetter(promise_fun); | 2035 InstallSpeciesGetter(promise_fun); |
| 2036 | 2036 |
| 2037 SimpleInstallFunction(promise_fun, "resolve", Builtins::kPromiseResolve, 1, | 2037 Handle<JSFunction> resolve = SimpleInstallFunction( |
| 2038 true, DONT_ENUM); | 2038 promise_fun, "resolve", Builtins::kPromiseResolve, 1, true, DONT_ENUM); |
| 2039 resolve->shared()->set_is_promise_builtin(true); |
| 2039 | 2040 |
| 2040 SimpleInstallFunction(promise_fun, "reject", Builtins::kPromiseReject, 1, | 2041 Handle<JSFunction> reject = SimpleInstallFunction( |
| 2041 true, DONT_ENUM); | 2042 promise_fun, "reject", Builtins::kPromiseReject, 1, true, DONT_ENUM); |
| 2043 reject->shared()->set_is_promise_builtin(true); |
| 2042 | 2044 |
| 2043 Handle<Map> prototype_map(prototype->map()); | 2045 Handle<Map> prototype_map(prototype->map()); |
| 2044 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); | 2046 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); |
| 2045 | 2047 |
| 2046 // Store the initial Promise.prototype map. This is used in fast-path | 2048 // Store the initial Promise.prototype map. This is used in fast-path |
| 2047 // checks. Do not alter the prototype after this point. | 2049 // checks. Do not alter the prototype after this point. |
| 2048 native_context()->set_promise_prototype_map(*prototype_map); | 2050 native_context()->set_promise_prototype_map(*prototype_map); |
| 2049 | 2051 |
| 2050 { // Internal: PromiseInternalConstructor | 2052 { // Internal: PromiseInternalConstructor |
| 2051 // Also exposed as extrasUtils.createPromise. | 2053 // Also exposed as extrasUtils.createPromise. |
| (...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3510 | 3512 |
| 3511 JSFunction::SetPrototype(async_function_constructor, | 3513 JSFunction::SetPrototype(async_function_constructor, |
| 3512 async_function_prototype); | 3514 async_function_prototype); |
| 3513 | 3515 |
| 3514 { | 3516 { |
| 3515 Handle<JSFunction> function = | 3517 Handle<JSFunction> function = |
| 3516 SimpleCreateFunction(isolate, factory->empty_string(), | 3518 SimpleCreateFunction(isolate, factory->empty_string(), |
| 3517 Builtins::kAsyncFunctionAwaitCaught, 3, false); | 3519 Builtins::kAsyncFunctionAwaitCaught, 3, false); |
| 3518 InstallWithIntrinsicDefaultProto( | 3520 InstallWithIntrinsicDefaultProto( |
| 3519 isolate, function, Context::ASYNC_FUNCTION_AWAIT_CAUGHT_INDEX); | 3521 isolate, function, Context::ASYNC_FUNCTION_AWAIT_CAUGHT_INDEX); |
| 3522 function->shared()->set_is_promise_builtin(true); |
| 3520 } | 3523 } |
| 3521 | 3524 |
| 3522 { | 3525 { |
| 3523 Handle<JSFunction> function = | 3526 Handle<JSFunction> function = |
| 3524 SimpleCreateFunction(isolate, factory->empty_string(), | 3527 SimpleCreateFunction(isolate, factory->empty_string(), |
| 3525 Builtins::kAsyncFunctionAwaitUncaught, 3, false); | 3528 Builtins::kAsyncFunctionAwaitUncaught, 3, false); |
| 3526 InstallWithIntrinsicDefaultProto( | 3529 InstallWithIntrinsicDefaultProto( |
| 3527 isolate, function, Context::ASYNC_FUNCTION_AWAIT_UNCAUGHT_INDEX); | 3530 isolate, function, Context::ASYNC_FUNCTION_AWAIT_UNCAUGHT_INDEX); |
| 3531 function->shared()->set_is_promise_builtin(true); |
| 3528 } | 3532 } |
| 3529 | 3533 |
| 3530 { | 3534 { |
| 3531 Handle<Code> code = | 3535 Handle<Code> code = |
| 3532 isolate->builtins()->AsyncFunctionAwaitRejectClosure(); | 3536 isolate->builtins()->AsyncFunctionAwaitRejectClosure(); |
| 3533 Handle<SharedFunctionInfo> info = | 3537 Handle<SharedFunctionInfo> info = |
| 3534 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); | 3538 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); |
| 3535 info->set_internal_formal_parameter_count(1); | 3539 info->set_internal_formal_parameter_count(1); |
| 3536 info->set_length(1); | 3540 info->set_length(1); |
| 3537 native_context->set_async_function_await_reject_shared_fun(*info); | 3541 native_context->set_async_function_await_reject_shared_fun(*info); |
| (...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5096 } | 5100 } |
| 5097 | 5101 |
| 5098 | 5102 |
| 5099 // Called when the top-level V8 mutex is destroyed. | 5103 // Called when the top-level V8 mutex is destroyed. |
| 5100 void Bootstrapper::FreeThreadResources() { | 5104 void Bootstrapper::FreeThreadResources() { |
| 5101 DCHECK(!IsActive()); | 5105 DCHECK(!IsActive()); |
| 5102 } | 5106 } |
| 5103 | 5107 |
| 5104 } // namespace internal | 5108 } // namespace internal |
| 5105 } // namespace v8 | 5109 } // namespace v8 |
| OLD | NEW |