| 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 #include "src/compiler/node-properties-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 | 42 |
| 43 void InstructionSelector::VisitLoad(Node* node) { | 43 void InstructionSelector::VisitLoad(Node* node) { |
| 44 MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); | 44 MachineType rep = RepresentationOf(OpParameter<MachineType>(node)); |
| 45 MachineType typ = TypeOf(OpParameter<MachineType>(node)); | 45 MachineType typ = TypeOf(OpParameter<MachineType>(node)); |
| 46 IA32OperandGenerator g(this); | 46 IA32OperandGenerator g(this); |
| 47 Node* base = node->InputAt(0); | 47 Node* base = node->InputAt(0); |
| 48 Node* index = node->InputAt(1); | 48 Node* index = node->InputAt(1); |
| 49 | 49 |
| 50 InstructionOperand* output = rep == kRepFloat64 | 50 InstructionOperand* output = (rep == kRepFloat32 || rep == kRepFloat64) |
| 51 ? g.DefineAsDoubleRegister(node) | 51 ? g.DefineAsDoubleRegister(node) |
| 52 : g.DefineAsRegister(node); | 52 : g.DefineAsRegister(node); |
| 53 ArchOpcode opcode; | 53 ArchOpcode opcode; |
| 54 // TODO(titzer): signed/unsigned small loads | 54 // TODO(titzer): signed/unsigned small loads |
| 55 switch (rep) { | 55 switch (rep) { |
| 56 case kRepFloat32: |
| 57 opcode = kIA32Movss; |
| 58 break; |
| 56 case kRepFloat64: | 59 case kRepFloat64: |
| 57 opcode = kIA32Movsd; | 60 opcode = kIA32Movsd; |
| 58 break; | 61 break; |
| 59 case kRepBit: // Fall through. | 62 case kRepBit: // Fall through. |
| 60 case kRepWord8: | 63 case kRepWord8: |
| 61 opcode = typ == kTypeInt32 ? kIA32Movsxbl : kIA32Movzxbl; | 64 opcode = typ == kTypeInt32 ? kIA32Movsxbl : kIA32Movzxbl; |
| 62 break; | 65 break; |
| 63 case kRepWord16: | 66 case kRepWord16: |
| 64 opcode = typ == kTypeInt32 ? kIA32Movsxwl : kIA32Movzxwl; | 67 opcode = typ == kTypeInt32 ? kIA32Movsxwl : kIA32Movzxwl; |
| 65 break; | 68 break; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // and pass them here instead of using fixed regs | 107 // and pass them here instead of using fixed regs |
| 105 // TODO(dcarney): handle immediate indices. | 108 // TODO(dcarney): handle immediate indices. |
| 106 InstructionOperand* temps[] = {g.TempRegister(ecx), g.TempRegister(edx)}; | 109 InstructionOperand* temps[] = {g.TempRegister(ecx), g.TempRegister(edx)}; |
| 107 Emit(kIA32StoreWriteBarrier, NULL, g.UseFixed(base, ebx), | 110 Emit(kIA32StoreWriteBarrier, NULL, g.UseFixed(base, ebx), |
| 108 g.UseFixed(index, ecx), g.UseFixed(value, edx), ARRAY_SIZE(temps), | 111 g.UseFixed(index, ecx), g.UseFixed(value, edx), ARRAY_SIZE(temps), |
| 109 temps); | 112 temps); |
| 110 return; | 113 return; |
| 111 } | 114 } |
| 112 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind); | 115 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind); |
| 113 InstructionOperand* val; | 116 InstructionOperand* val; |
| 114 if (rep == kRepFloat64) { | 117 if (rep == kRepFloat32 || rep == kRepFloat64) { |
| 115 val = g.UseDoubleRegister(value); | 118 val = g.UseDoubleRegister(value); |
| 116 } else { | 119 } else { |
| 117 if (g.CanBeImmediate(value)) { | 120 if (g.CanBeImmediate(value)) { |
| 118 val = g.UseImmediate(value); | 121 val = g.UseImmediate(value); |
| 119 } else if (rep == kRepWord8 || rep == kRepBit) { | 122 } else if (rep == kRepWord8 || rep == kRepBit) { |
| 120 val = g.UseByteRegister(value); | 123 val = g.UseByteRegister(value); |
| 121 } else { | 124 } else { |
| 122 val = g.UseRegister(value); | 125 val = g.UseRegister(value); |
| 123 } | 126 } |
| 124 } | 127 } |
| 125 ArchOpcode opcode; | 128 ArchOpcode opcode; |
| 126 switch (rep) { | 129 switch (rep) { |
| 130 case kRepFloat32: |
| 131 opcode = kIA32Movss; |
| 132 break; |
| 127 case kRepFloat64: | 133 case kRepFloat64: |
| 128 opcode = kIA32Movsd; | 134 opcode = kIA32Movsd; |
| 129 break; | 135 break; |
| 130 case kRepBit: // Fall through. | 136 case kRepBit: // Fall through. |
| 131 case kRepWord8: | 137 case kRepWord8: |
| 132 opcode = kIA32Movb; | 138 opcode = kIA32Movb; |
| 133 break; | 139 break; |
| 134 case kRepWord16: | 140 case kRepWord16: |
| 135 opcode = kIA32Movw; | 141 opcode = kIA32Movw; |
| 136 break; | 142 break; |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (descriptor->kind() == CallDescriptor::kCallAddress && | 572 if (descriptor->kind() == CallDescriptor::kCallAddress && |
| 567 buffer.pushed_nodes.size() > 0) { | 573 buffer.pushed_nodes.size() > 0) { |
| 568 DCHECK(deoptimization == NULL && continuation == NULL); | 574 DCHECK(deoptimization == NULL && continuation == NULL); |
| 569 Emit(kPopStack | MiscField::encode(buffer.pushed_nodes.size()), NULL); | 575 Emit(kPopStack | MiscField::encode(buffer.pushed_nodes.size()), NULL); |
| 570 } | 576 } |
| 571 } | 577 } |
| 572 | 578 |
| 573 } // namespace compiler | 579 } // namespace compiler |
| 574 } // namespace internal | 580 } // namespace internal |
| 575 } // namespace v8 | 581 } // namespace v8 |
| OLD | NEW |