1 | /* |
2 | * Copyright (C) 2018 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 "JSType.h" |
28 | |
29 | #include <wtf/PrintStream.h> |
30 | |
31 | namespace WTF { |
32 | |
33 | class PrintStream; |
34 | |
35 | #define CASE(__type) \ |
36 | case JSC::__type: \ |
37 | out.print(#__type); \ |
38 | return; |
39 | |
40 | void printInternal(PrintStream& out, JSC::JSType type) |
41 | { |
42 | switch (type) { |
43 | CASE(CellType) |
44 | CASE(StringType) |
45 | CASE(SymbolType) |
46 | CASE(BigIntType) |
47 | CASE(CustomGetterSetterType) |
48 | CASE(APIValueWrapperType) |
49 | CASE(NativeExecutableType) |
50 | CASE(ProgramExecutableType) |
51 | CASE(ModuleProgramExecutableType) |
52 | CASE(EvalExecutableType) |
53 | CASE(FunctionExecutableType) |
54 | CASE(UnlinkedFunctionExecutableType) |
55 | CASE(UnlinkedProgramCodeBlockType) |
56 | CASE(UnlinkedModuleProgramCodeBlockType) |
57 | CASE(UnlinkedEvalCodeBlockType) |
58 | CASE(UnlinkedFunctionCodeBlockType) |
59 | CASE(CodeBlockType) |
60 | CASE(JSFixedArrayType) |
61 | CASE(JSImmutableButterflyType) |
62 | CASE(JSSourceCodeType) |
63 | CASE(JSScriptFetcherType) |
64 | CASE(JSScriptFetchParametersType) |
65 | CASE(ObjectType) |
66 | CASE(FinalObjectType) |
67 | CASE(JSCalleeType) |
68 | CASE(JSFunctionType) |
69 | CASE(InternalFunctionType) |
70 | CASE(NumberObjectType) |
71 | CASE(ErrorInstanceType) |
72 | CASE(PureForwardingProxyType) |
73 | CASE(ImpureProxyType) |
74 | CASE(DirectArgumentsType) |
75 | CASE(ScopedArgumentsType) |
76 | CASE(ClonedArgumentsType) |
77 | CASE(ArrayType) |
78 | CASE(DerivedArrayType) |
79 | CASE(ArrayBufferType) |
80 | CASE(Int8ArrayType) |
81 | CASE(Uint8ArrayType) |
82 | CASE(Uint8ClampedArrayType) |
83 | CASE(Int16ArrayType) |
84 | CASE(Uint16ArrayType) |
85 | CASE(Int32ArrayType) |
86 | CASE(Uint32ArrayType) |
87 | CASE(Float32ArrayType) |
88 | CASE(Float64ArrayType) |
89 | CASE(DataViewType) |
90 | CASE(GetterSetterType) |
91 | CASE(GlobalObjectType) |
92 | CASE(GlobalLexicalEnvironmentType) |
93 | CASE(LexicalEnvironmentType) |
94 | CASE(ModuleEnvironmentType) |
95 | CASE(StrictEvalActivationType) |
96 | CASE(WithScopeType) |
97 | CASE(RegExpObjectType) |
98 | CASE(ProxyObjectType) |
99 | CASE(JSMapType) |
100 | CASE(JSSetType) |
101 | CASE(JSWeakMapType) |
102 | CASE(JSWeakSetType) |
103 | CASE(WebAssemblyToJSCalleeType) |
104 | CASE(StringObjectType) |
105 | CASE(MaxJSType) |
106 | } |
107 | } |
108 | |
109 | #undef CASE |
110 | |
111 | } // namespace WTF |
112 | |