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

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: 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 TruncateFloat64ToInt32Operator<TruncationMode::kRoundToZero> 281 TruncateFloat64ToInt32Operator<TruncationMode::kRoundToZero>
272 kTruncateFloat64ToInt32RoundToZero; 282 kTruncateFloat64ToInt32RoundToZero;
273 283
274 #define LOAD(Type) \ 284 #define LOAD(Type) \
275 struct Load##Type##Operator final : public Operator1<LoadRepresentation> { \ 285 struct Load##Type##Operator final : public Operator1<LoadRepresentation> { \
276 Load##Type##Operator() \ 286 Load##Type##Operator() \
277 : Operator1<LoadRepresentation>( \ 287 : Operator1<LoadRepresentation>( \
278 IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \ 288 IrOpcode::kLoad, Operator::kNoThrow | Operator::kNoWrite, \
279 "Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ 289 "Load", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \
280 }; \ 290 }; \
291 struct UnalignedLoad##Type##Operator final \
292 : public Operator1<UnalignedLoadRepresentation> { \
293 UnalignedLoad##Type##Operator() \
294 : Operator1<UnalignedLoadRepresentation>( \
295 IrOpcode::kUnalignedLoad, \
296 Operator::kNoThrow | Operator::kNoWrite, "UnalignedLoad", 2, 1, \
297 1, 1, 1, 0, MachineType::Type()) {} \
298 }; \
281 struct CheckedLoad##Type##Operator final \ 299 struct CheckedLoad##Type##Operator final \
282 : public Operator1<CheckedLoadRepresentation> { \ 300 : public Operator1<CheckedLoadRepresentation> { \
283 CheckedLoad##Type##Operator() \ 301 CheckedLoad##Type##Operator() \
284 : Operator1<CheckedLoadRepresentation>( \ 302 : Operator1<CheckedLoadRepresentation>( \
285 IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \ 303 IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \
286 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \ 304 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \
287 }; \ 305 }; \
288 Load##Type##Operator kLoad##Type; \ 306 Load##Type##Operator kLoad##Type; \
307 UnalignedLoad##Type##Operator kUnalignedLoad##Type; \
289 CheckedLoad##Type##Operator kCheckedLoad##Type; 308 CheckedLoad##Type##Operator kCheckedLoad##Type;
290 MACHINE_TYPE_LIST(LOAD) 309 MACHINE_TYPE_LIST(LOAD)
291 #undef LOAD 310 #undef LOAD
292 311
293 #define STACKSLOT(Type) \ 312 #define STACKSLOT(Type) \
294 struct StackSlot##Type##Operator final \ 313 struct StackSlot##Type##Operator final \
295 : public Operator1<MachineRepresentation> { \ 314 : public Operator1<MachineRepresentation> { \
296 StackSlot##Type##Operator() \ 315 StackSlot##Type##Operator() \
297 : Operator1<MachineRepresentation>( \ 316 : Operator1<MachineRepresentation>( \
298 IrOpcode::kStackSlot, Operator::kNoThrow, "StackSlot", 0, 0, 0, \ 317 IrOpcode::kStackSlot, Operator::kNoThrow, "StackSlot", 0, 0, 0, \
(...skipping 25 matching lines...) Expand all
324 struct Store##Type##PointerWriteBarrier##Operator final \ 343 struct Store##Type##PointerWriteBarrier##Operator final \
325 : public Store##Type##Operator { \ 344 : public Store##Type##Operator { \
326 Store##Type##PointerWriteBarrier##Operator() \ 345 Store##Type##PointerWriteBarrier##Operator() \
327 : Store##Type##Operator(kPointerWriteBarrier) {} \ 346 : Store##Type##Operator(kPointerWriteBarrier) {} \
328 }; \ 347 }; \
329 struct Store##Type##FullWriteBarrier##Operator final \ 348 struct Store##Type##FullWriteBarrier##Operator final \
330 : public Store##Type##Operator { \ 349 : public Store##Type##Operator { \
331 Store##Type##FullWriteBarrier##Operator() \ 350 Store##Type##FullWriteBarrier##Operator() \
332 : Store##Type##Operator(kFullWriteBarrier) {} \ 351 : Store##Type##Operator(kFullWriteBarrier) {} \
333 }; \ 352 }; \
353 struct UnalignedStore##Type##Operator final \
354 : public Operator1<UnalignedStoreRepresentation> { \
355 UnalignedStore##Type##Operator() \
356 : Operator1<UnalignedStoreRepresentation>( \
357 IrOpcode::kUnalignedStore, \
358 Operator::kNoRead | Operator::kNoThrow, "UnalignedStore", 3, 1, \
359 1, 0, 1, 0, MachineRepresentation::Type) {} \
360 }; \
334 struct CheckedStore##Type##Operator final \ 361 struct CheckedStore##Type##Operator final \
335 : public Operator1<CheckedStoreRepresentation> { \ 362 : public Operator1<CheckedStoreRepresentation> { \
336 CheckedStore##Type##Operator() \ 363 CheckedStore##Type##Operator() \
337 : Operator1<CheckedStoreRepresentation>( \ 364 : Operator1<CheckedStoreRepresentation>( \
338 IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, \ 365 IrOpcode::kCheckedStore, Operator::kNoRead | Operator::kNoThrow, \
339 "CheckedStore", 4, 1, 1, 0, 1, 0, MachineRepresentation::Type) { \ 366 "CheckedStore", 4, 1, 1, 0, 1, 0, MachineRepresentation::Type) { \
340 } \ 367 } \
341 }; \ 368 }; \
342 Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \ 369 Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \
343 Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier; \ 370 Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier; \
344 Store##Type##PointerWriteBarrier##Operator \ 371 Store##Type##PointerWriteBarrier##Operator \
345 kStore##Type##PointerWriteBarrier; \ 372 kStore##Type##PointerWriteBarrier; \
346 Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \ 373 Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \
374 UnalignedStore##Type##Operator kUnalignedStore##Type; \
347 CheckedStore##Type##Operator kCheckedStore##Type; 375 CheckedStore##Type##Operator kCheckedStore##Type;
348 MACHINE_REPRESENTATION_LIST(STORE) 376 MACHINE_REPRESENTATION_LIST(STORE)
349 #undef STORE 377 #undef STORE
350 }; 378 };
351 379
352 380
353 static base::LazyInstance<MachineOperatorGlobalCache>::type kCache = 381 static base::LazyInstance<MachineOperatorGlobalCache>::type kCache =
354 LAZY_INSTANCE_INITIALIZER; 382 LAZY_INSTANCE_INITIALIZER;
355 383
356 384
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 MACHINE_REPRESENTATION_LIST(STORE) 459 MACHINE_REPRESENTATION_LIST(STORE)
432 #undef STORE 460 #undef STORE
433 case MachineRepresentation::kBit: 461 case MachineRepresentation::kBit:
434 case MachineRepresentation::kNone: 462 case MachineRepresentation::kNone:
435 break; 463 break;
436 } 464 }
437 UNREACHABLE(); 465 UNREACHABLE();
438 return nullptr; 466 return nullptr;
439 } 467 }
440 468
469 const Operator* MachineOperatorBuilder::UnalignedLoad(
470 UnalignedLoadRepresentation rep) {
471 #define LOAD(Type) \
472 if (rep == MachineType::Type()) { \
473 return &cache_.kUnalignedLoad##Type; \
474 }
475 MACHINE_TYPE_LIST(LOAD)
476 #undef LOAD
477 UNREACHABLE();
478 return nullptr;
479 }
480
481 const Operator* MachineOperatorBuilder::UnalignedStore(
482 UnalignedStoreRepresentation rep) {
483 switch (rep) {
484 #define STORE(kRep) \
485 case MachineRepresentation::kRep: \
486 return &cache_.kUnalignedStore##kRep;
487 MACHINE_REPRESENTATION_LIST(STORE)
488 #undef STORE
489 case MachineRepresentation::kBit:
490 case MachineRepresentation::kNone:
491 break;
492 }
493 UNREACHABLE();
494 return nullptr;
495 }
441 496
442 const Operator* MachineOperatorBuilder::CheckedLoad( 497 const Operator* MachineOperatorBuilder::CheckedLoad(
443 CheckedLoadRepresentation rep) { 498 CheckedLoadRepresentation rep) {
444 #define LOAD(Type) \ 499 #define LOAD(Type) \
445 if (rep == MachineType::Type()) { \ 500 if (rep == MachineType::Type()) { \
446 return &cache_.kCheckedLoad##Type; \ 501 return &cache_.kCheckedLoad##Type; \
447 } 502 }
448 MACHINE_TYPE_LIST(LOAD) 503 MACHINE_TYPE_LIST(LOAD)
449 #undef LOAD 504 #undef LOAD
450 UNREACHABLE(); 505 UNREACHABLE();
(...skipping 13 matching lines...) Expand all
464 case MachineRepresentation::kNone: 519 case MachineRepresentation::kNone:
465 break; 520 break;
466 } 521 }
467 UNREACHABLE(); 522 UNREACHABLE();
468 return nullptr; 523 return nullptr;
469 } 524 }
470 525
471 } // namespace compiler 526 } // namespace compiler
472 } // namespace internal 527 } // namespace internal
473 } // namespace v8 528 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698