1a4d83b8e2205e024e574628418e5871d08e17a9
[WebKit-https.git] / Source / JavaScriptCore / Scripts / tests / builtins / expected / JavaScriptCore-Builtin.Promise-Separate.js-result
1 ### Begin File: BuiltinPromiseBuiltins.h
2 /*
3  * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
4  * Copyright (c) 2016 Apple Inc. All rights reserved.
5  * 
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
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.
14  * 
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.
26  * 
27  */
28
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
31
32 #pragma once
33
34
35
36 namespace JSC {
37 class FunctionExecutable;
38 }
39
40 namespace JSC {
41
42 /* Builtin.Promise */
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;
49
50 #define JSC_FOREACH_BUILTIN_PROMISE_BUILTIN_DATA(macro) \
51     macro(rejectPromise, builtinPromiseRejectPromise, 2) \
52     macro(fulfillPromise, builtinPromiseFulfillPromise, 2) \
53
54 #define JSC_BUILTIN_BUILTIN_PROMISE_REJECTPROMISE 1
55 #define JSC_BUILTIN_BUILTIN_PROMISE_FULFILLPROMISE 1
56
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) \
60
61 #define JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_FUNCTION_NAME(macro) \
62     macro(fulfillPromise) \
63     macro(rejectPromise) \
64
65 #define DECLARE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
66     JSC::FunctionExecutable* codeName##Generator(JSC::VM&);
67
68 JSC_FOREACH_BUILTIN.PROMISE_BUILTIN_CODE(DECLARE_BUILTIN_GENERATOR)
69 #undef DECLARE_BUILTIN_GENERATOR
70
71 } // namespace JSC
72 ### End File: BuiltinPromiseBuiltins.h
73
74 ### Begin File: BuiltinPromiseBuiltins.cpp
75 /*
76  * Copyright (c) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
77  * Copyright (c) 2016 Apple Inc. All rights reserved.
78  * 
79  * Redistribution and use in source and binary forms, with or without
80  * modification, are permitted provided that the following conditions
81  * are met:
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.
87  * 
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.
99  * 
100  */
101
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
104
105 #include "config.h"
106 #include "BuiltinPromiseBuiltins.h"
107
108 #include "BuiltinExecutables.h"
109 #include "HeapInlines.h"
110 #include "IdentifierInlines.h"
111 #include "Intrinsic.h"
112 #include "JSCellInlines.h"
113 #include "VM.h"
114
115 namespace JSC {
116
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" \
122     "{\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" \
131     "})\n" \
132 ;
133
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" \
139     "{\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" \
148     "})\n" \
149 ;
150
151
152 #define DEFINE_BUILTIN_GENERATOR(codeName, functionName, overriddenName, argumentCount) \
153 JSC::FunctionExecutable* codeName##Generator(JSC::VM& vm) \
154 {\
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
158
159
160 } // namespace JSC
161 ### End File: BuiltinPromiseBuiltins.cpp