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

Side by Side Diff: src/compiler/machine-operator.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/machine-operator.h" 5 #include "src/compiler/machine-operator.h"
6 6
7 #include "src/base/lazy-instance.h" 7 #include "src/base/lazy-instance.h"
8 #include "src/compiler/opcodes.h" 8 #include "src/compiler/opcodes.h"
9 #include "src/compiler/operator.h" 9 #include "src/compiler/operator.h"
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 DCHECK_EQ(IrOpcode::kLoad, op->opcode()); 72 DCHECK_EQ(IrOpcode::kLoad, op->opcode());
73 return OpParameter<LoadRepresentation>(op); 73 return OpParameter<LoadRepresentation>(op);
74 } 74 }
75 75
76 76
77 StoreRepresentation const& StoreRepresentationOf(Operator const* op) { 77 StoreRepresentation const& StoreRepresentationOf(Operator const* op) {
78 DCHECK_EQ(IrOpcode::kStore, op->opcode()); 78 DCHECK_EQ(IrOpcode::kStore, op->opcode());
79 return OpParameter<StoreRepresentation>(op); 79 return OpParameter<StoreRepresentation>(op);
80 } 80 }
81 81
82 UnalignedLoadRepresentation UnalignedLoadRepresentationOf(Operator const* op) {
83 DCHECK_EQ(IrOpcode::kUnalignedLoad, op->opcode());
84 return OpParameter<UnalignedLoadRepresentation>(op);
85 }
86
87 UnalignedStoreRepresentation const& UnalignedStoreRepresentationOf(
88 Operator const* op) {
89 DCHECK_EQ(IrOpcode::kUnalignedStore, op->opcode());
90 return OpParameter<UnalignedStoreRepresentation>(op);
91 }
82 92
83 CheckedLoadRepresentation CheckedLoadRepresentationOf(Operator const* op) { 93 CheckedLoadRepresentation CheckedLoadRepresentationOf(Operator const* op) {
84 DCHECK_EQ(IrOpcode::kCheckedLoad, op->opcode()); 94 DCHECK_EQ(IrOpcode::kCheckedLoad, op->opcode());
85 return OpParameter<CheckedLoadRepresentation>(op); 95 return OpParameter<CheckedLoadRepresentation>(op);
86 } 96 }
87 97
88 98
89 CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) { 99 CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) {
90 DCHECK_EQ(IrOpcode::kCheckedStore, op->opcode()); 100 DCHECK_EQ(IrOpcode::kCheckedStore, op->opcode());
91 return OpParameter<CheckedStoreRepresentation>(op); 101 return OpParameter<CheckedStoreRepresentation>(op);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 TruncateFloat64ToInt32Operator<TruncationMode::kRoundToZero> 285 TruncateFloat64ToInt32Operator<TruncationMode::kRoundToZero>
276 kTruncateFloat64ToInt32RoundToZero; 286 kTruncateFloat64ToInt32RoundToZero;
277 287
278 #define LOAD(Type) \ 288 #define LOAD(Type) \
279 struct Load##Type##Operator final : public Operator1<LoadRepresentation> { \ 289 struct Load##Type##Operator final : public Operator1<LoadRepresentation> { \
280 Load##Type##Operator() \ 290 Load##Type##Operator() \
281 : Operator1<LoadRepresentation>( \ 291 : Operator1<LoadRepresentation>( \
282 IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \ 292 IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \
283 "Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ 293 "Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
284 }; \ 294 }; \
295 struct UnalignedLoad##Type##Operator final \
296 : public Operator1<UnalignedLoadRepresentation> { \
297 UnalignedLoad##Type##Operator() \
298 : Operator1<UnalignedLoadRepresentation>( \
299 IrOpcode::kUnalignedLoad, \
300 Operator::kNoThrow | Operator::kNoWrite, "UnalignedLoad", 2, 1, \
301 1, 1, 1, 0, MachineType::Type()) {} \
302 }; \
285 struct CheckedLoad##Type##Operator final \ 303 struct CheckedLoad##Type##Operator final \
286 : public Operator1<CheckedLoadRepresentation> { \ 304 : public Operator1<CheckedLoadRepresentation> { \
287 CheckedLoad##Type##Operator() \ 305 CheckedLoad##Type##Operator() \
288 : Operator1<CheckedLoadRepresentation>( \ 306 : Operator1<CheckedLoadRepresentation>( \
289 IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \ 307 IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \
290 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \ 308 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \
291 }; \ 309 }; \
292 Load##Type##Operator kLoad##Type; \ 310 Load##Type##Operator kLoad##Type; \
311 UnalignedLoad##Type##Operator kUnalignedLoad##Type; \
293 CheckedLoad##Type##Operator kCheckedLoad##Type; 312 CheckedLoad##Type##Operator kCheckedLoad##Type;
294 MACHINE_TYPE_LIST(LOAD) 313 MACHINE_TYPE_LIST(LOAD)
295 #undef LOAD 314 #undef LOAD
296 315
297 #define STACKSLOT(Type) \ 316 #define STACKSLOT(Type) \
298 struct StackSlot##Type##Operator final \ 317 struct StackSlot##Type##Operator final \
299 : public Operator1<MachineRepresentation> { \ 318 : public Operator1<MachineRepresentation> { \
300 StackSlot##Type##Operator() \ 319 StackSlot##Type##Operator() \
301 : Operator1<MachineRepresentation>( \ 320 : Operator1<MachineRepresentation>( \
302 IrOpcode::kStackSlot, Operator::kNoThrow, "StackSlot", 0, 0, 0, \ 321 IrOpcode::kStackSlot, Operator::kNoThrow, "StackSlot", 0, 0, 0, \
(...skipping 25 matching lines...) Expand all
328 struct Store##Type##PointerWriteBarrier##Operator final \ 347 struct Store##Type##PointerWriteBarrier##Operator final \
329 : public Store##Type##Operator { \ 348 : public Store##Type##Operator { \
330 Store##Type##PointerWriteBarrier##Operator() \ 349 Store##Type##PointerWriteBarrier##Operator() \
331 : Store##Type##Operator(kPointerWriteBarrier) {} \ 350 : Store##Type##Operator(kPointerWriteBarrier) {} \
332 }; \ 351 }; \
333 struct Store##Type##FullWriteBarrier##Operator final \ 352 struct Store##Type##FullWriteBarrier##Operator final \
334 : public Store##Type##Operator { \ 353 : public Store##Type##Operator { \
335 Store##Type##FullWriteBarrier##Operator() \ 354 Store##Type##FullWriteBarrier##Operator() \
336 : Store##Type##Operator(kFullWriteBarrier) {} \ 355 : Store##Type##Operator(kFullWriteBarrier) {} \
337 }; \ 356 }; \
357 struct UnalignedStore##Type##Operator final \
358 : public Operator1<UnalignedStoreRepresentation> { \
359 UnalignedStore##Type##Operator() \
360 : Operator1<UnalignedStoreRepresentation>( \
361 IrOpcode::kUnalignedStore, \
362 Operator::kNoRead | Operator::kNoThrow, "UnalignedStore", 3, 1, \
363 1, 0, 1, 0, MachineRepresentation::Type) {} \
364 }; \
338 struct CheckedStore##Type##Operator final \ 365 struct CheckedStore##Type##Operator final \
339 : public Operator1<CheckedStoreRepresentation> { \ 366 : public Operator1<CheckedStoreRepresentation> { \
340 CheckedStore##Type##Operator() \ 367 CheckedStore##Type##Operator() \
341 : Operator1<CheckedStoreRepresentation>( \ 368 : Operator1<CheckedStoreRepresentation>( \
342 IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, \ 369 IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, \
343 "CheckedStore", 4, 1, 1, 0, 1, 0, MachineRepresentation::Type) { \ 370 "CheckedStore", 4, 1, 1, 0, 1, 0, MachineRepresentation::Type) { \
344 } \ 371 } \
345 }; \ 372 }; \
346 Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \ 373 Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \
347 Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier; \ 374 Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier; \
348 Store##Type##PointerWriteBarrier##Operator \ 375 Store##Type##PointerWriteBarrier##Operator \
349 kStore##Type##PointerWriteBarrier; \ 376 kStore##Type##PointerWriteBarrier; \
350 Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \ 377 Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \
378 UnalignedStore##Type##Operator kUnalignedStore##Type; \
351 CheckedStore##Type##Operator kCheckedStore##Type; 379 CheckedStore##Type##Operator kCheckedStore##Type;
352 MACHINE_REPRESENTATION_LIST(STORE) 380 MACHINE_REPRESENTATION_LIST(STORE)
353 #undef STORE 381 #undef STORE
354 }; 382 };
355 383
356 384
357 static base::LazyInstance<MachineOperatorGlobalCache>::type kCache = 385 static base::LazyInstance<MachineOperatorGlobalCache>::type kCache =
358 LAZY_INSTANCE_INITIALIZER; 386 LAZY_INSTANCE_INITIALIZER;
359 387
360 388
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 MACHINE_REPRESENTATION_LIST(STORE) 463 MACHINE_REPRESENTATION_LIST(STORE)
436 #undef STORE 464 #undef STORE
437 case MachineRepresentation::kBit: 465 case MachineRepresentation::kBit:
438 case MachineRepresentation::kNone: 466 case MachineRepresentation::kNone:
439 break; 467 break;
440 } 468 }
441 UNREACHABLE(); 469 UNREACHABLE();
442 return nullptr; 470 return nullptr;
443 } 471 }
444 472
473 const OptionalOperator MachineOperatorBuilder::UnalignedLoad(
474 UnalignedLoadRepresentation rep) {
475 #define LOAD(Type) \
476 if (rep == MachineType::Type()) { \
477 return OptionalOperator( \
478 flags_ & kUnalignedLoad ? &cache_.kUnalignedLoad##Type : nullptr); \
479 }
480 MACHINE_TYPE_LIST(LOAD)
481 #undef LOAD
482 UNREACHABLE();
483 return OptionalOperator(nullptr);
484 }
485
486 const OptionalOperator MachineOperatorBuilder::UnalignedStore(
487 UnalignedStoreRepresentation rep) {
488 switch (rep) {
489 #define STORE(kRep) \
490 case MachineRepresentation::kRep: \
491 return OptionalOperator( \
492 flags_ & kUnalignedStore ? &cache_.kUnalignedStore##kRep : nullptr);
493 MACHINE_REPRESENTATION_LIST(STORE)
494 #undef STORE
495 case MachineRepresentation::kBit:
496 case MachineRepresentation::kNone:
497 break;
498 }
499 UNREACHABLE();
500 return OptionalOperator(nullptr);
501 }
445 502
446 const Operator* MachineOperatorBuilder::CheckedLoad( 503 const Operator* MachineOperatorBuilder::CheckedLoad(
447 CheckedLoadRepresentation rep) { 504 CheckedLoadRepresentation rep) {
448 #define LOAD(Type) \ 505 #define LOAD(Type) \
449 if (rep == MachineType::Type()) { \ 506 if (rep == MachineType::Type()) { \
450 return &cache_.kCheckedLoad##Type; \ 507 return &cache_.kCheckedLoad##Type; \
451 } 508 }
452 MACHINE_TYPE_LIST(LOAD) 509 MACHINE_TYPE_LIST(LOAD)
453 #undef LOAD 510 #undef LOAD
454 UNREACHABLE(); 511 UNREACHABLE();
(...skipping 26 matching lines...) Expand all
481 538
482 // On 32 bit platforms we need to get a reference to optional operators of 539 // On 32 bit platforms we need to get a reference to optional operators of
483 // 64-bit instructions for later Int64Lowering, even though 32 bit platforms 540 // 64-bit instructions for later Int64Lowering, even though 32 bit platforms
484 // don't support the original 64-bit instruction. 541 // don't support the original 64-bit instruction.
485 const Operator* MachineOperatorBuilder::Word64CtzPlaceholder() { 542 const Operator* MachineOperatorBuilder::Word64CtzPlaceholder() {
486 return &cache_.kWord64Ctz; 543 return &cache_.kWord64Ctz;
487 } 544 }
488 } // namespace compiler 545 } // namespace compiler
489 } // namespace internal 546 } // namespace internal
490 } // namespace v8 547 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698