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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 Operand MemoryOperand(size_t* offset) { | 106 Operand MemoryOperand(size_t* offset) { |
107 AddressingMode mode = AddressingModeField::decode(instr_->opcode()); | 107 AddressingMode mode = AddressingModeField::decode(instr_->opcode()); |
108 switch (mode) { | 108 switch (mode) { |
109 case kMode_MR: { | 109 case kMode_MR: { |
110 Register base = InputRegister(NextOffset(offset)); | 110 Register base = InputRegister(NextOffset(offset)); |
111 int32_t disp = 0; | 111 int32_t disp = 0; |
112 return Operand(base, disp); | 112 return Operand(base, disp); |
113 } | 113 } |
114 case kMode_MRI: { | 114 case kMode_MRI: { |
115 Register base = InputRegister(NextOffset(offset)); | 115 Register base = InputRegister(NextOffset(offset)); |
116 int32_t disp = InputInt32(NextOffset(offset)); | 116 Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset))); |
117 return Operand(base, disp); | 117 return Operand(base, ctant.ToInt32(), ctant.rmode()); |
118 } | 118 } |
119 case kMode_MR1: | 119 case kMode_MR1: |
120 case kMode_MR2: | 120 case kMode_MR2: |
121 case kMode_MR4: | 121 case kMode_MR4: |
122 case kMode_MR8: { | 122 case kMode_MR8: { |
123 Register base = InputRegister(NextOffset(offset)); | 123 Register base = InputRegister(NextOffset(offset)); |
124 Register index = InputRegister(NextOffset(offset)); | 124 Register index = InputRegister(NextOffset(offset)); |
125 ScaleFactor scale = ScaleFor(kMode_MR1, mode); | 125 ScaleFactor scale = ScaleFor(kMode_MR1, mode); |
126 int32_t disp = 0; | 126 int32_t disp = 0; |
127 return Operand(base, index, scale, disp); | 127 return Operand(base, index, scale, disp); |
128 } | 128 } |
129 case kMode_MR1I: | 129 case kMode_MR1I: |
130 case kMode_MR2I: | 130 case kMode_MR2I: |
131 case kMode_MR4I: | 131 case kMode_MR4I: |
132 case kMode_MR8I: { | 132 case kMode_MR8I: { |
133 Register base = InputRegister(NextOffset(offset)); | 133 Register base = InputRegister(NextOffset(offset)); |
134 Register index = InputRegister(NextOffset(offset)); | 134 Register index = InputRegister(NextOffset(offset)); |
135 ScaleFactor scale = ScaleFor(kMode_MR1I, mode); | 135 ScaleFactor scale = ScaleFor(kMode_MR1I, mode); |
136 int32_t disp = InputInt32(NextOffset(offset)); | 136 Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset))); |
137 return Operand(base, index, scale, disp); | 137 return Operand(base, index, scale, ctant.ToInt32(), ctant.rmode()); |
138 } | 138 } |
139 case kMode_M1: | 139 case kMode_M1: |
140 case kMode_M2: | 140 case kMode_M2: |
141 case kMode_M4: | 141 case kMode_M4: |
142 case kMode_M8: { | 142 case kMode_M8: { |
143 Register index = InputRegister(NextOffset(offset)); | 143 Register index = InputRegister(NextOffset(offset)); |
144 ScaleFactor scale = ScaleFor(kMode_M1, mode); | 144 ScaleFactor scale = ScaleFor(kMode_M1, mode); |
145 int32_t disp = 0; | 145 int32_t disp = 0; |
146 return Operand(index, scale, disp); | 146 return Operand(index, scale, disp); |
147 } | 147 } |
148 case kMode_M1I: | 148 case kMode_M1I: |
149 case kMode_M2I: | 149 case kMode_M2I: |
150 case kMode_M4I: | 150 case kMode_M4I: |
151 case kMode_M8I: { | 151 case kMode_M8I: { |
152 Register index = InputRegister(NextOffset(offset)); | 152 Register index = InputRegister(NextOffset(offset)); |
153 ScaleFactor scale = ScaleFor(kMode_M1I, mode); | 153 ScaleFactor scale = ScaleFor(kMode_M1I, mode); |
154 int32_t disp = InputInt32(NextOffset(offset)); | 154 Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset))); |
155 return Operand(index, scale, disp); | 155 return Operand(index, scale, ctant.ToInt32(), ctant.rmode()); |
156 } | 156 } |
157 case kMode_MI: { | 157 case kMode_MI: { |
158 int32_t disp = InputInt32(NextOffset(offset)); | 158 Constant ctant = ToConstant(instr_->InputAt(NextOffset(offset))); |
159 return Operand(Immediate(disp)); | 159 return Operand(ctant.ToInt32(), ctant.rmode()); |
160 } | 160 } |
161 case kMode_None: | 161 case kMode_None: |
162 UNREACHABLE(); | 162 UNREACHABLE(); |
163 return Operand(no_reg, 0); | 163 return Operand(no_reg, 0); |
164 } | 164 } |
165 UNREACHABLE(); | 165 UNREACHABLE(); |
166 return Operand(no_reg, 0); | 166 return Operand(no_reg, 0); |
167 } | 167 } |
168 | 168 |
169 Operand MemoryOperand(size_t first_input = 0) { | 169 Operand MemoryOperand(size_t first_input = 0) { |
(...skipping 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2518 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2519 __ Nop(padding_size); | 2519 __ Nop(padding_size); |
2520 } | 2520 } |
2521 } | 2521 } |
2522 | 2522 |
2523 #undef __ | 2523 #undef __ |
2524 | 2524 |
2525 } // namespace compiler | 2525 } // namespace compiler |
2526 } // namespace internal | 2526 } // namespace internal |
2527 } // namespace v8 | 2527 } // namespace v8 |
OLD | NEW |