1 ### Begin File: BuiltinPromiseBuiltins.h
3 * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
4 * Copyright (c) 2016 Apple Inc. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
19 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
25 * THE POSSIBILITY OF SUCH DAMAGE.
29 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
30 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
37 class FunctionExecutable;
43 extern const char* s_builtinPromiseRejectPromiseCode;
44 extern const int s_builtinPromiseRejectPromiseCodeLength;
45 extern const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility;
46 extern const char* s_builtinPromiseFulfillPromiseCode;
47 extern const int s_builtinPromiseFulfillPromiseCodeLength;
48 extern const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility;
50 #define JSC_FOREACH_BUILTIN_PROMISE_BUILTIN_DATA(macro) \
51 macro(rejectPromise, builtinPromiseRejectPromise, 2) \
52 macro(fulfillPromise, builtinPromiseFulfillPromise, 2) \
54 #define JSC_BUILTIN_BUILTIN_PROMISE_REJECTPROMISE 1
55 #define JSC_BUILTIN_BUILTIN_PROMISE_FULFILLPROMISE 1
57 #define JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(macro) \
58 macro(builtinPromiseRejectPromiseCode, rejectPromise, static_cast<const char*>(nullptr), s_builtinPromiseRejectPromiseCodeLength) \
59 macro(builtinPromiseFulfillPromiseCode, fulfillPromise, static_cast<const char*>(nullptr), s_builtinPromiseFulfillPromiseCodeLength) \
61 #define JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_FUNCTION_NAME(macro) \
62 macro(fulfillPromise) \
63 macro(rejectPromise) \
65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
66 JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
68 JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
69 #undef DECLARE_BUILTIN_GENERATOR
72 ### End File: BuiltinPromiseBuiltins.h
74 ### Begin File: BuiltinPromiseBuiltins.cpp
76 * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
77 * Copyright (c) 2016 Apple Inc. All rights reserved.
79 * Redistribution and use in source and binary forms, with or without
80 * modification, are permitted provided that the following conditions
82 * 1. Redistributions of source code must retain the above copyright
83 * notice, this list of conditions and the following disclaimer.
84 * 2. Redistributions in binary form must reproduce the above copyright
85 * notice, this list of conditions and the following disclaimer in the
86 * documentation and/or other materials provided with the distribution.
88 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
89 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
90 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
91 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
92 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
93 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
94 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
95 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
96 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
97 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
98 * THE POSSIBILITY OF SUCH DAMAGE.
102 // DO NOT EDIT THIS FILE. It is automatically generated from JavaScript files for
103 // builtins by the script: Source/JavaScriptCore/Scripts/generate-js-builtins.py
106 #include "BuiltinPromiseBuiltins.h"
108 #include "BuiltinExecutables.h"
109 #include "HeapInlines.h"
110 #include "IdentifierInlines.h"
111 #include "Intrinsic.h"
112 #include "JSCellInlines.h"
117 const JSC::ConstructAbility s_builtinPromiseRejectPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
118 const int s_builtinPromiseRejectPromiseCodeLength = 410;
119 static const JSC::Intrinsic s_builtinPromiseRejectPromiseCodeIntrinsic = JSC::NoIntrinsic;
120 const char* s_builtinPromiseRejectPromiseCode =
121 "(function (promise, reason)\n" \
123 " \"use strict\";\n" \
124 " var reactions = promise.@promiseRejectReactions;\n" \
125 " promise.@promiseResult = reason;\n" \
126 " promise.@promiseFulfillReactions = undefined;\n" \
127 " promise.@promiseRejectReactions = undefined;\n" \
128 " promise.@promiseState = @promiseRejected;\n" \
129 " @InspectorInstrumentation.promiseRejected(promise, reason, reactions);\n" \
130 " @triggerPromiseReactions(reactions, reason);\n" \
134 const JSC::ConstructAbility s_builtinPromiseFulfillPromiseCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
135 const int s_builtinPromiseFulfillPromiseCodeLength = 409;
136 static const JSC::Intrinsic s_builtinPromiseFulfillPromiseCodeIntrinsic = JSC::NoIntrinsic;
137 const char* s_builtinPromiseFulfillPromiseCode =
138 "(function (promise, value)\n" \
140 " \"use strict\";\n" \
141 " var reactions = promise.@promiseFulfillReactions;\n" \
142 " promise.@promiseResult = value;\n" \
143 " promise.@promiseFulfillReactions = undefined;\n" \
144 " promise.@promiseRejectReactions = undefined;\n" \
145 " promise.@promiseState = @promiseFulfilled;\n" \
146 " @InspectorInstrumentation.promiseFulfilled(promise, value, reactions);\n" \
147 " @triggerPromiseReactions(reactions, value);\n" \
152 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
153 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
155 return vm.builtinExecutables()->codeName##Executable()->link(vm, vm.builtinExecutables()->codeName##Source(), std::nullopt, s_##codeName##Intrinsic); }
156 JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(DEFINE_BUILTIN_GENERATOR)
157 #undef DEFINE_BUILTIN_GENERATOR
161 ### End File: BuiltinPromiseBuiltins.cpp