]>
Commit | Line | Data |
---|---|---|
93a37866 A |
1 | /* |
2 | * Copyright (C) 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. ``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 | #ifndef DFGSilentRegisterSavePlan_h | |
27 | #define DFGSilentRegisterSavePlan_h | |
28 | ||
29 | #include <wtf/Platform.h> | |
30 | ||
31 | #if ENABLE(DFG_JIT) | |
32 | ||
33 | #include "DFGCommon.h" | |
34 | #include "DFGFPRInfo.h" | |
35 | #include "DFGGPRInfo.h" | |
36 | ||
37 | namespace JSC { namespace DFG { | |
38 | ||
39 | enum SilentSpillAction { | |
40 | DoNothingForSpill, | |
41 | Store32Tag, | |
42 | Store32Payload, | |
43 | StorePtr, | |
44 | Store64, | |
45 | StoreDouble | |
46 | }; | |
47 | ||
48 | enum SilentFillAction { | |
49 | DoNothingForFill, | |
50 | SetInt32Constant, | |
51 | SetBooleanConstant, | |
52 | SetCellConstant, | |
53 | SetTrustedJSConstant, | |
54 | SetJSConstant, | |
55 | SetJSConstantTag, | |
56 | SetJSConstantPayload, | |
57 | SetInt32Tag, | |
58 | SetCellTag, | |
59 | SetBooleanTag, | |
60 | SetDoubleConstant, | |
61 | Load32Tag, | |
62 | Load32Payload, | |
63 | Load32PayloadBoxInt, | |
64 | LoadPtr, | |
65 | Load64, | |
66 | LoadDouble, | |
67 | LoadDoubleBoxDouble, | |
68 | LoadJSUnboxDouble | |
69 | }; | |
70 | ||
71 | class SilentRegisterSavePlan { | |
72 | public: | |
73 | SilentRegisterSavePlan() | |
74 | : m_spillAction(DoNothingForSpill) | |
75 | , m_fillAction(DoNothingForFill) | |
76 | , m_register(-1) | |
77 | , m_node(0) | |
78 | { | |
79 | } | |
80 | ||
81 | SilentRegisterSavePlan( | |
82 | SilentSpillAction spillAction, | |
83 | SilentFillAction fillAction, | |
84 | Node* node, | |
85 | GPRReg gpr) | |
86 | : m_spillAction(spillAction) | |
87 | , m_fillAction(fillAction) | |
88 | , m_register(gpr) | |
89 | , m_node(node) | |
90 | { | |
91 | } | |
92 | ||
93 | SilentRegisterSavePlan( | |
94 | SilentSpillAction spillAction, | |
95 | SilentFillAction fillAction, | |
96 | Node* node, | |
97 | FPRReg fpr) | |
98 | : m_spillAction(spillAction) | |
99 | , m_fillAction(fillAction) | |
100 | , m_register(fpr) | |
101 | , m_node(node) | |
102 | { | |
103 | } | |
104 | ||
105 | SilentSpillAction spillAction() const { return static_cast<SilentSpillAction>(m_spillAction); } | |
106 | SilentFillAction fillAction() const { return static_cast<SilentFillAction>(m_fillAction); } | |
107 | ||
108 | Node* node() const { return m_node; } | |
109 | ||
110 | GPRReg gpr() const { return static_cast<GPRReg>(m_register); } | |
111 | FPRReg fpr() const { return static_cast<FPRReg>(m_register); } | |
112 | ||
113 | private: | |
114 | int8_t m_spillAction; | |
115 | int8_t m_fillAction; | |
116 | int8_t m_register; | |
117 | Node* m_node; | |
118 | }; | |
119 | ||
120 | } } // namespace JSC::DFG | |
121 | ||
122 | #endif // ENABLE(DFG_JIT) | |
123 | ||
124 | #endif // DFGSilentRegisterSavePlan_h | |
125 |