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 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 InstallWithIntrinsicDefaultProto(isolate, promise_catch, | 1884 InstallWithIntrinsicDefaultProto(isolate, promise_catch, |
1885 Context::PROMISE_CATCH_INDEX); | 1885 Context::PROMISE_CATCH_INDEX); |
1886 | 1886 |
1887 SimpleInstallGetter(promise_fun, factory->symbol_species_string(), | 1887 SimpleInstallGetter(promise_fun, factory->symbol_species_string(), |
1888 factory->species_symbol(), Builtins::kReturnReceiver, | 1888 factory->species_symbol(), Builtins::kReturnReceiver, |
1889 true); | 1889 true); |
1890 | 1890 |
1891 SimpleInstallFunction(promise_fun, "resolve", Builtins::kPromiseResolve, 1, | 1891 SimpleInstallFunction(promise_fun, "resolve", Builtins::kPromiseResolve, 1, |
1892 true, DONT_ENUM); | 1892 true, DONT_ENUM); |
1893 | 1893 |
| 1894 SimpleInstallFunction(promise_fun, "reject", Builtins::kPromiseReject, 1, |
| 1895 true, DONT_ENUM); |
| 1896 |
1894 Handle<Map> prototype_map(prototype->map()); | 1897 Handle<Map> prototype_map(prototype->map()); |
1895 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); | 1898 Map::SetShouldBeFastPrototypeMap(prototype_map, true, isolate); |
1896 | 1899 |
1897 // Store the initial Promise.prototype map. This is used in fast-path | 1900 // Store the initial Promise.prototype map. This is used in fast-path |
1898 // checks. Do not alter the prototype after this point. | 1901 // checks. Do not alter the prototype after this point. |
1899 native_context()->set_promise_prototype_map(*prototype_map); | 1902 native_context()->set_promise_prototype_map(*prototype_map); |
1900 | 1903 |
1901 { // Internal: PromiseInternalConstructor | 1904 { // Internal: PromiseInternalConstructor |
1902 Handle<JSFunction> function = | 1905 Handle<JSFunction> function = |
1903 SimpleCreateFunction(isolate, factory->empty_string(), | 1906 SimpleCreateFunction(isolate, factory->empty_string(), |
1904 Builtins::kPromiseInternalConstructor, 1, false); | 1907 Builtins::kPromiseInternalConstructor, 1, false); |
1905 InstallWithIntrinsicDefaultProto( | 1908 InstallWithIntrinsicDefaultProto( |
1906 isolate, function, Context::PROMISE_INTERNAL_CONSTRUCTOR_INDEX); | 1909 isolate, function, Context::PROMISE_INTERNAL_CONSTRUCTOR_INDEX); |
1907 } | 1910 } |
1908 | 1911 |
1909 { // Internal: PromiseCreateAndSet | |
1910 Handle<JSFunction> function = | |
1911 SimpleCreateFunction(isolate, factory->empty_string(), | |
1912 Builtins::kPromiseCreateAndSet, 2, false); | |
1913 InstallWithIntrinsicDefaultProto(isolate, function, | |
1914 Context::PROMISE_CREATE_AND_SET_INDEX); | |
1915 } | |
1916 | |
1917 { // Internal: IsPromise | 1912 { // Internal: IsPromise |
1918 Handle<JSFunction> function = SimpleCreateFunction( | 1913 Handle<JSFunction> function = SimpleCreateFunction( |
1919 isolate, factory->empty_string(), Builtins::kIsPromise, 1, false); | 1914 isolate, factory->empty_string(), Builtins::kIsPromise, 1, false); |
1920 InstallWithIntrinsicDefaultProto(isolate, function, | 1915 InstallWithIntrinsicDefaultProto(isolate, function, |
1921 Context::IS_PROMISE_INDEX); | 1916 Context::IS_PROMISE_INDEX); |
1922 } | 1917 } |
1923 | 1918 |
1924 { // Internal: PerformPromiseThen | 1919 { // Internal: PerformPromiseThen |
1925 Handle<JSFunction> function = | 1920 Handle<JSFunction> function = |
1926 SimpleCreateFunction(isolate, factory->empty_string(), | 1921 SimpleCreateFunction(isolate, factory->empty_string(), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); | 1961 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); |
1967 info->set_internal_formal_parameter_count(1); | 1962 info->set_internal_formal_parameter_count(1); |
1968 info->set_length(1); | 1963 info->set_length(1); |
1969 native_context()->set_promise_resolve_shared_fun(*info); | 1964 native_context()->set_promise_resolve_shared_fun(*info); |
1970 | 1965 |
1971 code = | 1966 code = |
1972 handle(isolate->builtins()->builtin(Builtins::kPromiseRejectClosure), | 1967 handle(isolate->builtins()->builtin(Builtins::kPromiseRejectClosure), |
1973 isolate); | 1968 isolate); |
1974 info = | 1969 info = |
1975 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); | 1970 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); |
1976 info->set_internal_formal_parameter_count(2); | 1971 info->set_internal_formal_parameter_count(1); |
1977 info->set_length(1); | 1972 info->set_length(1); |
1978 native_context()->set_promise_reject_shared_fun(*info); | 1973 native_context()->set_promise_reject_shared_fun(*info); |
1979 } | 1974 } |
1980 } | 1975 } |
1981 | 1976 |
1982 { // -- R e g E x p | 1977 { // -- R e g E x p |
1983 // Builtin functions for RegExp.prototype. | 1978 // Builtin functions for RegExp.prototype. |
1984 Handle<JSObject> prototype = | 1979 Handle<JSObject> prototype = |
1985 factory->NewJSObject(isolate->object_function(), TENURED); | 1980 factory->NewJSObject(isolate->object_function(), TENURED); |
1986 Handle<JSFunction> regexp_fun = | 1981 Handle<JSFunction> regexp_fun = |
(...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4730 } | 4725 } |
4731 | 4726 |
4732 | 4727 |
4733 // Called when the top-level V8 mutex is destroyed. | 4728 // Called when the top-level V8 mutex is destroyed. |
4734 void Bootstrapper::FreeThreadResources() { | 4729 void Bootstrapper::FreeThreadResources() { |
4735 DCHECK(!IsActive()); | 4730 DCHECK(!IsActive()); |
4736 } | 4731 } |
4737 | 4732 |
4738 } // namespace internal | 4733 } // namespace internal |
4739 } // namespace v8 | 4734 } // namespace v8 |
OLD | NEW |