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 23 matching lines...) Expand all Loading... |
34 return !isolate()->heap()->InNewSpace(*value.handle()); | 34 return !isolate()->heap()->InNewSpace(*value.handle()); |
35 } | 35 } |
36 default: | 36 default: |
37 return false; | 37 return false; |
38 } | 38 } |
39 } | 39 } |
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<LoadRepresentation>(node)); |
45 MachineType typ = TypeOf(OpParameter<MachineType>(node)); | 45 MachineType typ = TypeOf(OpParameter<LoadRepresentation>(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 ArchOpcode opcode; | 50 ArchOpcode opcode; |
51 // TODO(titzer): signed/unsigned small loads | 51 // TODO(titzer): signed/unsigned small loads |
52 switch (rep) { | 52 switch (rep) { |
53 case kRepFloat32: | 53 case kRepFloat32: |
54 opcode = kIA32Movss; | 54 opcode = kIA32Movss; |
55 break; | 55 break; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 void InstructionSelector::VisitStore(Node* node) { | 94 void InstructionSelector::VisitStore(Node* node) { |
95 IA32OperandGenerator g(this); | 95 IA32OperandGenerator g(this); |
96 Node* base = node->InputAt(0); | 96 Node* base = node->InputAt(0); |
97 Node* index = node->InputAt(1); | 97 Node* index = node->InputAt(1); |
98 Node* value = node->InputAt(2); | 98 Node* value = node->InputAt(2); |
99 | 99 |
100 StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node); | 100 StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node); |
101 MachineType rep = RepresentationOf(store_rep.machine_type); | 101 MachineType rep = RepresentationOf(store_rep.machine_type()); |
102 if (store_rep.write_barrier_kind == kFullWriteBarrier) { | 102 if (store_rep.write_barrier_kind() == kFullWriteBarrier) { |
103 DCHECK_EQ(kRepTagged, rep); | 103 DCHECK_EQ(kRepTagged, rep); |
104 // TODO(dcarney): refactor RecordWrite function to take temp registers | 104 // TODO(dcarney): refactor RecordWrite function to take temp registers |
105 // and pass them here instead of using fixed regs | 105 // and pass them here instead of using fixed regs |
106 // TODO(dcarney): handle immediate indices. | 106 // TODO(dcarney): handle immediate indices. |
107 InstructionOperand* temps[] = {g.TempRegister(ecx), g.TempRegister(edx)}; | 107 InstructionOperand* temps[] = {g.TempRegister(ecx), g.TempRegister(edx)}; |
108 Emit(kIA32StoreWriteBarrier, NULL, g.UseFixed(base, ebx), | 108 Emit(kIA32StoreWriteBarrier, NULL, g.UseFixed(base, ebx), |
109 g.UseFixed(index, ecx), g.UseFixed(value, edx), arraysize(temps), | 109 g.UseFixed(index, ecx), g.UseFixed(value, edx), arraysize(temps), |
110 temps); | 110 temps); |
111 return; | 111 return; |
112 } | 112 } |
113 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind); | 113 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind()); |
114 InstructionOperand* val; | 114 InstructionOperand* val; |
115 if (g.CanBeImmediate(value)) { | 115 if (g.CanBeImmediate(value)) { |
116 val = g.UseImmediate(value); | 116 val = g.UseImmediate(value); |
117 } else if (rep == kRepWord8 || rep == kRepBit) { | 117 } else if (rep == kRepWord8 || rep == kRepBit) { |
118 val = g.UseByteRegister(value); | 118 val = g.UseByteRegister(value); |
119 } else { | 119 } else { |
120 val = g.UseRegister(value); | 120 val = g.UseRegister(value); |
121 } | 121 } |
122 ArchOpcode opcode; | 122 ArchOpcode opcode; |
123 switch (rep) { | 123 switch (rep) { |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 if (descriptor->kind() == CallDescriptor::kCallAddress && | 560 if (descriptor->kind() == CallDescriptor::kCallAddress && |
561 buffer.pushed_nodes.size() > 0) { | 561 buffer.pushed_nodes.size() > 0) { |
562 DCHECK(deoptimization == NULL && continuation == NULL); | 562 DCHECK(deoptimization == NULL && continuation == NULL); |
563 Emit(kArchDrop | MiscField::encode(buffer.pushed_nodes.size()), NULL); | 563 Emit(kArchDrop | MiscField::encode(buffer.pushed_nodes.size()), NULL); |
564 } | 564 } |
565 } | 565 } |
566 | 566 |
567 } // namespace compiler | 567 } // namespace compiler |
568 } // namespace internal | 568 } // namespace internal |
569 } // namespace v8 | 569 } // namespace v8 |
OLD | NEW |