74f8d9e4047ae3b12bcdc6a95d704b09ba769ecc
[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 ObjectGetPrototypeOfIntrinsic:
115         return "ObjectGetPrototypeOfIntrinsic";
116     case ReflectGetPrototypeOfIntrinsic:
117         return "ReflectGetPrototypeOfIntrinsic";
118     case StringPrototypeValueOfIntrinsic:
119         return "StringPrototypeValueOfIntrinsic";
120     case StringPrototypeReplaceIntrinsic:
121         return "StringPrototypeReplaceIntrinsic";
122     case StringPrototypeReplaceRegExpIntrinsic:
123         return "StringPrototypeReplaceRegExpIntrinsic";
124     case StringPrototypeSliceIntrinsic:
125         return "StringPrototypeSliceIntrinsic";
126     case StringPrototypeToLowerCaseIntrinsic:
127         return "StringPrototypeToLowerCaseIntrinsic";
128     case NumberPrototypeToStringIntrinsic:
129         return "NumberPrototypeToStringIntrinsic";
130     case IMulIntrinsic:
131         return "IMulIntrinsic";
132     case RandomIntrinsic:
133         return "RandomIntrinsic";
134     case FRoundIntrinsic:
135         return "FRoundIntrinsic";
136     case TruncIntrinsic:
137         return "TruncIntrinsic";
138     case IsTypedArrayViewIntrinsic:
139         return "IsTypedArrayViewIntrinsic";
140     case BoundThisNoArgsFunctionCallIntrinsic:
141         return "BoundThisNoArgsFunctionCallIntrinsic";
142     case JSMapGetIntrinsic:
143         return "JSMapGetIntrinsic";
144     case JSMapHasIntrinsic:
145         return "JSMapHasIntrinsic";
146     case JSMapBucketHeadIntrinsic:
147         return "JSMapBucketHeadIntrinsic";
148     case JSMapBucketNextIntrinsic:
149         return "JSMapBucketNextIntrinsic";
150     case JSMapBucketKeyIntrinsic:
151         return "JSMapBucketKeyIntrinsic";
152     case JSMapBucketValueIntrinsic:
153         return "JSMapBucketValueIntrinsic";
154     case JSSetHasIntrinsic:
155         return "JSSetHasIntrinsic";
156     case JSSetBucketHeadIntrinsic:
157         return "JSSetBucketHeadIntrinsic";
158     case JSSetBucketNextIntrinsic:
159         return "JSSetBucketNextIntrinsic";
160     case JSSetBucketKeyIntrinsic:
161         return "JSSetBucketKeyIntrinsic";
162     case JSWeakMapGetIntrinsic:
163         return "JSWeakMapGetIntrinsic";
164     case HasOwnPropertyIntrinsic:
165         return "HasOwnPropertyIntrinsic";
166     case AtomicsAddIntrinsic:
167         return "AtomicsAddIntrinsic";
168     case AtomicsAndIntrinsic:
169         return "AtomicsAndIntrinsic";
170     case AtomicsCompareExchangeIntrinsic:
171         return "AtomicsCompareExchangeIntrinsic";
172     case AtomicsExchangeIntrinsic:
173         return "AtomicsExchangeIntrinsic";
174     case AtomicsIsLockFreeIntrinsic:
175         return "AtomicsIsLockFreeIntrinsic";
176     case AtomicsLoadIntrinsic:
177         return "AtomicsLoadIntrinsic";
178     case AtomicsOrIntrinsic:
179         return "AtomicsOrIntrinsic";
180     case AtomicsStoreIntrinsic:
181         return "AtomicsStoreIntrinsic";
182     case AtomicsSubIntrinsic:
183         return "AtomicsSubIntrinsic";
184     case AtomicsWaitIntrinsic:
185         return "AtomicsWaitIntrinsic";
186     case AtomicsWakeIntrinsic:
187         return "AtomicsWakeIntrinsic";
188     case AtomicsXorIntrinsic:
189         return "AtomicsXorIntrinsic";
190     case ParseIntIntrinsic:
191         return "ParseIntIntrinsic";
192     case TypedArrayLengthIntrinsic:
193         return "TypedArrayLengthIntrinsic";
194     case TypedArrayByteLengthIntrinsic:
195         return "TypedArrayByteLengthIntrinsic";
196     case TypedArrayByteOffsetIntrinsic:
197         return "TypedArrayByteOffsetIntrinsic";
198     case UnderscoreProtoIntrinsic:
199         return "UnderscoreProtoIntrinsic";
200     case DFGTrueIntrinsic:
201         return "DFGTrueIntrinsic";
202     case OSRExitIntrinsic:
203         return "OSRExitIntrinsic";
204     case IsFinalTierIntrinsic:
205         return "IsFinalTierIntrinsic";
206     case SetInt32HeapPredictionIntrinsic:
207         return "SetInt32HeapPredictionIntrinsic";
208     case CheckInt32Intrinsic:
209         return "CheckInt32Intrinsic";
210     case FiatInt52Intrinsic:
211         return "FiatInt52Intrinsic";
212     case CPUMfenceIntrinsic:
213         return "CPUMfenceIntrinsic";
214     case CPURdtscIntrinsic:
215         return "CPURdtscIntrinsic";
216     case CPUCpuidIntrinsic:
217         return "CPUCpuidIntrinsic";
218     case CPUPauseIntrinsic:
219         return "CPUPauseIntrinsic";
220     }
221     RELEASE_ASSERT_NOT_REACHED();
222     return nullptr;
223 }
224
225 } // namespace JSC
226
227 namespace WTF {
228
229 void printInternal(PrintStream& out, JSC::Intrinsic intrinsic)
230 {
231     out.print(JSC::intrinsicName(intrinsic));
232 }
233
234 } // namespace WTF
235