Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: src/compiler/int64-lowering.cc

Issue 1779713009: Implement optional turbofan UnalignedLoad and UnalignedStore operators (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix failures in cctest/test-run-wasm-64/Run_Wasm_LoadStoreI64_sx due to missing implementation of U… Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/int64-lowering.h" 5 #include "src/compiler/int64-lowering.h"
6 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/diamond.h" 7 #include "src/compiler/diamond.h"
8 #include "src/compiler/graph.h" 8 #include "src/compiler/graph.h"
9 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } else { 119 } else {
120 high_node = graph()->NewNode(load_op, base, index_high); 120 high_node = graph()->NewNode(load_op, base, index_high);
121 } 121 }
122 NodeProperties::ChangeOp(node, load_op); 122 NodeProperties::ChangeOp(node, load_op);
123 ReplaceNode(node, node, high_node); 123 ReplaceNode(node, node, high_node);
124 } else { 124 } else {
125 DefaultLowering(node); 125 DefaultLowering(node);
126 } 126 }
127 break; 127 break;
128 } 128 }
129 case IrOpcode::kUnalignedLoad: {
130 UnalignedLoadRepresentation load_rep =
131 UnalignedLoadRepresentationOf(node->op());
132
133 if (load_rep.representation() == MachineRepresentation::kWord64) {
134 Node* base = node->InputAt(0);
135 Node* index = node->InputAt(1);
136 Node* index_high =
137 graph()->NewNode(machine()->Int32Add(), index,
138 graph()->NewNode(common()->Int32Constant(4)));
139
140 const Operator* load_op =
141 machine()->UnalignedLoad(MachineType::Int32()).op();
142 Node* high_node;
143 if (node->InputCount() > 2) {
144 Node* effect_high = node->InputAt(2);
145 Node* control_high = node->InputAt(3);
146 high_node = graph()->NewNode(load_op, base, index_high, effect_high,
147 control_high);
148 // change the effect change from old_node --> old_effect to
149 // old_node --> high_node --> old_effect.
150 node->ReplaceInput(2, high_node);
151 } else {
152 high_node = graph()->NewNode(load_op, base, index_high);
153 }
154 NodeProperties::ChangeOp(node, load_op);
155 ReplaceNode(node, node, high_node);
156 } else {
157 DefaultLowering(node);
158 }
159 break;
160 }
129 case IrOpcode::kStore: { 161 case IrOpcode::kStore: {
130 StoreRepresentation store_rep = StoreRepresentationOf(node->op()); 162 StoreRepresentation store_rep = StoreRepresentationOf(node->op());
131 if (store_rep.representation() == MachineRepresentation::kWord64) { 163 if (store_rep.representation() == MachineRepresentation::kWord64) {
132 // We change the original store node to store the low word, and create 164 // We change the original store node to store the low word, and create
133 // a new store node to store the high word. The effect and control edges 165 // a new store node to store the high word. The effect and control edges
134 // are copied from the original store to the new store node, the effect 166 // are copied from the original store to the new store node, the effect
135 // edge of the original store is redirected to the new store. 167 // edge of the original store is redirected to the new store.
136 WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind(); 168 WriteBarrierKind write_barrier_kind = store_rep.write_barrier_kind();
137 169
138 Node* base = node->InputAt(0); 170 Node* base = node->InputAt(0);
(...skipping 24 matching lines...) Expand all
163 } 195 }
164 196
165 node->ReplaceInput(2, GetReplacementLow(value)); 197 node->ReplaceInput(2, GetReplacementLow(value));
166 NodeProperties::ChangeOp(node, store_op); 198 NodeProperties::ChangeOp(node, store_op);
167 ReplaceNode(node, node, high_node); 199 ReplaceNode(node, node, high_node);
168 } else { 200 } else {
169 DefaultLowering(node); 201 DefaultLowering(node);
170 } 202 }
171 break; 203 break;
172 } 204 }
205 case IrOpcode::kUnalignedStore: {
206 UnalignedStoreRepresentation store_rep =
207 UnalignedStoreRepresentationOf(node->op());
208 if (store_rep == MachineRepresentation::kWord64) {
209 Node* base = node->InputAt(0);
210 Node* index = node->InputAt(1);
211 Node* index_high =
212 graph()->NewNode(machine()->Int32Add(), index,
213 graph()->NewNode(common()->Int32Constant(4)));
214
215 Node* value = node->InputAt(2);
216 DCHECK(HasReplacementLow(value));
217 DCHECK(HasReplacementHigh(value));
218
219 const Operator* store_op =
220 machine()->UnalignedStore(MachineRepresentation::kWord32).op();
221
222 Node* high_node;
223 if (node->InputCount() > 3) {
224 Node* effect_high = node->InputAt(3);
225 Node* control_high = node->InputAt(4);
226 high_node = graph()->NewNode(store_op, base, index_high,
227 GetReplacementHigh(value), effect_high,
228 control_high);
229 node->ReplaceInput(3, high_node);
230
231 } else {
232 high_node = graph()->NewNode(store_op, base, index_high,
233 GetReplacementHigh(value));
234 }
235
236 node->ReplaceInput(2, GetReplacementLow(value));
237 NodeProperties::ChangeOp(node, store_op);
238 ReplaceNode(node, node, high_node);
239 } else {
240 DefaultLowering(node);
241 }
242 break;
243 }
244
173 case IrOpcode::kStart: { 245 case IrOpcode::kStart: {
174 int parameter_count = GetParameterCountAfterLowering(signature()); 246 int parameter_count = GetParameterCountAfterLowering(signature());
175 // Only exchange the node if the parameter count actually changed. 247 // Only exchange the node if the parameter count actually changed.
176 if (parameter_count != signature()->parameter_count()) { 248 if (parameter_count != signature()->parameter_count()) {
177 int delta = 249 int delta =
178 parameter_count - static_cast<int>(signature()->parameter_count()); 250 parameter_count - static_cast<int>(signature()->parameter_count());
179 int new_output_count = node->op()->ValueOutputCount() + delta; 251 int new_output_count = node->op()->ValueOutputCount() + delta;
180 NodeProperties::ChangeOp(node, common()->Start(new_output_count)); 252 NodeProperties::ChangeOp(node, common()->Start(new_output_count));
181 } 253 }
182 break; 254 break;
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 } 711 }
640 712
641 Node* Int64Lowering::GetReplacementHigh(Node* node) { 713 Node* Int64Lowering::GetReplacementHigh(Node* node) {
642 Node* result = replacements_[node->id()].high; 714 Node* result = replacements_[node->id()].high;
643 DCHECK(result); 715 DCHECK(result);
644 return result; 716 return result;
645 } 717 }
646 } // namespace compiler 718 } // namespace compiler
647 } // namespace internal 719 } // namespace internal
648 } // namespace v8 720 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698