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 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 Handle<JSFunction> promise_catch = SimpleInstallFunction( | 1892 Handle<JSFunction> promise_catch = SimpleInstallFunction( |
1893 prototype, "catch", Builtins::kPromiseCatch, 1, true, DONT_ENUM); | 1893 prototype, "catch", Builtins::kPromiseCatch, 1, true, DONT_ENUM); |
1894 InstallWithIntrinsicDefaultProto(isolate, promise_catch, | 1894 InstallWithIntrinsicDefaultProto(isolate, promise_catch, |
1895 Context::PROMISE_CATCH_INDEX); | 1895 Context::PROMISE_CATCH_INDEX); |
1896 | 1896 |
1897 InstallSpeciesGetter(promise_fun); | 1897 InstallSpeciesGetter(promise_fun); |
1898 | 1898 |
1899 SimpleInstallFunction(promise_fun, "resolve", Builtins::kPromiseResolve, 1, | 1899 SimpleInstallFunction(promise_fun, "resolve", Builtins::kPromiseResolve, 1, |
1900 true, DONT_ENUM); | 1900 true, DONT_ENUM); |
1901 | 1901 |
| 1902 SimpleInstallFunction(promise_fun, "reject", Builtins::kPromiseReject, 1, |
| 1903 true, DONT_ENUM); |
| 1904 |
1902 Handle<Map> prototype_map(prototype->map()); | 1905 Handle<Map> prototype_map(prototype->map()); |
1903 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); | 1906 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); |
1904 | 1907 |
1905 // Store the initial Promise.prototype map. This is used in fast-path | 1908 // Store the initial Promise.prototype map. This is used in fast-path |
1906 // checks. Do not alter the prototype after this point. | 1909 // checks. Do not alter the prototype after this point. |
1907 native_context()->set_promise_prototype_map(*prototype_map); | 1910 native_context()->set_promise_prototype_map(*prototype_map); |
1908 | 1911 |
1909 { // Internal: PromiseInternalConstructor | 1912 { // Internal: PromiseInternalConstructor |
1910 Handle<JSFunction> function = | 1913 Handle<JSFunction> function = |
1911 SimpleCreateFunction(isolate, factory->empty_string(), | 1914 SimpleCreateFunction(isolate, factory->empty_string(), |
1912 Builtins::kPromiseInternalConstructor, 1, false); | 1915 Builtins::kPromiseInternalConstructor, 1, false); |
1913 InstallWithIntrinsicDefaultProto( | 1916 InstallWithIntrinsicDefaultProto( |
1914 isolate, function, Context::PROMISE_INTERNAL_CONSTRUCTOR_INDEX); | 1917 isolate, function, Context::PROMISE_INTERNAL_CONSTRUCTOR_INDEX); |
1915 } | 1918 } |
1916 | 1919 |
1917 { // Internal: PromiseCreateAndSet | |
1918 Handle<JSFunction> function = | |
1919 SimpleCreateFunction(isolate, factory->empty_string(), | |
1920 Builtins::kPromiseCreateAndSet, 2, false); | |
1921 InstallWithIntrinsicDefaultProto(isolate, function, | |
1922 Context::PROMISE_CREATE_AND_SET_INDEX); | |
1923 } | |
1924 | |
1925 { // Internal: IsPromise | 1920 { // Internal: IsPromise |
1926 Handle<JSFunction> function = SimpleCreateFunction( | 1921 Handle<JSFunction> function = SimpleCreateFunction( |
1927 isolate, factory->empty_string(), Builtins::kIsPromise, 1, false); | 1922 isolate, factory->empty_string(), Builtins::kIsPromise, 1, false); |
1928 InstallWithIntrinsicDefaultProto(isolate, function, | 1923 InstallWithIntrinsicDefaultProto(isolate, function, |
1929 Context::IS_PROMISE_INDEX); | 1924 Context::IS_PROMISE_INDEX); |
1930 } | 1925 } |
1931 | 1926 |
1932 { // Internal: PerformPromiseThen | 1927 { // Internal: PerformPromiseThen |
1933 Handle<JSFunction> function = | 1928 Handle<JSFunction> function = |
1934 SimpleCreateFunction(isolate, factory->empty_string(), | 1929 SimpleCreateFunction(isolate, factory->empty_string(), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1974 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); | 1969 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); |
1975 info->set_internal_formal_parameter_count(1); | 1970 info->set_internal_formal_parameter_count(1); |
1976 info->set_length(1); | 1971 info->set_length(1); |
1977 native_context()->set_promise_resolve_shared_fun(*info); | 1972 native_context()->set_promise_resolve_shared_fun(*info); |
1978 | 1973 |
1979 code = | 1974 code = |
1980 handle(isolate->builtins()->builtin(Builtins::kPromiseRejectClosure), | 1975 handle(isolate->builtins()->builtin(Builtins::kPromiseRejectClosure), |
1981 isolate); | 1976 isolate); |
1982 info = | 1977 info = |
1983 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); | 1978 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); |
1984 info->set_internal_formal_parameter_count(2); | 1979 info->set_internal_formal_parameter_count(1); |
1985 info->set_length(1); | 1980 info->set_length(1); |
1986 native_context()->set_promise_reject_shared_fun(*info); | 1981 native_context()->set_promise_reject_shared_fun(*info); |
1987 } | 1982 } |
1988 } | 1983 } |
1989 | 1984 |
1990 { // -- R e g E x p | 1985 { // -- R e g E x p |
1991 // Builtin functions for RegExp.prototype. | 1986 // Builtin functions for RegExp.prototype. |
1992 Handle<JSObject> prototype = | 1987 Handle<JSObject> prototype = |
1993 factory->NewJSObject(isolate->object_function(), TENURED); | 1988 factory->NewJSObject(isolate->object_function(), TENURED); |
1994 Handle<JSFunction> regexp_fun = | 1989 Handle<JSFunction> regexp_fun = |
(...skipping 2747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4742 } | 4737 } |
4743 | 4738 |
4744 | 4739 |
4745 // Called when the top-level V8 mutex is destroyed. | 4740 // Called when the top-level V8 mutex is destroyed. |
4746 void Bootstrapper::FreeThreadResources() { | 4741 void Bootstrapper::FreeThreadResources() { |
4747 DCHECK(!IsActive()); | 4742 DCHECK(!IsActive()); |
4748 } | 4743 } |
4749 | 4744 |
4750 } // namespace internal | 4745 } // namespace internal |
4751 } // namespace v8 | 4746 } // namespace v8 |
OLD | NEW |