]> git.saurik.com Git - apple/javascriptcore.git/blame - jit/ThunkGenerators.h
JavaScriptCore-7600.1.4.16.1.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
68MacroAssemblerCodeRef linkClosureCallThunkGenerator(VM*);
69MacroAssemblerCodeRef linkClosureCallThatPreservesRegsThunkGenerator(VM*);
70
71inline 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
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
A
115MacroAssemblerCodeRef nativeTailCallGenerator(VM*);
116MacroAssemblerCodeRef arityFixup(VM*);
93a37866
A
117
118MacroAssemblerCodeRef charCodeAtThunkGenerator(VM*);
119MacroAssemblerCodeRef charAtThunkGenerator(VM*);
120MacroAssemblerCodeRef fromCharCodeThunkGenerator(VM*);
121MacroAssemblerCodeRef absThunkGenerator(VM*);
122MacroAssemblerCodeRef ceilThunkGenerator(VM*);
123MacroAssemblerCodeRef expThunkGenerator(VM*);
124MacroAssemblerCodeRef floorThunkGenerator(VM*);
125MacroAssemblerCodeRef logThunkGenerator(VM*);
126MacroAssemblerCodeRef roundThunkGenerator(VM*);
127MacroAssemblerCodeRef sqrtThunkGenerator(VM*);
128MacroAssemblerCodeRef powThunkGenerator(VM*);
129MacroAssemblerCodeRef imulThunkGenerator(VM*);
81345200
A
130MacroAssemblerCodeRef arrayIteratorNextKeyThunkGenerator(VM*);
131MacroAssemblerCodeRef arrayIteratorNextValueThunkGenerator(VM*);
93a37866 132
4e4e5a6f 133}
93a37866 134#endif // ENABLE(JIT)
4e4e5a6f
A
135
136#endif // ThunkGenerator_h