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 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 Builtins::kDatePrototypeToPrimitive, | 1836 Builtins::kDatePrototypeToPrimitive, |
1837 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); | 1837 static_cast<PropertyAttributes>(DONT_ENUM | READ_ONLY)); |
1838 | 1838 |
1839 // Set the expected parameters for @@toPrimitive to 1; required by builtin. | 1839 // Set the expected parameters for @@toPrimitive to 1; required by builtin. |
1840 to_primitive->shared()->set_internal_formal_parameter_count(1); | 1840 to_primitive->shared()->set_internal_formal_parameter_count(1); |
1841 | 1841 |
1842 // Set the length for the function to satisfy ECMA-262. | 1842 // Set the length for the function to satisfy ECMA-262. |
1843 to_primitive->shared()->set_length(1); | 1843 to_primitive->shared()->set_length(1); |
1844 } | 1844 } |
1845 | 1845 |
| 1846 { |
| 1847 Handle<Code> code = isolate->builtins()->PromiseGetCapabilitiesExecutor(); |
| 1848 Handle<SharedFunctionInfo> info = |
| 1849 factory->NewSharedFunctionInfo(factory->empty_string(), code, true); |
| 1850 info->SetConstructStub(*isolate->builtins()->JSBuiltinsConstructStub()); |
| 1851 info->set_instance_class_name(isolate->heap()->Object_string()); |
| 1852 info->set_internal_formal_parameter_count(2); |
| 1853 info->set_length(2); |
| 1854 native_context()->set_promise_get_capabilities_executor_shared_fun(*info); |
| 1855 |
| 1856 // %new_promise_capability(C, debugEvent) |
| 1857 Handle<JSFunction> new_promise_capability = |
| 1858 SimpleCreateFunction(isolate, factory->empty_string(), |
| 1859 Builtins::kNewPromiseCapability, 2, false); |
| 1860 InstallWithIntrinsicDefaultProto(isolate, new_promise_capability, |
| 1861 Context::NEW_PROMISE_CAPABILITY_INDEX); |
| 1862 } |
| 1863 |
1846 { // -- P r o m i s e | 1864 { // -- P r o m i s e |
1847 // Set catch prediction | 1865 // Set catch prediction |
1848 Handle<Code> promise_code = isolate->builtins()->PromiseConstructor(); | 1866 Handle<Code> promise_code = isolate->builtins()->PromiseConstructor(); |
1849 promise_code->set_is_promise_rejection(true); | 1867 promise_code->set_is_promise_rejection(true); |
1850 | 1868 |
1851 Handle<JSObject> prototype = | 1869 Handle<JSObject> prototype = |
1852 factory->NewJSObject(isolate->object_function(), TENURED); | 1870 factory->NewJSObject(isolate->object_function(), TENURED); |
1853 Handle<JSFunction> promise_fun = | 1871 Handle<JSFunction> promise_fun = |
1854 InstallFunction(global, "Promise", JS_PROMISE_TYPE, JSPromise::kSize, | 1872 InstallFunction(global, "Promise", JS_PROMISE_TYPE, JSPromise::kSize, |
1855 prototype, Builtins::kPromiseConstructor); | 1873 prototype, Builtins::kPromiseConstructor); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1965 | 1983 |
1966 code = | 1984 code = |
1967 handle(isolate->builtins()->builtin(Builtins::kPromiseRejectClosure), | 1985 handle(isolate->builtins()->builtin(Builtins::kPromiseRejectClosure), |
1968 isolate); | 1986 isolate); |
1969 info = | 1987 info = |
1970 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); | 1988 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); |
1971 info->set_internal_formal_parameter_count(2); | 1989 info->set_internal_formal_parameter_count(2); |
1972 info->set_length(1); | 1990 info->set_length(1); |
1973 native_context()->set_promise_reject_shared_fun(*info); | 1991 native_context()->set_promise_reject_shared_fun(*info); |
1974 } | 1992 } |
1975 | |
1976 Handle<JSFunction> create_resolving_functions = | |
1977 SimpleCreateFunction(isolate, factory->empty_string(), | |
1978 Builtins::kCreateResolvingFunctions, 2, false); | |
1979 native_context()->set_create_resolving_functions( | |
1980 *create_resolving_functions); | |
1981 } | 1993 } |
1982 | 1994 |
1983 { // -- R e g E x p | 1995 { // -- R e g E x p |
1984 // Builtin functions for RegExp.prototype. | 1996 // Builtin functions for RegExp.prototype. |
1985 Handle<JSObject> prototype = | 1997 Handle<JSObject> prototype = |
1986 factory->NewJSObject(isolate->object_function(), TENURED); | 1998 factory->NewJSObject(isolate->object_function(), TENURED); |
1987 Handle<JSFunction> regexp_fun = | 1999 Handle<JSFunction> regexp_fun = |
1988 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, | 2000 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, |
1989 prototype, Builtins::kRegExpConstructor); | 2001 prototype, Builtins::kRegExpConstructor); |
1990 InstallWithIntrinsicDefaultProto(isolate, regexp_fun, | 2002 InstallWithIntrinsicDefaultProto(isolate, regexp_fun, |
(...skipping 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4733 } | 4745 } |
4734 | 4746 |
4735 | 4747 |
4736 // Called when the top-level V8 mutex is destroyed. | 4748 // Called when the top-level V8 mutex is destroyed. |
4737 void Bootstrapper::FreeThreadResources() { | 4749 void Bootstrapper::FreeThreadResources() { |
4738 DCHECK(!IsActive()); | 4750 DCHECK(!IsActive()); |
4739 } | 4751 } |
4740 | 4752 |
4741 } // namespace internal | 4753 } // namespace internal |
4742 } // namespace v8 | 4754 } // namespace v8 |
OLD | NEW |