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 "src/compiler/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace compiler { | 10 namespace compiler { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 }; | 55 }; |
56 | 56 |
57 | 57 |
58 void InstructionSelector::VisitLoad(Node* node) { | 58 void InstructionSelector::VisitLoad(Node* node) { |
59 MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); | 59 MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); |
60 MachineType typ = TypeOf(OpParameter<MachineType>(node)); | 60 MachineType typ = TypeOf(OpParameter<MachineType>(node)); |
61 X64OperandGenerator g(this); | 61 X64OperandGenerator g(this); |
62 Node* base = node->InputAt(0); | 62 Node* base = node->InputAt(0); |
63 Node* index = node->InputAt(1); | 63 Node* index = node->InputAt(1); |
64 | 64 |
65 InstructionOperand* output = rep == kRepFloat64 | 65 InstructionOperand* output = (rep == kRepFloat32 || rep == kRepFloat64) |
66 ? g.DefineAsDoubleRegister(node) | 66 ? g.DefineAsDoubleRegister(node) |
67 : g.DefineAsRegister(node); | 67 : g.DefineAsRegister(node); |
68 ArchOpcode opcode; | 68 ArchOpcode opcode; |
69 // TODO(titzer): signed/unsigned small loads | 69 // TODO(titzer): signed/unsigned small loads |
70 switch (rep) { | 70 switch (rep) { |
| 71 case kRepFloat32: |
| 72 opcode = kX64Movss; |
| 73 break; |
71 case kRepFloat64: | 74 case kRepFloat64: |
72 opcode = kX64Movsd; | 75 opcode = kX64Movsd; |
73 break; | 76 break; |
74 case kRepBit: // Fall through. | 77 case kRepBit: // Fall through. |
75 case kRepWord8: | 78 case kRepWord8: |
76 opcode = typ == kTypeInt32 ? kX64Movsxbl : kX64Movzxbl; | 79 opcode = typ == kTypeInt32 ? kX64Movsxbl : kX64Movzxbl; |
77 break; | 80 break; |
78 case kRepWord16: | 81 case kRepWord16: |
79 opcode = typ == kTypeInt32 ? kX64Movsxwl : kX64Movzxwl; | 82 opcode = typ == kTypeInt32 ? kX64Movsxwl : kX64Movzxwl; |
80 break; | 83 break; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // and pass them here instead of using fixed regs | 121 // and pass them here instead of using fixed regs |
119 // TODO(dcarney): handle immediate indices. | 122 // TODO(dcarney): handle immediate indices. |
120 InstructionOperand* temps[] = {g.TempRegister(rcx), g.TempRegister(rdx)}; | 123 InstructionOperand* temps[] = {g.TempRegister(rcx), g.TempRegister(rdx)}; |
121 Emit(kX64StoreWriteBarrier, NULL, g.UseFixed(base, rbx), | 124 Emit(kX64StoreWriteBarrier, NULL, g.UseFixed(base, rbx), |
122 g.UseFixed(index, rcx), g.UseFixed(value, rdx), ARRAY_SIZE(temps), | 125 g.UseFixed(index, rcx), g.UseFixed(value, rdx), ARRAY_SIZE(temps), |
123 temps); | 126 temps); |
124 return; | 127 return; |
125 } | 128 } |
126 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind); | 129 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind); |
127 InstructionOperand* val; | 130 InstructionOperand* val; |
128 if (rep == kRepFloat64) { | 131 if (rep == kRepFloat32 || rep == kRepFloat64) { |
129 val = g.UseDoubleRegister(value); | 132 val = g.UseDoubleRegister(value); |
130 } else { | 133 } else { |
131 if (g.CanBeImmediate(value)) { | 134 if (g.CanBeImmediate(value)) { |
132 val = g.UseImmediate(value); | 135 val = g.UseImmediate(value); |
133 } else if (rep == kRepWord8 || rep == kRepBit) { | 136 } else if (rep == kRepWord8 || rep == kRepBit) { |
134 val = g.UseByteRegister(value); | 137 val = g.UseByteRegister(value); |
135 } else { | 138 } else { |
136 val = g.UseRegister(value); | 139 val = g.UseRegister(value); |
137 } | 140 } |
138 } | 141 } |
139 ArchOpcode opcode; | 142 ArchOpcode opcode; |
140 switch (rep) { | 143 switch (rep) { |
| 144 case kRepFloat32: |
| 145 opcode = kX64Movss; |
| 146 break; |
141 case kRepFloat64: | 147 case kRepFloat64: |
142 opcode = kX64Movsd; | 148 opcode = kX64Movsd; |
143 break; | 149 break; |
144 case kRepBit: // Fall through. | 150 case kRepBit: // Fall through. |
145 case kRepWord8: | 151 case kRepWord8: |
146 opcode = kX64Movb; | 152 opcode = kX64Movb; |
147 break; | 153 break; |
148 case kRepWord16: | 154 case kRepWord16: |
149 opcode = kX64Movw; | 155 opcode = kX64Movw; |
150 break; | 156 break; |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 DCHECK(deoptimization == NULL && continuation == NULL); | 742 DCHECK(deoptimization == NULL && continuation == NULL); |
737 Emit(kPopStack | | 743 Emit(kPopStack | |
738 MiscField::encode(static_cast<int>(buffer.pushed_nodes.size())), | 744 MiscField::encode(static_cast<int>(buffer.pushed_nodes.size())), |
739 NULL); | 745 NULL); |
740 } | 746 } |
741 } | 747 } |
742 | 748 |
743 } // namespace compiler | 749 } // namespace compiler |
744 } // namespace internal | 750 } // namespace internal |
745 } // namespace v8 | 751 } // namespace v8 |
OLD | NEW |