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

Side by Side Diff: src/compiler/machine-operator.cc

Issue 1645653002: [turbofan] Add the StackSlot operator to turbofan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Explicitly state the type of test values. Created 4 years, 10 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
« no previous file with comments | « src/compiler/machine-operator.h ('k') | src/compiler/mips/code-generator-mips.cc » ('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/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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 DCHECK_EQ(IrOpcode::kCheckedLoad, op->opcode()); 84 DCHECK_EQ(IrOpcode::kCheckedLoad, op->opcode());
85 return OpParameter<CheckedLoadRepresentation>(op); 85 return OpParameter<CheckedLoadRepresentation>(op);
86 } 86 }
87 87
88 88
89 CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) { 89 CheckedStoreRepresentation CheckedStoreRepresentationOf(Operator const* op) {
90 DCHECK_EQ(IrOpcode::kCheckedStore, op->opcode()); 90 DCHECK_EQ(IrOpcode::kCheckedStore, op->opcode());
91 return OpParameter<CheckedStoreRepresentation>(op); 91 return OpParameter<CheckedStoreRepresentation>(op);
92 } 92 }
93 93
94 MachineRepresentation StackSlotRepresentationOf(Operator const* op) {
95 DCHECK_EQ(IrOpcode::kStackSlot, op->opcode());
96 return OpParameter<MachineRepresentation>(op);
97 }
94 98
95 #define PURE_OP_LIST(V) \ 99 #define PURE_OP_LIST(V) \
96 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 100 V(Word32And, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
97 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 101 V(Word32Or, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
98 V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \ 102 V(Word32Xor, Operator::kAssociative | Operator::kCommutative, 2, 0, 1) \
99 V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \ 103 V(Word32Shl, Operator::kNoProperties, 2, 0, 1) \
100 V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \ 104 V(Word32Shr, Operator::kNoProperties, 2, 0, 1) \
101 V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \ 105 V(Word32Sar, Operator::kNoProperties, 2, 0, 1) \
102 V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \ 106 V(Word32Ror, Operator::kNoProperties, 2, 0, 1) \
103 V(Word32Equal, Operator::kCommutative, 2, 0, 1) \ 107 V(Word32Equal, Operator::kCommutative, 2, 0, 1) \
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 CheckedLoad##Type##Operator() \ 278 CheckedLoad##Type##Operator() \
275 : Operator1<CheckedLoadRepresentation>( \ 279 : Operator1<CheckedLoadRepresentation>( \
276 IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \ 280 IrOpcode::kCheckedLoad, Operator::kNoThrow | Operator::kNoWrite, \
277 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \ 281 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \
278 }; \ 282 }; \
279 Load##Type##Operator kLoad##Type; \ 283 Load##Type##Operator kLoad##Type; \
280 CheckedLoad##Type##Operator kCheckedLoad##Type; 284 CheckedLoad##Type##Operator kCheckedLoad##Type;
281 MACHINE_TYPE_LIST(LOAD) 285 MACHINE_TYPE_LIST(LOAD)
282 #undef LOAD 286 #undef LOAD
283 287
288 #define STACKSLOT(Type) \
289 struct StackSlot##Type##Operator final \
290 : public Operator1<MachineRepresentation> { \
291 StackSlot##Type##Operator() \
292 : Operator1<MachineRepresentation>( \
293 IrOpcode::kStackSlot, Operator::kNoThrow, "StackSlot", 0, 0, 0, \
294 1, 0, 0, MachineType::Type().representation()) {} \
295 }; \
296 StackSlot##Type##Operator kStackSlot##Type;
297 MACHINE_TYPE_LIST(STACKSLOT)
298 #undef STACKSLOT
299
284 #define STORE(Type) \ 300 #define STORE(Type) \
285 struct Store##Type##Operator : public Operator1<StoreRepresentation> { \ 301 struct Store##Type##Operator : public Operator1<StoreRepresentation> { \
286 explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \ 302 explicit Store##Type##Operator(WriteBarrierKind write_barrier_kind) \
287 : Operator1<StoreRepresentation>( \ 303 : Operator1<StoreRepresentation>( \
288 IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \ 304 IrOpcode::kStore, Operator::kNoRead | Operator::kNoThrow, \
289 "Store", 3, 1, 1, 0, 1, 0, \ 305 "Store", 3, 1, 1, 0, 1, 0, \
290 StoreRepresentation(MachineRepresentation::Type, \ 306 StoreRepresentation(MachineRepresentation::Type, \
291 write_barrier_kind)) {} \ 307 write_barrier_kind)) {} \
292 }; \ 308 }; \
293 struct Store##Type##NoWriteBarrier##Operator final \ 309 struct Store##Type##NoWriteBarrier##Operator final \
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 #define LOAD(Type) \ 390 #define LOAD(Type) \
375 if (rep == MachineType::Type()) { \ 391 if (rep == MachineType::Type()) { \
376 return &cache_.kLoad##Type; \ 392 return &cache_.kLoad##Type; \
377 } 393 }
378 MACHINE_TYPE_LIST(LOAD) 394 MACHINE_TYPE_LIST(LOAD)
379 #undef LOAD 395 #undef LOAD
380 UNREACHABLE(); 396 UNREACHABLE();
381 return nullptr; 397 return nullptr;
382 } 398 }
383 399
400 const Operator* MachineOperatorBuilder::StackSlot(MachineRepresentation rep) {
401 #define STACKSLOT(Type) \
402 if (rep == MachineType::Type().representation()) { \
403 return &cache_.kStackSlot##Type; \
404 }
405 MACHINE_TYPE_LIST(STACKSLOT)
406 #undef STACKSLOT
407 UNREACHABLE();
408 return nullptr;
409 }
384 410
385 const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) { 411 const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) {
386 switch (store_rep.representation()) { 412 switch (store_rep.representation()) {
387 #define STORE(kRep) \ 413 #define STORE(kRep) \
388 case MachineRepresentation::kRep: \ 414 case MachineRepresentation::kRep: \
389 switch (store_rep.write_barrier_kind()) { \ 415 switch (store_rep.write_barrier_kind()) { \
390 case kNoWriteBarrier: \ 416 case kNoWriteBarrier: \
391 return &cache_.k##Store##kRep##NoWriteBarrier; \ 417 return &cache_.k##Store##kRep##NoWriteBarrier; \
392 case kMapWriteBarrier: \ 418 case kMapWriteBarrier: \
393 return &cache_.k##Store##kRep##MapWriteBarrier; \ 419 return &cache_.k##Store##kRep##MapWriteBarrier; \
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 case MachineRepresentation::kNone: 459 case MachineRepresentation::kNone:
434 break; 460 break;
435 } 461 }
436 UNREACHABLE(); 462 UNREACHABLE();
437 return nullptr; 463 return nullptr;
438 } 464 }
439 465
440 } // namespace compiler 466 } // namespace compiler
441 } // namespace internal 467 } // namespace internal
442 } // namespace v8 468 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/machine-operator.h ('k') | src/compiler/mips/code-generator-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698