OLD | NEW |
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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 | 6 |
7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
8 #include "src/base/lazy-instance.h" | 8 #include "src/base/lazy-instance.h" |
9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 V(LoopExit, Operator::kKontrol, 0, 0, 2, 0, 0, 1) \ | 249 V(LoopExit, Operator::kKontrol, 0, 0, 2, 0, 0, 1) \ |
250 V(LoopExitValue, Operator::kPure, 1, 0, 1, 1, 0, 0) \ | 250 V(LoopExitValue, Operator::kPure, 1, 0, 1, 1, 0, 0) \ |
251 V(LoopExitEffect, Operator::kNoThrow, 0, 1, 1, 0, 1, 0) \ | 251 V(LoopExitEffect, Operator::kNoThrow, 0, 1, 1, 0, 1, 0) \ |
252 V(Checkpoint, Operator::kKontrol, 0, 1, 1, 0, 1, 0) \ | 252 V(Checkpoint, Operator::kKontrol, 0, 1, 1, 0, 1, 0) \ |
253 V(FinishRegion, Operator::kKontrol, 1, 1, 0, 1, 1, 0) \ | 253 V(FinishRegion, Operator::kKontrol, 1, 1, 0, 1, 1, 0) \ |
254 V(Retain, Operator::kKontrol, 1, 1, 0, 0, 1, 0) | 254 V(Retain, Operator::kKontrol, 1, 1, 0, 0, 1, 0) |
255 | 255 |
256 #define CACHED_RETURN_LIST(V) \ | 256 #define CACHED_RETURN_LIST(V) \ |
257 V(1) \ | 257 V(1) \ |
258 V(2) \ | 258 V(2) \ |
259 V(3) \ | 259 V(3) |
260 V(4) | 260 |
261 | 261 |
262 #define CACHED_END_LIST(V) \ | 262 #define CACHED_END_LIST(V) \ |
263 V(1) \ | 263 V(1) \ |
264 V(2) \ | 264 V(2) \ |
265 V(3) \ | 265 V(3) \ |
266 V(4) \ | 266 V(4) \ |
267 V(5) \ | 267 V(5) \ |
268 V(6) \ | 268 V(6) \ |
269 V(7) \ | 269 V(7) \ |
270 V(8) | 270 V(8) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 : Operator( // -- | 389 : Operator( // -- |
390 IrOpcode::kEnd, Operator::kKontrol, // opcode | 390 IrOpcode::kEnd, Operator::kKontrol, // opcode |
391 "End", // name | 391 "End", // name |
392 0, 0, kInputCount, 0, 0, 0) {} // counts | 392 0, 0, kInputCount, 0, 0, 0) {} // counts |
393 }; | 393 }; |
394 #define CACHED_END(input_count) \ | 394 #define CACHED_END(input_count) \ |
395 EndOperator<input_count> kEnd##input_count##Operator; | 395 EndOperator<input_count> kEnd##input_count##Operator; |
396 CACHED_END_LIST(CACHED_END) | 396 CACHED_END_LIST(CACHED_END) |
397 #undef CACHED_END | 397 #undef CACHED_END |
398 | 398 |
399 template <size_t kValueInputCount> | 399 template <size_t kInputCount> |
400 struct ReturnOperator final : public Operator { | 400 struct ReturnOperator final : public Operator { |
401 ReturnOperator() | 401 ReturnOperator() |
402 : Operator( // -- | 402 : Operator( // -- |
403 IrOpcode::kReturn, Operator::kNoThrow, // opcode | 403 IrOpcode::kReturn, Operator::kNoThrow, // opcode |
404 "Return", // name | 404 "Return", // name |
405 kValueInputCount + 1, 1, 1, 0, 0, 1) {} // counts | 405 kInputCount, 1, 1, 0, 0, 1) {} // counts |
406 }; | 406 }; |
407 #define CACHED_RETURN(value_input_count) \ | 407 #define CACHED_RETURN(input_count) \ |
408 ReturnOperator<value_input_count> kReturn##value_input_count##Operator; | 408 ReturnOperator<input_count> kReturn##input_count##Operator; |
409 CACHED_RETURN_LIST(CACHED_RETURN) | 409 CACHED_RETURN_LIST(CACHED_RETURN) |
410 #undef CACHED_RETURN | 410 #undef CACHED_RETURN |
411 | 411 |
412 template <BranchHint kBranchHint> | 412 template <BranchHint kBranchHint> |
413 struct BranchOperator final : public Operator1<BranchHint> { | 413 struct BranchOperator final : public Operator1<BranchHint> { |
414 BranchOperator() | 414 BranchOperator() |
415 : Operator1<BranchHint>( // -- | 415 : Operator1<BranchHint>( // -- |
416 IrOpcode::kBranch, Operator::kKontrol, // opcode | 416 IrOpcode::kBranch, Operator::kKontrol, // opcode |
417 "Branch", // name | 417 "Branch", // name |
418 1, 0, 1, 0, 0, 2, // counts | 418 1, 0, 1, 0, 0, 2, // counts |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 default: | 625 default: |
626 break; | 626 break; |
627 } | 627 } |
628 // Uncached. | 628 // Uncached. |
629 return new (zone()) Operator( //-- | 629 return new (zone()) Operator( //-- |
630 IrOpcode::kEnd, Operator::kKontrol, // opcode | 630 IrOpcode::kEnd, Operator::kKontrol, // opcode |
631 "End", // name | 631 "End", // name |
632 0, 0, control_input_count, 0, 0, 0); // counts | 632 0, 0, control_input_count, 0, 0, 0); // counts |
633 } | 633 } |
634 | 634 |
| 635 |
635 const Operator* CommonOperatorBuilder::Return(int value_input_count) { | 636 const Operator* CommonOperatorBuilder::Return(int value_input_count) { |
636 switch (value_input_count) { | 637 switch (value_input_count) { |
637 #define CACHED_RETURN(input_count) \ | 638 #define CACHED_RETURN(input_count) \ |
638 case input_count: \ | 639 case input_count: \ |
639 return &cache_.kReturn##input_count##Operator; | 640 return &cache_.kReturn##input_count##Operator; |
640 CACHED_RETURN_LIST(CACHED_RETURN) | 641 CACHED_RETURN_LIST(CACHED_RETURN) |
641 #undef CACHED_RETURN | 642 #undef CACHED_RETURN |
642 default: | 643 default: |
643 break; | 644 break; |
644 } | 645 } |
645 // Uncached. | 646 // Uncached. |
646 return new (zone()) Operator( //-- | 647 return new (zone()) Operator( //-- |
647 IrOpcode::kReturn, Operator::kNoThrow, // opcode | 648 IrOpcode::kReturn, Operator::kNoThrow, // opcode |
648 "Return", // name | 649 "Return", // name |
649 value_input_count + 1, 1, 1, 0, 0, 1); // counts | 650 value_input_count, 1, 1, 0, 0, 1); // counts |
650 } | 651 } |
651 | 652 |
652 | 653 |
653 const Operator* CommonOperatorBuilder::Branch(BranchHint hint) { | 654 const Operator* CommonOperatorBuilder::Branch(BranchHint hint) { |
654 switch (hint) { | 655 switch (hint) { |
655 case BranchHint::kNone: | 656 case BranchHint::kNone: |
656 return &cache_.kBranchNoneOperator; | 657 return &cache_.kBranchNoneOperator; |
657 case BranchHint::kTrue: | 658 case BranchHint::kTrue: |
658 return &cache_.kBranchTrueOperator; | 659 return &cache_.kBranchTrueOperator; |
659 case BranchHint::kFalse: | 660 case BranchHint::kFalse: |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 CommonOperatorBuilder::CreateFrameStateFunctionInfo( | 1116 CommonOperatorBuilder::CreateFrameStateFunctionInfo( |
1116 FrameStateType type, int parameter_count, int local_count, | 1117 FrameStateType type, int parameter_count, int local_count, |
1117 Handle<SharedFunctionInfo> shared_info) { | 1118 Handle<SharedFunctionInfo> shared_info) { |
1118 return new (zone()->New(sizeof(FrameStateFunctionInfo))) | 1119 return new (zone()->New(sizeof(FrameStateFunctionInfo))) |
1119 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); | 1120 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); |
1120 } | 1121 } |
1121 | 1122 |
1122 } // namespace compiler | 1123 } // namespace compiler |
1123 } // namespace internal | 1124 } // namespace internal |
1124 } // namespace v8 | 1125 } // namespace v8 |
OLD | NEW |