We should support CreateThis in the FTL
[WebKit-https.git] / Source / JavaScriptCore / runtime / Intrinsic.cpp
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
31 namespace JSC {
32
33 const 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 FromCharCodeIntrinsic:
87         return "FromCharCodeIntrinsic";
88     case PowIntrinsic:
89         return "PowIntrinsic";
90     case FloorIntrinsic:
91         return "FloorIntrinsic";
92     case CeilIntrinsic:
93         return "CeilIntrinsic";
94     case RoundIntrinsic:
95         return "RoundIntrinsic";
96     case ExpIntrinsic:
97         return "ExpIntrinsic";
98     case Expm1Intrinsic:
99         return "Expm1Intrinsic";
100     case LogIntrinsic:
101         return "LogIntrinsic";
102     case Log10Intrinsic:
103         return "Log10Intrinsic";
104     case Log1pIntrinsic:
105         return "Log1pIntrinsic";
106     case Log2Intrinsic:
107         return "Log2Intrinsic";
108     case RegExpExecIntrinsic:
109         return "RegExpExecIntrinsic";
110     case RegExpTestIntrinsic:
111         return "RegExpTestIntrinsic";
112     case RegExpTestFastIntrinsic:
113         return "RegExpTestFastIntrinsic";
114     case RegExpMatchFastIntrinsic:
115         return "RegExpMatchFastIntrinsic";
116     case ObjectCreateIntrinsic:
117         return "ObjectCreateIntrinsic";
118     case ObjectGetPrototypeOfIntrinsic:
119         return "ObjectGetPrototypeOfIntrinsic";
120     case ObjectIsIntrinsic:
121         return "ObjectIsIntrinsic";
122     case ReflectGetPrototypeOfIntrinsic:
123         return "ReflectGetPrototypeOfIntrinsic";
124     case StringPrototypeValueOfIntrinsic:
125         return "StringPrototypeValueOfIntrinsic";
126     case StringPrototypeReplaceIntrinsic:
127         return "StringPrototypeReplaceIntrinsic";
128     case StringPrototypeReplaceRegExpIntrinsic:
129         return "StringPrototypeReplaceRegExpIntrinsic";
130     case StringPrototypeSliceIntrinsic:
131         return "StringPrototypeSliceIntrinsic";
132     case StringPrototypeToLowerCaseIntrinsic:
133         return "StringPrototypeToLowerCaseIntrinsic";
134     case NumberPrototypeToStringIntrinsic:
135         return "NumberPrototypeToStringIntrinsic";
136     case NumberIsIntegerIntrinsic:
137         return "NumberIsIntegerIntrinsic";
138     case IMulIntrinsic:
139         return "IMulIntrinsic";
140     case RandomIntrinsic:
141         return "RandomIntrinsic";
142     case FRoundIntrinsic:
143         return "FRoundIntrinsic";
144     case TruncIntrinsic:
145         return "TruncIntrinsic";
146     case IsTypedArrayViewIntrinsic:
147         return "IsTypedArrayViewIntrinsic";
148     case BoundThisNoArgsFunctionCallIntrinsic:
149         return "BoundThisNoArgsFunctionCallIntrinsic";
150     case JSMapGetIntrinsic:
151         return "JSMapGetIntrinsic";
152     case JSMapHasIntrinsic:
153         return "JSMapHasIntrinsic";
154     case JSMapSetIntrinsic:
155         return "JSMapSetIntrinsic";
156     case JSMapBucketHeadIntrinsic:
157         return "JSMapBucketHeadIntrinsic";
158     case JSMapBucketNextIntrinsic:
159         return "JSMapBucketNextIntrinsic";
160     case JSMapBucketKeyIntrinsic:
161         return "JSMapBucketKeyIntrinsic";
162     case JSMapBucketValueIntrinsic:
163         return "JSMapBucketValueIntrinsic";
164     case JSSetHasIntrinsic:
165         return "JSSetHasIntrinsic";
166     case JSSetAddIntrinsic:
167         return "JSSetAddIntrinsic";
168     case JSSetBucketHeadIntrinsic:
169         return "JSSetBucketHeadIntrinsic";
170     case JSSetBucketNextIntrinsic:
171         return "JSSetBucketNextIntrinsic";
172     case JSSetBucketKeyIntrinsic:
173         return "JSSetBucketKeyIntrinsic";
174     case JSWeakMapGetIntrinsic:
175         return "JSWeakMapGetIntrinsic";
176     case JSWeakMapHasIntrinsic:
177         return "JSWeakMapHasIntrinsic";
178     case JSWeakMapSetIntrinsic:
179         return "JSWeakMapSetIntrinsic";
180     case JSWeakSetHasIntrinsic:
181         return "JSWeakSetHasIntrinsic";
182     case JSWeakSetAddIntrinsic:
183         return "JSWeakSetAddIntrinsic";
184     case HasOwnPropertyIntrinsic:
185         return "HasOwnPropertyIntrinsic";
186     case AtomicsAddIntrinsic:
187         return "AtomicsAddIntrinsic";
188     case AtomicsAndIntrinsic:
189         return "AtomicsAndIntrinsic";
190     case AtomicsCompareExchangeIntrinsic:
191         return "AtomicsCompareExchangeIntrinsic";
192     case AtomicsExchangeIntrinsic:
193         return "AtomicsExchangeIntrinsic";
194     case AtomicsIsLockFreeIntrinsic:
195         return "AtomicsIsLockFreeIntrinsic";
196     case AtomicsLoadIntrinsic:
197         return "AtomicsLoadIntrinsic";
198     case AtomicsOrIntrinsic:
199         return "AtomicsOrIntrinsic";
200     case AtomicsStoreIntrinsic:
201         return "AtomicsStoreIntrinsic";
202     case AtomicsSubIntrinsic:
203         return "AtomicsSubIntrinsic";
204     case AtomicsWaitIntrinsic:
205         return "AtomicsWaitIntrinsic";
206     case AtomicsWakeIntrinsic:
207         return "AtomicsWakeIntrinsic";
208     case AtomicsXorIntrinsic:
209         return "AtomicsXorIntrinsic";
210     case ParseIntIntrinsic:
211         return "ParseIntIntrinsic";
212     case TypedArrayLengthIntrinsic:
213         return "TypedArrayLengthIntrinsic";
214     case TypedArrayByteLengthIntrinsic:
215         return "TypedArrayByteLengthIntrinsic";
216     case TypedArrayByteOffsetIntrinsic:
217         return "TypedArrayByteOffsetIntrinsic";
218     case UnderscoreProtoIntrinsic:
219         return "UnderscoreProtoIntrinsic";
220     case DFGTrueIntrinsic:
221         return "DFGTrueIntrinsic";
222     case FTLTrueIntrinsic:
223         return "FTLTrueIntrinsic";
224     case OSRExitIntrinsic:
225         return "OSRExitIntrinsic";
226     case IsFinalTierIntrinsic:
227         return "IsFinalTierIntrinsic";
228     case SetInt32HeapPredictionIntrinsic:
229         return "SetInt32HeapPredictionIntrinsic";
230     case CheckInt32Intrinsic:
231         return "CheckInt32Intrinsic";
232     case FiatInt52Intrinsic:
233         return "FiatInt52Intrinsic";
234     case CPUMfenceIntrinsic:
235         return "CPUMfenceIntrinsic";
236     case CPURdtscIntrinsic:
237         return "CPURdtscIntrinsic";
238     case CPUCpuidIntrinsic:
239         return "CPUCpuidIntrinsic";
240     case CPUPauseIntrinsic:
241         return "CPUPauseIntrinsic";
242     }
243     RELEASE_ASSERT_NOT_REACHED();
244     return nullptr;
245 }
246
247 } // namespace JSC
248
249 namespace WTF {
250
251 void printInternal(PrintStream& out, JSC::Intrinsic intrinsic)
252 {
253     out.print(JSC::intrinsicName(intrinsic));
254 }
255
256 } // namespace WTF
257