]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (C) 2010, 2012, 2013 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. AND ITS CONTRIBUTORS ``AS IS'' | |
14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | |
15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | |
17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | |
23 | * THE POSSIBILITY OF SUCH DAMAGE. | |
24 | */ | |
25 | ||
26 | #ifndef ThunkGenerators_h | |
27 | #define ThunkGenerators_h | |
28 | ||
29 | #include "CodeSpecializationKind.h" | |
30 | #include "RegisterPreservationMode.h" | |
31 | #include "ThunkGenerator.h" | |
32 | ||
33 | #if ENABLE(JIT) | |
34 | namespace JSC { | |
35 | ||
36 | MacroAssemblerCodeRef throwExceptionFromCallSlowPathGenerator(VM*); | |
37 | ||
38 | MacroAssemblerCodeRef linkCallThunkGenerator(VM*); | |
39 | MacroAssemblerCodeRef linkConstructThunkGenerator(VM*); | |
40 | MacroAssemblerCodeRef linkCallThatPreservesRegsThunkGenerator(VM*); | |
41 | MacroAssemblerCodeRef linkConstructThatPreservesRegsThunkGenerator(VM*); | |
42 | ||
43 | inline ThunkGenerator linkThunkGeneratorFor( | |
44 | CodeSpecializationKind kind, RegisterPreservationMode registers) | |
45 | { | |
46 | switch (kind) { | |
47 | case CodeForCall: | |
48 | switch (registers) { | |
49 | case RegisterPreservationNotRequired: | |
50 | return linkCallThunkGenerator; | |
51 | case MustPreserveRegisters: | |
52 | return linkCallThatPreservesRegsThunkGenerator; | |
53 | } | |
54 | break; | |
55 | case CodeForConstruct: | |
56 | switch (registers) { | |
57 | case RegisterPreservationNotRequired: | |
58 | return linkConstructThunkGenerator; | |
59 | case MustPreserveRegisters: | |
60 | return linkConstructThatPreservesRegsThunkGenerator; | |
61 | } | |
62 | break; | |
63 | } | |
64 | RELEASE_ASSERT_NOT_REACHED(); | |
65 | return 0; | |
66 | } | |
67 | ||
68 | MacroAssemblerCodeRef linkClosureCallThunkGenerator(VM*); | |
69 | MacroAssemblerCodeRef linkClosureCallThatPreservesRegsThunkGenerator(VM*); | |
70 | ||
71 | inline ThunkGenerator linkClosureCallThunkGeneratorFor(RegisterPreservationMode registers) | |
72 | { | |
73 | switch (registers) { | |
74 | case RegisterPreservationNotRequired: | |
75 | return linkClosureCallThunkGenerator; | |
76 | case MustPreserveRegisters: | |
77 | return linkClosureCallThatPreservesRegsThunkGenerator; | |
78 | } | |
79 | RELEASE_ASSERT_NOT_REACHED(); | |
80 | return 0; | |
81 | } | |
82 | ||
83 | MacroAssemblerCodeRef virtualCallThunkGenerator(VM*); | |
84 | MacroAssemblerCodeRef virtualConstructThunkGenerator(VM*); | |
85 | MacroAssemblerCodeRef virtualCallThatPreservesRegsThunkGenerator(VM*); | |
86 | MacroAssemblerCodeRef virtualConstructThatPreservesRegsThunkGenerator(VM*); | |
87 | ||
88 | inline ThunkGenerator virtualThunkGeneratorFor( | |
89 | CodeSpecializationKind kind, RegisterPreservationMode registers) | |
90 | { | |
91 | switch (kind) { | |
92 | case CodeForCall: | |
93 | switch (registers) { | |
94 | case RegisterPreservationNotRequired: | |
95 | return virtualCallThunkGenerator; | |
96 | case MustPreserveRegisters: | |
97 | return virtualCallThatPreservesRegsThunkGenerator; | |
98 | } | |
99 | break; | |
100 | case CodeForConstruct: | |
101 | switch (registers) { | |
102 | case RegisterPreservationNotRequired: | |
103 | return virtualConstructThunkGenerator; | |
104 | case MustPreserveRegisters: | |
105 | return virtualConstructThatPreservesRegsThunkGenerator; | |
106 | } | |
107 | break; | |
108 | } | |
109 | RELEASE_ASSERT_NOT_REACHED(); | |
110 | return 0; | |
111 | } | |
112 | ||
113 | MacroAssemblerCodeRef nativeCallGenerator(VM*); | |
114 | MacroAssemblerCodeRef nativeConstructGenerator(VM*); | |
115 | MacroAssemblerCodeRef nativeTailCallGenerator(VM*); | |
116 | MacroAssemblerCodeRef arityFixup(VM*); | |
117 | ||
118 | MacroAssemblerCodeRef charCodeAtThunkGenerator(VM*); | |
119 | MacroAssemblerCodeRef charAtThunkGenerator(VM*); | |
120 | MacroAssemblerCodeRef fromCharCodeThunkGenerator(VM*); | |
121 | MacroAssemblerCodeRef absThunkGenerator(VM*); | |
122 | MacroAssemblerCodeRef ceilThunkGenerator(VM*); | |
123 | MacroAssemblerCodeRef expThunkGenerator(VM*); | |
124 | MacroAssemblerCodeRef floorThunkGenerator(VM*); | |
125 | MacroAssemblerCodeRef logThunkGenerator(VM*); | |
126 | MacroAssemblerCodeRef roundThunkGenerator(VM*); | |
127 | MacroAssemblerCodeRef sqrtThunkGenerator(VM*); | |
128 | MacroAssemblerCodeRef powThunkGenerator(VM*); | |
129 | MacroAssemblerCodeRef imulThunkGenerator(VM*); | |
130 | MacroAssemblerCodeRef arrayIteratorNextKeyThunkGenerator(VM*); | |
131 | MacroAssemblerCodeRef arrayIteratorNextValueThunkGenerator(VM*); | |
132 | ||
133 | } | |
134 | #endif // ENABLE(JIT) | |
135 | ||
136 | #endif // ThunkGenerator_h |