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

Side by Side Diff: src/compiler/x64/instruction-selector-x64.cc

Issue 784153006: [x86] Disable invalid checked load/store optimization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | test/mjsunit/compiler/regress-lena.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 case kRepFloat32: 223 case kRepFloat32:
224 opcode = kCheckedLoadFloat32; 224 opcode = kCheckedLoadFloat32;
225 break; 225 break;
226 case kRepFloat64: 226 case kRepFloat64:
227 opcode = kCheckedLoadFloat64; 227 opcode = kCheckedLoadFloat64;
228 break; 228 break;
229 default: 229 default:
230 UNREACHABLE(); 230 UNREACHABLE();
231 return; 231 return;
232 } 232 }
233 if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) {
234 Int32Matcher mlength(length);
235 Int32BinopMatcher moffset(offset);
236 if (mlength.HasValue() && moffset.right().HasValue() &&
237 mlength.Value() > moffset.right().Value()) {
238 InstructionOperand* offset_operand = g.UseRegister(moffset.left().node());
239 InstructionOperand* length_operand =
240 g.TempImmediate(mlength.Value() - moffset.right().Value());
241 Emit(opcode | AddressingModeField::encode(kMode_MR1I),
242 g.DefineAsRegister(node), offset_operand, length_operand,
243 g.UseRegister(buffer), offset_operand,
244 g.UseImmediate(moffset.right().node()));
245 return;
246 }
247 }
248 InstructionOperand* offset_operand = g.UseRegister(offset); 233 InstructionOperand* offset_operand = g.UseRegister(offset);
249 InstructionOperand* length_operand = 234 InstructionOperand* length_operand =
250 g.CanBeImmediate(length) ? g.UseImmediate(length) : g.UseRegister(length); 235 g.CanBeImmediate(length) ? g.UseImmediate(length) : g.UseRegister(length);
251 Emit(opcode | AddressingModeField::encode(kMode_MR1), 236 Emit(opcode | AddressingModeField::encode(kMode_MR1),
252 g.DefineAsRegister(node), offset_operand, length_operand, 237 g.DefineAsRegister(node), offset_operand, length_operand,
253 g.UseRegister(buffer), offset_operand); 238 g.UseRegister(buffer), offset_operand);
254 } 239 }
255 240
256 241
257 void InstructionSelector::VisitCheckedStore(Node* node) { 242 void InstructionSelector::VisitCheckedStore(Node* node) {
(...skipping 19 matching lines...) Expand all
277 break; 262 break;
278 case kRepFloat64: 263 case kRepFloat64:
279 opcode = kCheckedStoreFloat64; 264 opcode = kCheckedStoreFloat64;
280 break; 265 break;
281 default: 266 default:
282 UNREACHABLE(); 267 UNREACHABLE();
283 return; 268 return;
284 } 269 }
285 InstructionOperand* value_operand = 270 InstructionOperand* value_operand =
286 g.CanBeImmediate(value) ? g.UseImmediate(value) : g.UseRegister(value); 271 g.CanBeImmediate(value) ? g.UseImmediate(value) : g.UseRegister(value);
287 if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) {
288 Int32Matcher mlength(length);
289 Int32BinopMatcher moffset(offset);
290 if (mlength.HasValue() && moffset.right().HasValue() &&
291 mlength.Value() > moffset.right().Value()) {
292 InstructionOperand* offset_operand = g.UseRegister(moffset.left().node());
293 InstructionOperand* length_operand =
294 g.TempImmediate(mlength.Value() - moffset.right().Value());
295 Emit(opcode | AddressingModeField::encode(kMode_MR1I), nullptr,
296 offset_operand, length_operand, value_operand, g.UseRegister(buffer),
297 offset_operand, g.UseImmediate(moffset.right().node()));
298 return;
299 }
300 }
301 InstructionOperand* offset_operand = g.UseRegister(offset); 272 InstructionOperand* offset_operand = g.UseRegister(offset);
302 InstructionOperand* length_operand = 273 InstructionOperand* length_operand =
303 g.CanBeImmediate(length) ? g.UseImmediate(length) : g.UseRegister(length); 274 g.CanBeImmediate(length) ? g.UseImmediate(length) : g.UseRegister(length);
304 Emit(opcode | AddressingModeField::encode(kMode_MR1), nullptr, offset_operand, 275 Emit(opcode | AddressingModeField::encode(kMode_MR1), nullptr, offset_operand,
305 length_operand, value_operand, g.UseRegister(buffer), offset_operand); 276 length_operand, value_operand, g.UseRegister(buffer), offset_operand);
306 } 277 }
307 278
308 279
309 // Shared routine for multiple binary operations. 280 // Shared routine for multiple binary operations.
310 static void VisitBinop(InstructionSelector* selector, Node* node, 281 static void VisitBinop(InstructionSelector* selector, Node* node,
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 MachineOperatorBuilder::kFloat64Ceil | 1285 MachineOperatorBuilder::kFloat64Ceil |
1315 MachineOperatorBuilder::kFloat64RoundTruncate | 1286 MachineOperatorBuilder::kFloat64RoundTruncate |
1316 MachineOperatorBuilder::kWord32ShiftIsSafe; 1287 MachineOperatorBuilder::kWord32ShiftIsSafe;
1317 } 1288 }
1318 return MachineOperatorBuilder::kNoFlags; 1289 return MachineOperatorBuilder::kNoFlags;
1319 } 1290 }
1320 1291
1321 } // namespace compiler 1292 } // namespace compiler
1322 } // namespace internal 1293 } // namespace internal
1323 } // namespace v8 1294 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ia32/instruction-selector-ia32.cc ('k') | test/mjsunit/compiler/regress-lena.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698