2 * Copyright (C) 2010, 2012, 2013 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
26 #ifndef ThunkGenerators_h
27 #define ThunkGenerators_h
29 #include "CodeSpecializationKind.h"
30 #include "RegisterPreservationMode.h"
31 #include "ThunkGenerator.h"
36 MacroAssemblerCodeRef
throwExceptionFromCallSlowPathGenerator(VM
*);
38 MacroAssemblerCodeRef
linkCallThunkGenerator(VM
*);
39 MacroAssemblerCodeRef
linkConstructThunkGenerator(VM
*);
40 MacroAssemblerCodeRef
linkCallThatPreservesRegsThunkGenerator(VM
*);
41 MacroAssemblerCodeRef
linkConstructThatPreservesRegsThunkGenerator(VM
*);
43 inline ThunkGenerator
linkThunkGeneratorFor(
44 CodeSpecializationKind kind
, RegisterPreservationMode registers
)
49 case RegisterPreservationNotRequired
:
50 return linkCallThunkGenerator
;
51 case MustPreserveRegisters
:
52 return linkCallThatPreservesRegsThunkGenerator
;
55 case CodeForConstruct
:
57 case RegisterPreservationNotRequired
:
58 return linkConstructThunkGenerator
;
59 case MustPreserveRegisters
:
60 return linkConstructThatPreservesRegsThunkGenerator
;
64 RELEASE_ASSERT_NOT_REACHED();
68 MacroAssemblerCodeRef
linkPolymorphicCallThunkGenerator(VM
*);
69 MacroAssemblerCodeRef
linkPolymorphicCallThatPreservesRegsThunkGenerator(VM
*);
71 inline ThunkGenerator
linkPolymorphicCallThunkGeneratorFor(RegisterPreservationMode registers
)
74 case RegisterPreservationNotRequired
:
75 return linkPolymorphicCallThunkGenerator
;
76 case MustPreserveRegisters
:
77 return linkPolymorphicCallThatPreservesRegsThunkGenerator
;
79 RELEASE_ASSERT_NOT_REACHED();
83 MacroAssemblerCodeRef
virtualCallThunkGenerator(VM
*);
84 MacroAssemblerCodeRef
virtualConstructThunkGenerator(VM
*);
85 MacroAssemblerCodeRef
virtualCallThatPreservesRegsThunkGenerator(VM
*);
86 MacroAssemblerCodeRef
virtualConstructThatPreservesRegsThunkGenerator(VM
*);
88 inline ThunkGenerator
virtualThunkGeneratorFor(
89 CodeSpecializationKind kind
, RegisterPreservationMode registers
)
94 case RegisterPreservationNotRequired
:
95 return virtualCallThunkGenerator
;
96 case MustPreserveRegisters
:
97 return virtualCallThatPreservesRegsThunkGenerator
;
100 case CodeForConstruct
:
102 case RegisterPreservationNotRequired
:
103 return virtualConstructThunkGenerator
;
104 case MustPreserveRegisters
:
105 return virtualConstructThatPreservesRegsThunkGenerator
;
109 RELEASE_ASSERT_NOT_REACHED();
113 MacroAssemblerCodeRef
nativeCallGenerator(VM
*);
114 MacroAssemblerCodeRef
nativeConstructGenerator(VM
*);
115 MacroAssemblerCodeRef
nativeTailCallGenerator(VM
*);
116 MacroAssemblerCodeRef
arityFixupGenerator(VM
*);
118 MacroAssemblerCodeRef
baselineGetterReturnThunkGenerator(VM
* vm
);
119 MacroAssemblerCodeRef
baselineSetterReturnThunkGenerator(VM
* vm
);
121 MacroAssemblerCodeRef
charCodeAtThunkGenerator(VM
*);
122 MacroAssemblerCodeRef
charAtThunkGenerator(VM
*);
123 MacroAssemblerCodeRef
clz32ThunkGenerator(VM
*);
124 MacroAssemblerCodeRef
fromCharCodeThunkGenerator(VM
*);
125 MacroAssemblerCodeRef
absThunkGenerator(VM
*);
126 MacroAssemblerCodeRef
ceilThunkGenerator(VM
*);
127 MacroAssemblerCodeRef
expThunkGenerator(VM
*);
128 MacroAssemblerCodeRef
floorThunkGenerator(VM
*);
129 MacroAssemblerCodeRef
logThunkGenerator(VM
*);
130 MacroAssemblerCodeRef
roundThunkGenerator(VM
*);
131 MacroAssemblerCodeRef
sqrtThunkGenerator(VM
*);
132 MacroAssemblerCodeRef
powThunkGenerator(VM
*);
133 MacroAssemblerCodeRef
imulThunkGenerator(VM
*);
136 #endif // ENABLE(JIT)
138 #endif // ThunkGenerator_h