OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 Operand MemoryOperand(size_t* offset) { | 112 Operand MemoryOperand(size_t* offset) { |
113 AddressingMode mode = AddressingModeField::decode(instr_->opcode()); | 113 AddressingMode mode = AddressingModeField::decode(instr_->opcode()); |
114 switch (mode) { | 114 switch (mode) { |
115 case kMode_MR: { | 115 case kMode_MR: { |
116 Register base = InputRegister(NextOffset(offset)); | 116 Register base = InputRegister(NextOffset(offset)); |
117 int32_t disp = 0; | 117 int32_t disp = 0; |
118 return Operand(base, disp); | 118 return Operand(base, disp); |
119 } | 119 } |
120 case kMode_MRI: { | 120 case kMode_MRI: { |
121 Register base = InputRegister(NextOffset(offset)); | 121 Register base = InputRegister(NextOffset(offset)); |
122 int32_t disp = InputInt32(NextOffset(offset)); | 122 Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset))); |
123 return Operand(base, disp); | 123 return Operand(base, ctant.ToInt32(), ctant.rmode()); |
124 } | 124 } |
125 case kMode_MR1: | 125 case kMode_MR1: |
126 case kMode_MR2: | 126 case kMode_MR2: |
127 case kMode_MR4: | 127 case kMode_MR4: |
128 case kMode_MR8: { | 128 case kMode_MR8: { |
129 Register base = InputRegister(NextOffset(offset)); | 129 Register base = InputRegister(NextOffset(offset)); |
130 Register index = InputRegister(NextOffset(offset)); | 130 Register index = InputRegister(NextOffset(offset)); |
131 ScaleFactor scale = ScaleFor(kMode_MR1, mode); | 131 ScaleFactor scale = ScaleFor(kMode_MR1, mode); |
132 int32_t disp = 0; | 132 int32_t disp = 0; |
133 return Operand(base, index, scale, disp); | 133 return Operand(base, index, scale, disp); |
134 } | 134 } |
135 case kMode_MR1I: | 135 case kMode_MR1I: |
136 case kMode_MR2I: | 136 case kMode_MR2I: |
137 case kMode_MR4I: | 137 case kMode_MR4I: |
138 case kMode_MR8I: { | 138 case kMode_MR8I: { |
139 Register base = InputRegister(NextOffset(offset)); | 139 Register base = InputRegister(NextOffset(offset)); |
140 Register index = InputRegister(NextOffset(offset)); | 140 Register index = InputRegister(NextOffset(offset)); |
141 ScaleFactor scale = ScaleFor(kMode_MR1I, mode); | 141 ScaleFactor scale = ScaleFor(kMode_MR1I, mode); |
142 int32_t disp = InputInt32(NextOffset(offset)); | 142 Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset))); |
143 return Operand(base, index, scale, disp); | 143 return Operand(base, index, scale, ctant.ToInt32(), ctant.rmode()); |
144 } | 144 } |
145 case kMode_M1: | 145 case kMode_M1: |
146 case kMode_M2: | 146 case kMode_M2: |
147 case kMode_M4: | 147 case kMode_M4: |
148 case kMode_M8: { | 148 case kMode_M8: { |
149 Register index = InputRegister(NextOffset(offset)); | 149 Register index = InputRegister(NextOffset(offset)); |
150 ScaleFactor scale = ScaleFor(kMode_M1, mode); | 150 ScaleFactor scale = ScaleFor(kMode_M1, mode); |
151 int32_t disp = 0; | 151 int32_t disp = 0; |
152 return Operand(index, scale, disp); | 152 return Operand(index, scale, disp); |
153 } | 153 } |
154 case kMode_M1I: | 154 case kMode_M1I: |
155 case kMode_M2I: | 155 case kMode_M2I: |
156 case kMode_M4I: | 156 case kMode_M4I: |
157 case kMode_M8I: { | 157 case kMode_M8I: { |
158 Register index = InputRegister(NextOffset(offset)); | 158 Register index = InputRegister(NextOffset(offset)); |
159 ScaleFactor scale = ScaleFor(kMode_M1I, mode); | 159 ScaleFactor scale = ScaleFor(kMode_M1I, mode); |
160 int32_t disp = InputInt32(NextOffset(offset)); | 160 Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset))); |
161 return Operand(index, scale, disp); | 161 return Operand(index, scale, ctant.ToInt32(), ctant.rmode()); |
162 } | 162 } |
163 case kMode_MI: { | 163 case kMode_MI: { |
164 int32_t disp = InputInt32(NextOffset(offset)); | 164 Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset))); |
165 return Operand(Immediate(disp)); | 165 return Operand(ctant.ToInt32(), ctant.rmode()); |
166 } | 166 } |
167 case kMode_None: | 167 case kMode_None: |
168 UNREACHABLE(); | 168 UNREACHABLE(); |
169 return Operand(no_reg, 0); | 169 return Operand(no_reg, 0); |
170 } | 170 } |
171 UNREACHABLE(); | 171 UNREACHABLE(); |
172 return Operand(no_reg, 0); | 172 return Operand(no_reg, 0); |
173 } | 173 } |
174 | 174 |
175 Operand MemoryOperand(size_t first_input = 0) { | 175 Operand MemoryOperand(size_t first_input = 0) { |
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1975 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 1975 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
1976 __ Nop(padding_size); | 1976 __ Nop(padding_size); |
1977 } | 1977 } |
1978 } | 1978 } |
1979 | 1979 |
1980 #undef __ | 1980 #undef __ |
1981 | 1981 |
1982 } // namespace compiler | 1982 } // namespace compiler |
1983 } // namespace internal | 1983 } // namespace internal |
1984 } // namespace v8 | 1984 } // namespace v8 |
OLD | NEW |