1/*
2 * Copyright (C) 2017 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "config.h"
27#include "Intrinsic.h"
28
29#include <wtf/PrintStream.h>
30
31namespace JSC {
32
33const char* intrinsicName(Intrinsic intrinsic)
34{
35 switch (intrinsic) {
36 case NoIntrinsic:
37 return "NoIntrinsic";
38 case AbsIntrinsic:
39 return "AbsIntrinsic";
40 case ACosIntrinsic:
41 return "ACosIntrinsic";
42 case ASinIntrinsic:
43 return "ASinIntrinsic";
44 case ATanIntrinsic:
45 return "ATanIntrinsic";
46 case ACoshIntrinsic:
47 return "ACoshIntrinsic";
48 case ASinhIntrinsic:
49 return "ASinhIntrinsic";
50 case ATanhIntrinsic:
51 return "ATanhIntrinsic";
52 case MinIntrinsic:
53 return "MinIntrinsic";
54 case MaxIntrinsic:
55 return "MaxIntrinsic";
56 case SqrtIntrinsic:
57 return "SqrtIntrinsic";
58 case SinIntrinsic:
59 return "SinIntrinsic";
60 case CbrtIntrinsic:
61 return "CbrtIntrinsic";
62 case Clz32Intrinsic:
63 return "Clz32Intrinsic";
64 case CosIntrinsic:
65 return "CosIntrinsic";
66 case TanIntrinsic:
67 return "TanIntrinsic";
68 case CoshIntrinsic:
69 return "CoshIntrinsic";
70 case SinhIntrinsic:
71 return "SinhIntrinsic";
72 case TanhIntrinsic:
73 return "TanhIntrinsic";
74 case ArrayIndexOfIntrinsic:
75 return "ArrayIndexOfIntrinsic";
76 case ArrayPushIntrinsic:
77 return "ArrayPushIntrinsic";
78 case ArrayPopIntrinsic:
79 return "ArrayPopIntrinsic";
80 case ArraySliceIntrinsic:
81 return "ArraySliceIntrinsic";
82 case CharCodeAtIntrinsic:
83 return "CharCodeAtIntrinsic";
84 case CharAtIntrinsic:
85 return "CharAtIntrinsic";
86 case DatePrototypeGetTimeIntrinsic:
87 return "DatePrototypeGetTimeIntrinsic";
88 case DatePrototypeGetFullYearIntrinsic:
89 return "DatePrototypeGetFullYearIntrinsic";
90 case DatePrototypeGetUTCFullYearIntrinsic:
91 return "DatePrototypeGetUTCFullYearIntrinsic";
92 case DatePrototypeGetMonthIntrinsic:
93 return "DatePrototypeGetMonthIntrinsic";
94 case DatePrototypeGetUTCMonthIntrinsic:
95 return "DatePrototypeGetUTCMonthIntrinsic";
96 case DatePrototypeGetDateIntrinsic:
97 return "DatePrototypeGetDateIntrinsic";
98 case DatePrototypeGetUTCDateIntrinsic:
99 return "DatePrototypeGetUTCDateIntrinsic";
100 case DatePrototypeGetDayIntrinsic:
101 return "DatePrototypeGetDayIntrinsic";
102 case DatePrototypeGetUTCDayIntrinsic:
103 return "DatePrototypeGetUTCDayIntrinsic";
104 case DatePrototypeGetHoursIntrinsic:
105 return "DatePrototypeGetHoursIntrinsic";
106 case DatePrototypeGetUTCHoursIntrinsic:
107 return "DatePrototypeGetUTCHoursIntrinsic";
108 case DatePrototypeGetMinutesIntrinsic:
109 return "DatePrototypeGetMinutesIntrinsic";
110 case DatePrototypeGetUTCMinutesIntrinsic:
111 return "DatePrototypeGetUTCMinutesIntrinsic";
112 case DatePrototypeGetSecondsIntrinsic:
113 return "DatePrototypeGetSecondsIntrinsic";
114 case DatePrototypeGetUTCSecondsIntrinsic:
115 return "DatePrototypeGetUTCSecondsIntrinsic";
116 case DatePrototypeGetMillisecondsIntrinsic:
117 return "DatePrototypeGetMillisecondsIntrinsic";
118 case DatePrototypeGetUTCMillisecondsIntrinsic:
119 return "DatePrototypeGetUTCMillisecondsIntrinsic";
120 case DatePrototypeGetTimezoneOffsetIntrinsic:
121 return "DatePrototypeGetTimezoneOffsetIntrinsic";
122 case DatePrototypeGetYearIntrinsic:
123 return "DatePrototypeGetYearIntrinsic";
124 case FromCharCodeIntrinsic:
125 return "FromCharCodeIntrinsic";
126 case PowIntrinsic:
127 return "PowIntrinsic";
128 case FloorIntrinsic:
129 return "FloorIntrinsic";
130 case CeilIntrinsic:
131 return "CeilIntrinsic";
132 case RoundIntrinsic:
133 return "RoundIntrinsic";
134 case ExpIntrinsic:
135 return "ExpIntrinsic";
136 case Expm1Intrinsic:
137 return "Expm1Intrinsic";
138 case LogIntrinsic:
139 return "LogIntrinsic";
140 case Log10Intrinsic:
141 return "Log10Intrinsic";
142 case Log1pIntrinsic:
143 return "Log1pIntrinsic";
144 case Log2Intrinsic:
145 return "Log2Intrinsic";
146 case RegExpExecIntrinsic:
147 return "RegExpExecIntrinsic";
148 case RegExpTestIntrinsic:
149 return "RegExpTestIntrinsic";
150 case RegExpTestFastIntrinsic:
151 return "RegExpTestFastIntrinsic";
152 case RegExpMatchFastIntrinsic:
153 return "RegExpMatchFastIntrinsic";
154 case ObjectCreateIntrinsic:
155 return "ObjectCreateIntrinsic";
156 case ObjectGetPrototypeOfIntrinsic:
157 return "ObjectGetPrototypeOfIntrinsic";
158 case ObjectIsIntrinsic:
159 return "ObjectIsIntrinsic";
160 case ObjectKeysIntrinsic:
161 return "ObjectKeysIntrinsic";
162 case ReflectGetPrototypeOfIntrinsic:
163 return "ReflectGetPrototypeOfIntrinsic";
164 case StringPrototypeCodePointAtIntrinsic:
165 return "StringPrototypeCodePointAtIntrinsic";
166 case StringPrototypeValueOfIntrinsic:
167 return "StringPrototypeValueOfIntrinsic";
168 case StringPrototypeReplaceIntrinsic:
169 return "StringPrototypeReplaceIntrinsic";
170 case StringPrototypeReplaceRegExpIntrinsic:
171 return "StringPrototypeReplaceRegExpIntrinsic";
172 case StringPrototypeSliceIntrinsic:
173 return "StringPrototypeSliceIntrinsic";
174 case StringPrototypeToLowerCaseIntrinsic:
175 return "StringPrototypeToLowerCaseIntrinsic";
176 case NumberPrototypeToStringIntrinsic:
177 return "NumberPrototypeToStringIntrinsic";
178 case NumberIsIntegerIntrinsic:
179 return "NumberIsIntegerIntrinsic";
180 case IMulIntrinsic:
181 return "IMulIntrinsic";
182 case RandomIntrinsic:
183 return "RandomIntrinsic";
184 case FRoundIntrinsic:
185 return "FRoundIntrinsic";
186 case TruncIntrinsic:
187 return "TruncIntrinsic";
188 case IsTypedArrayViewIntrinsic:
189 return "IsTypedArrayViewIntrinsic";
190 case BoundThisNoArgsFunctionCallIntrinsic:
191 return "BoundThisNoArgsFunctionCallIntrinsic";
192 case JSMapGetIntrinsic:
193 return "JSMapGetIntrinsic";
194 case JSMapHasIntrinsic:
195 return "JSMapHasIntrinsic";
196 case JSMapSetIntrinsic:
197 return "JSMapSetIntrinsic";
198 case JSMapBucketHeadIntrinsic:
199 return "JSMapBucketHeadIntrinsic";
200 case JSMapBucketNextIntrinsic:
201 return "JSMapBucketNextIntrinsic";
202 case JSMapBucketKeyIntrinsic:
203 return "JSMapBucketKeyIntrinsic";
204 case JSMapBucketValueIntrinsic:
205 return "JSMapBucketValueIntrinsic";
206 case JSSetHasIntrinsic:
207 return "JSSetHasIntrinsic";
208 case JSSetAddIntrinsic:
209 return "JSSetAddIntrinsic";
210 case JSSetBucketHeadIntrinsic:
211 return "JSSetBucketHeadIntrinsic";
212 case JSSetBucketNextIntrinsic:
213 return "JSSetBucketNextIntrinsic";
214 case JSSetBucketKeyIntrinsic:
215 return "JSSetBucketKeyIntrinsic";
216 case JSWeakMapGetIntrinsic:
217 return "JSWeakMapGetIntrinsic";
218 case JSWeakMapHasIntrinsic:
219 return "JSWeakMapHasIntrinsic";
220 case JSWeakMapSetIntrinsic:
221 return "JSWeakMapSetIntrinsic";
222 case JSWeakSetHasIntrinsic:
223 return "JSWeakSetHasIntrinsic";
224 case JSWeakSetAddIntrinsic:
225 return "JSWeakSetAddIntrinsic";
226 case HasOwnPropertyIntrinsic:
227 return "HasOwnPropertyIntrinsic";
228 case AtomicsAddIntrinsic:
229 return "AtomicsAddIntrinsic";
230 case AtomicsAndIntrinsic:
231 return "AtomicsAndIntrinsic";
232 case AtomicsCompareExchangeIntrinsic:
233 return "AtomicsCompareExchangeIntrinsic";
234 case AtomicsExchangeIntrinsic:
235 return "AtomicsExchangeIntrinsic";
236 case AtomicsIsLockFreeIntrinsic:
237 return "AtomicsIsLockFreeIntrinsic";
238 case AtomicsLoadIntrinsic:
239 return "AtomicsLoadIntrinsic";
240 case AtomicsOrIntrinsic:
241 return "AtomicsOrIntrinsic";
242 case AtomicsStoreIntrinsic:
243 return "AtomicsStoreIntrinsic";
244 case AtomicsSubIntrinsic:
245 return "AtomicsSubIntrinsic";
246 case AtomicsWaitIntrinsic:
247 return "AtomicsWaitIntrinsic";
248 case AtomicsWakeIntrinsic:
249 return "AtomicsWakeIntrinsic";
250 case AtomicsXorIntrinsic:
251 return "AtomicsXorIntrinsic";
252 case ParseIntIntrinsic:
253 return "ParseIntIntrinsic";
254 case TypedArrayLengthIntrinsic:
255 return "TypedArrayLengthIntrinsic";
256 case TypedArrayByteLengthIntrinsic:
257 return "TypedArrayByteLengthIntrinsic";
258 case TypedArrayByteOffsetIntrinsic:
259 return "TypedArrayByteOffsetIntrinsic";
260 case UnderscoreProtoIntrinsic:
261 return "UnderscoreProtoIntrinsic";
262 case DFGTrueIntrinsic:
263 return "DFGTrueIntrinsic";
264 case FTLTrueIntrinsic:
265 return "FTLTrueIntrinsic";
266 case OSRExitIntrinsic:
267 return "OSRExitIntrinsic";
268 case IsFinalTierIntrinsic:
269 return "IsFinalTierIntrinsic";
270 case SetInt32HeapPredictionIntrinsic:
271 return "SetInt32HeapPredictionIntrinsic";
272 case CheckInt32Intrinsic:
273 return "CheckInt32Intrinsic";
274 case FiatInt52Intrinsic:
275 return "FiatInt52Intrinsic";
276 case CPUMfenceIntrinsic:
277 return "CPUMfenceIntrinsic";
278 case CPURdtscIntrinsic:
279 return "CPURdtscIntrinsic";
280 case CPUCpuidIntrinsic:
281 return "CPUCpuidIntrinsic";
282 case CPUPauseIntrinsic:
283 return "CPUPauseIntrinsic";
284 case DataViewGetInt8:
285 return "DataViewGetInt8";
286 case DataViewGetUint8:
287 return "DataViewGetUint8";
288 case DataViewGetInt16:
289 return "DataViewGetInt16";
290 case DataViewGetUint16:
291 return "DataViewGetUint16";
292 case DataViewGetInt32:
293 return "DataViewGetInt32";
294 case DataViewGetUint32:
295 return "DataViewGetUint32";
296 case DataViewGetFloat32:
297 return "DataViewGetFloat32";
298 case DataViewGetFloat64:
299 return "DataViewGetFloat64";
300 case DataViewSetInt8:
301 return "DataViewSetInt8";
302 case DataViewSetUint8:
303 return "DataViewSetUint8";
304 case DataViewSetInt16:
305 return "DataViewSetInt16";
306 case DataViewSetUint16:
307 return "DataViewSetUint16";
308 case DataViewSetInt32:
309 return "DataViewSetInt32";
310 case DataViewSetUint32:
311 return "DataViewSetUint32";
312 case DataViewSetFloat32:
313 return "DataViewSetFloat32";
314 case DataViewSetFloat64:
315 return "DataViewSetFloat64";
316 }
317 RELEASE_ASSERT_NOT_REACHED();
318 return nullptr;
319}
320
321} // namespace JSC
322
323namespace WTF {
324
325void printInternal(PrintStream& out, JSC::Intrinsic intrinsic)
326{
327 out.print(JSC::intrinsicName(intrinsic));
328}
329
330} // namespace WTF
331
332