| 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 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1916 InstallWithIntrinsicDefaultProto(isolate, promise_then, | 1916 InstallWithIntrinsicDefaultProto(isolate, promise_then, |
| 1917 Context::PROMISE_THEN_INDEX); | 1917 Context::PROMISE_THEN_INDEX); |
| 1918 | 1918 |
| 1919 Handle<JSFunction> promise_catch = SimpleInstallFunction( | 1919 Handle<JSFunction> promise_catch = SimpleInstallFunction( |
| 1920 prototype, "catch", Builtins::kPromiseCatch, 1, true, DONT_ENUM); | 1920 prototype, "catch", Builtins::kPromiseCatch, 1, true, DONT_ENUM); |
| 1921 InstallWithIntrinsicDefaultProto(isolate, promise_catch, | 1921 InstallWithIntrinsicDefaultProto(isolate, promise_catch, |
| 1922 Context::PROMISE_CATCH_INDEX); | 1922 Context::PROMISE_CATCH_INDEX); |
| 1923 | 1923 |
| 1924 InstallSpeciesGetter(promise_fun); | 1924 InstallSpeciesGetter(promise_fun); |
| 1925 | 1925 |
| 1926 SimpleInstallFunction(promise_fun, "resolve", Builtins::kPromiseResolve, 1, | 1926 Handle<JSFunction> resolve = SimpleInstallFunction( |
| 1927 true, DONT_ENUM); | 1927 promise_fun, "resolve", Builtins::kPromiseResolve, 1, true, DONT_ENUM); |
| 1928 resolve->shared()->set_is_promise_builtin(true); |
| 1928 | 1929 |
| 1929 SimpleInstallFunction(promise_fun, "reject", Builtins::kPromiseReject, 1, | 1930 Handle<JSFunction> reject = SimpleInstallFunction( |
| 1930 true, DONT_ENUM); | 1931 promise_fun, "reject", Builtins::kPromiseReject, 1, true, DONT_ENUM); |
| 1932 reject->shared()->set_is_promise_builtin(true); |
| 1931 | 1933 |
| 1932 Handle<Map> prototype_map(prototype->map()); | 1934 Handle<Map> prototype_map(prototype->map()); |
| 1933 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); | 1935 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); |
| 1934 | 1936 |
| 1935 // Store the initial Promise.prototype map. This is used in fast-path | 1937 // Store the initial Promise.prototype map. This is used in fast-path |
| 1936 // checks. Do not alter the prototype after this point. | 1938 // checks. Do not alter the prototype after this point. |
| 1937 native_context()->set_promise_prototype_map(*prototype_map); | 1939 native_context()->set_promise_prototype_map(*prototype_map); |
| 1938 | 1940 |
| 1939 { // Internal: PromiseInternalConstructor | 1941 { // Internal: PromiseInternalConstructor |
| 1940 // Also exposed as extrasUtils.createPromise. | 1942 // Also exposed as extrasUtils.createPromise. |
| (...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3399 | 3401 |
| 3400 JSFunction::SetPrototype(async_function_constructor, | 3402 JSFunction::SetPrototype(async_function_constructor, |
| 3401 async_function_prototype); | 3403 async_function_prototype); |
| 3402 | 3404 |
| 3403 { | 3405 { |
| 3404 Handle<JSFunction> function = | 3406 Handle<JSFunction> function = |
| 3405 SimpleCreateFunction(isolate, factory->empty_string(), | 3407 SimpleCreateFunction(isolate, factory->empty_string(), |
| 3406 Builtins::kAsyncFunctionAwaitCaught, 3, false); | 3408 Builtins::kAsyncFunctionAwaitCaught, 3, false); |
| 3407 InstallWithIntrinsicDefaultProto( | 3409 InstallWithIntrinsicDefaultProto( |
| 3408 isolate, function, Context::ASYNC_FUNCTION_AWAIT_CAUGHT_INDEX); | 3410 isolate, function, Context::ASYNC_FUNCTION_AWAIT_CAUGHT_INDEX); |
| 3411 function->shared()->set_is_promise_builtin(true); |
| 3409 } | 3412 } |
| 3410 | 3413 |
| 3411 { | 3414 { |
| 3412 Handle<JSFunction> function = | 3415 Handle<JSFunction> function = |
| 3413 SimpleCreateFunction(isolate, factory->empty_string(), | 3416 SimpleCreateFunction(isolate, factory->empty_string(), |
| 3414 Builtins::kAsyncFunctionAwaitUncaught, 3, false); | 3417 Builtins::kAsyncFunctionAwaitUncaught, 3, false); |
| 3415 InstallWithIntrinsicDefaultProto( | 3418 InstallWithIntrinsicDefaultProto( |
| 3416 isolate, function, Context::ASYNC_FUNCTION_AWAIT_UNCAUGHT_INDEX); | 3419 isolate, function, Context::ASYNC_FUNCTION_AWAIT_UNCAUGHT_INDEX); |
| 3420 function->shared()->set_is_promise_builtin(true); |
| 3417 } | 3421 } |
| 3418 | 3422 |
| 3419 { | 3423 { |
| 3420 Handle<Code> code = | 3424 Handle<Code> code = |
| 3421 isolate->builtins()->AsyncFunctionAwaitRejectClosure(); | 3425 isolate->builtins()->AsyncFunctionAwaitRejectClosure(); |
| 3422 Handle<SharedFunctionInfo> info = | 3426 Handle<SharedFunctionInfo> info = |
| 3423 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); | 3427 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); |
| 3424 info->set_internal_formal_parameter_count(1); | 3428 info->set_internal_formal_parameter_count(1); |
| 3425 info->set_length(1); | 3429 info->set_length(1); |
| 3426 native_context->set_async_function_await_reject_shared_fun(*info); | 3430 native_context->set_async_function_await_reject_shared_fun(*info); |
| (...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4899 } | 4903 } |
| 4900 | 4904 |
| 4901 | 4905 |
| 4902 // Called when the top-level V8 mutex is destroyed. | 4906 // Called when the top-level V8 mutex is destroyed. |
| 4903 void Bootstrapper::FreeThreadResources() { | 4907 void Bootstrapper::FreeThreadResources() { |
| 4904 DCHECK(!IsActive()); | 4908 DCHECK(!IsActive()); |
| 4905 } | 4909 } |
| 4906 | 4910 |
| 4907 } // namespace internal | 4911 } // namespace internal |
| 4908 } // namespace v8 | 4912 } // namespace v8 |
| OLD | NEW |