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