OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 void InstructionSelector::VisitStore(Node* node) { | 148 void InstructionSelector::VisitStore(Node* node) { |
149 X64OperandGenerator g(this); | 149 X64OperandGenerator g(this); |
150 Node* base = node->InputAt(0); | 150 Node* base = node->InputAt(0); |
151 Node* index = node->InputAt(1); | 151 Node* index = node->InputAt(1); |
152 Node* value = node->InputAt(2); | 152 Node* value = node->InputAt(2); |
153 | 153 |
154 StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node); | 154 StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node); |
155 MachineType rep = RepresentationOf(store_rep.machine_type()); | 155 MachineType rep = RepresentationOf(store_rep.machine_type()); |
156 if (store_rep.write_barrier_kind() == kFullWriteBarrier) { | 156 if (store_rep.write_barrier_kind() == kFullWriteBarrier) { |
157 DCHECK(rep == kRepTagged); | 157 DCHECK_EQ(kRepTagged, rep); |
158 // TODO(dcarney): refactor RecordWrite function to take temp registers | 158 // TODO(dcarney): refactor RecordWrite function to take temp registers |
159 // and pass them here instead of using fixed regs | 159 // and pass them here instead of using fixed regs |
160 // TODO(dcarney): handle immediate indices. | 160 if (g.CanBeImmediate(index)) { |
161 InstructionOperand temps[] = {g.TempRegister(rcx), g.TempRegister(rdx)}; | 161 InstructionOperand temps[] = {g.TempRegister(rcx), g.TempRegister()}; |
162 Emit(kX64StoreWriteBarrier, g.NoOutput(), g.UseFixed(base, rbx), | 162 Emit(kX64StoreWriteBarrier, g.NoOutput(), g.UseFixed(base, rbx), |
163 g.UseFixed(index, rcx), g.UseFixed(value, rdx), arraysize(temps), | 163 g.UseImmediate(index), g.UseFixed(value, rcx), arraysize(temps), |
164 temps); | 164 temps); |
| 165 } else { |
| 166 InstructionOperand temps[] = {g.TempRegister(rcx), g.TempRegister(rdx)}; |
| 167 Emit(kX64StoreWriteBarrier, g.NoOutput(), g.UseFixed(base, rbx), |
| 168 g.UseFixed(index, rcx), g.UseFixed(value, rdx), arraysize(temps), |
| 169 temps); |
| 170 } |
165 return; | 171 return; |
166 } | 172 } |
167 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind()); | 173 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind()); |
| 174 |
168 ArchOpcode opcode; | 175 ArchOpcode opcode; |
169 switch (rep) { | 176 switch (rep) { |
170 case kRepFloat32: | 177 case kRepFloat32: |
171 opcode = kX64Movss; | 178 opcode = kX64Movss; |
172 break; | 179 break; |
173 case kRepFloat64: | 180 case kRepFloat64: |
174 opcode = kX64Movsd; | 181 opcode = kX64Movsd; |
175 break; | 182 break; |
176 case kRepBit: // Fall through. | 183 case kRepBit: // Fall through. |
177 case kRepWord8: | 184 case kRepWord8: |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 if (CpuFeatures::IsSupported(SSE4_1)) { | 1537 if (CpuFeatures::IsSupported(SSE4_1)) { |
1531 flags |= MachineOperatorBuilder::kFloat64RoundDown | | 1538 flags |= MachineOperatorBuilder::kFloat64RoundDown | |
1532 MachineOperatorBuilder::kFloat64RoundTruncate; | 1539 MachineOperatorBuilder::kFloat64RoundTruncate; |
1533 } | 1540 } |
1534 return flags; | 1541 return flags; |
1535 } | 1542 } |
1536 | 1543 |
1537 } // namespace compiler | 1544 } // namespace compiler |
1538 } // namespace internal | 1545 } // namespace internal |
1539 } // namespace v8 | 1546 } // namespace v8 |
OLD | NEW |