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...) 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_internal_promise_capability(debugEvent) |
| 1857 Handle<JSFunction> new_internal_promise_capability = |
| 1858 SimpleCreateFunction(isolate, factory->empty_string(), |
| 1859 Builtins::kNewInternalPromiseCapability, 1, false); |
| 1860 InstallWithIntrinsicDefaultProto( |
| 1861 isolate, new_internal_promise_capability, |
| 1862 Context::NEW_INTERNAL_PROMISE_CAPABILITY_INDEX); |
| 1863 |
| 1864 // %new_promise_capability(C, debugEvent) |
| 1865 Handle<JSFunction> new_promise_capability = |
| 1866 SimpleCreateFunction(isolate, factory->empty_string(), |
| 1867 Builtins::kNewPromiseCapability, 2, false); |
| 1868 InstallWithIntrinsicDefaultProto(isolate, new_promise_capability, |
| 1869 Context::NEW_PROMISE_CAPABILITY_INDEX); |
| 1870 } |
| 1871 |
1846 { // -- P r o m i s e | 1872 { // -- P r o m i s e |
1847 // Set catch prediction | 1873 // Set catch prediction |
1848 Handle<Code> promise_code = isolate->builtins()->PromiseConstructor(); | 1874 Handle<Code> promise_code = isolate->builtins()->PromiseConstructor(); |
1849 promise_code->set_is_promise_rejection(true); | 1875 promise_code->set_is_promise_rejection(true); |
1850 | 1876 |
1851 Handle<JSObject> prototype = | 1877 Handle<JSObject> prototype = |
1852 factory->NewJSObject(isolate->object_function(), TENURED); | 1878 factory->NewJSObject(isolate->object_function(), TENURED); |
1853 Handle<JSFunction> promise_fun = | 1879 Handle<JSFunction> promise_fun = |
1854 InstallFunction(global, "Promise", JS_PROMISE_TYPE, JSPromise::kSize, | 1880 InstallFunction(global, "Promise", JS_PROMISE_TYPE, JSPromise::kSize, |
1855 prototype, Builtins::kPromiseConstructor); | 1881 prototype, Builtins::kPromiseConstructor); |
(...skipping 109 matching lines...) Loading... |
1965 | 1991 |
1966 code = | 1992 code = |
1967 handle(isolate->builtins()->builtin(Builtins::kPromiseRejectClosure), | 1993 handle(isolate->builtins()->builtin(Builtins::kPromiseRejectClosure), |
1968 isolate); | 1994 isolate); |
1969 info = | 1995 info = |
1970 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); | 1996 factory->NewSharedFunctionInfo(factory->empty_string(), code, false); |
1971 info->set_internal_formal_parameter_count(2); | 1997 info->set_internal_formal_parameter_count(2); |
1972 info->set_length(1); | 1998 info->set_length(1); |
1973 native_context()->set_promise_reject_shared_fun(*info); | 1999 native_context()->set_promise_reject_shared_fun(*info); |
1974 } | 2000 } |
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 } | 2001 } |
1982 | 2002 |
1983 { // -- R e g E x p | 2003 { // -- R e g E x p |
1984 // Builtin functions for RegExp.prototype. | 2004 // Builtin functions for RegExp.prototype. |
1985 Handle<JSObject> prototype = | 2005 Handle<JSObject> prototype = |
1986 factory->NewJSObject(isolate->object_function(), TENURED); | 2006 factory->NewJSObject(isolate->object_function(), TENURED); |
1987 Handle<JSFunction> regexp_fun = | 2007 Handle<JSFunction> regexp_fun = |
1988 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, | 2008 InstallFunction(global, "RegExp", JS_REGEXP_TYPE, JSRegExp::kSize, |
1989 prototype, Builtins::kRegExpConstructor); | 2009 prototype, Builtins::kRegExpConstructor); |
1990 InstallWithIntrinsicDefaultProto(isolate, regexp_fun, | 2010 InstallWithIntrinsicDefaultProto(isolate, regexp_fun, |
(...skipping 2674 matching lines...) Loading... |
4665 } | 4685 } |
4666 | 4686 |
4667 | 4687 |
4668 // Called when the top-level V8 mutex is destroyed. | 4688 // Called when the top-level V8 mutex is destroyed. |
4669 void Bootstrapper::FreeThreadResources() { | 4689 void Bootstrapper::FreeThreadResources() { |
4670 DCHECK(!IsActive()); | 4690 DCHECK(!IsActive()); |
4671 } | 4691 } |
4672 | 4692 |
4673 } // namespace internal | 4693 } // namespace internal |
4674 } // namespace v8 | 4694 } // namespace v8 |
OLD | NEW |