]> git.saurik.com Git - apple/javascriptcore.git/blame - jit/ThunkGenerators.h
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / jit / ThunkGenerators.h
CommitLineData
4e4e5a6f 1/*
93a37866 2 * Copyright (C) 2010, 2012, 2013 Apple Inc. All rights reserved.
4e4e5a6f
A
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
81345200
A
29#include "CodeSpecializationKind.h"
30#include "RegisterPreservationMode.h"
93a37866
A
31#include "ThunkGenerator.h"
32
4e4e5a6f 33#if ENABLE(JIT)
4e4e5a6f 34namespace JSC {
4e4e5a6f 35
81345200
A
36MacroAssemblerCodeRef throwExceptionFromCallSlowPathGenerator(VM*);
37
38MacroAssemblerCodeRef linkCallThunkGenerator(VM*);
39MacroAssemblerCodeRef linkConstructThunkGenerator(VM*);
40MacroAssemblerCodeRef linkCallThatPreservesRegsThunkGenerator(VM*);
41MacroAssemblerCodeRef linkConstructThatPreservesRegsThunkGenerator(VM*);
42
43inline 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
ed1e77d3
A
68MacroAssemblerCodeRef linkPolymorphicCallThunkGenerator(VM*);
69MacroAssemblerCodeRef linkPolymorphicCallThatPreservesRegsThunkGenerator(VM*);
81345200 70
ed1e77d3 71inline ThunkGenerator linkPolymorphicCallThunkGeneratorFor(RegisterPreservationMode registers)
81345200
A
72{
73 switch (registers) {
74 case RegisterPreservationNotRequired:
ed1e77d3 75 return linkPolymorphicCallThunkGenerator;
81345200 76 case MustPreserveRegisters:
ed1e77d3 77 return linkPolymorphicCallThatPreservesRegsThunkGenerator;
81345200
A
78 }
79 RELEASE_ASSERT_NOT_REACHED();
80 return 0;
81}
82
83MacroAssemblerCodeRef virtualCallThunkGenerator(VM*);
84MacroAssemblerCodeRef virtualConstructThunkGenerator(VM*);
85MacroAssemblerCodeRef virtualCallThatPreservesRegsThunkGenerator(VM*);
86MacroAssemblerCodeRef virtualConstructThatPreservesRegsThunkGenerator(VM*);
87
88inline 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
93a37866
A
113MacroAssemblerCodeRef nativeCallGenerator(VM*);
114MacroAssemblerCodeRef nativeConstructGenerator(VM*);
81345200 115MacroAssemblerCodeRef nativeTailCallGenerator(VM*);
ed1e77d3
A
116MacroAssemblerCodeRef arityFixupGenerator(VM*);
117
118MacroAssemblerCodeRef baselineGetterReturnThunkGenerator(VM* vm);
119MacroAssemblerCodeRef baselineSetterReturnThunkGenerator(VM* vm);
93a37866
A
120
121MacroAssemblerCodeRef charCodeAtThunkGenerator(VM*);
122MacroAssemblerCodeRef charAtThunkGenerator(VM*);
ed1e77d3 123MacroAssemblerCodeRef clz32ThunkGenerator(VM*);
93a37866
A
124MacroAssemblerCodeRef fromCharCodeThunkGenerator(VM*);
125MacroAssemblerCodeRef absThunkGenerator(VM*);
126MacroAssemblerCodeRef ceilThunkGenerator(VM*);
127MacroAssemblerCodeRef expThunkGenerator(VM*);
128MacroAssemblerCodeRef floorThunkGenerator(VM*);
129MacroAssemblerCodeRef logThunkGenerator(VM*);
130MacroAssemblerCodeRef roundThunkGenerator(VM*);
131MacroAssemblerCodeRef sqrtThunkGenerator(VM*);
132MacroAssemblerCodeRef powThunkGenerator(VM*);
133MacroAssemblerCodeRef imulThunkGenerator(VM*);
134
4e4e5a6f 135}
93a37866 136#endif // ENABLE(JIT)
4e4e5a6f
A
137
138#endif // ThunkGenerator_h