| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| 106 size_t ProjectionIndexOf(const Operator* const op) { | 106 size_t ProjectionIndexOf(const Operator* const op) { |
| 107 DCHECK_EQ(IrOpcode::kProjection, op->opcode()); | 107 DCHECK_EQ(IrOpcode::kProjection, op->opcode()); |
| 108 return OpParameter<size_t>(op); | 108 return OpParameter<size_t>(op); |
| 109 } | 109 } |
| 110 | 110 |
| 111 | 111 |
| 112 #define CACHED_OP_LIST(V) \ | 112 #define CACHED_OP_LIST(V) \ |
| 113 V(Always, Operator::kPure, 0, 0, 0, 1, 0, 0) \ |
| 113 V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \ | 114 V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \ |
| 114 V(End, Operator::kFoldable, 0, 0, 1, 0, 0, 0) \ | 115 V(End, Operator::kFoldable, 0, 0, 1, 0, 0, 0) \ |
| 115 V(IfTrue, Operator::kFoldable, 0, 0, 1, 0, 0, 1) \ | 116 V(IfTrue, Operator::kFoldable, 0, 0, 1, 0, 0, 1) \ |
| 116 V(IfFalse, Operator::kFoldable, 0, 0, 1, 0, 0, 1) \ | 117 V(IfFalse, Operator::kFoldable, 0, 0, 1, 0, 0, 1) \ |
| 117 V(Throw, Operator::kFoldable, 1, 1, 1, 0, 0, 1) \ | 118 V(Throw, Operator::kFoldable, 1, 1, 1, 0, 0, 1) \ |
| 118 V(Return, Operator::kNoProperties, 1, 1, 1, 0, 0, 1) \ | 119 V(Return, Operator::kNoProperties, 1, 1, 1, 0, 0, 1) \ |
| 119 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ | 120 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ |
| 120 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) | 121 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) |
| 121 | 122 |
| 122 | 123 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 break; | 288 break; |
| 288 } | 289 } |
| 289 // Uncached. | 290 // Uncached. |
| 290 return new (zone()) Operator( // -- | 291 return new (zone()) Operator( // -- |
| 291 IrOpcode::kMerge, Operator::kFoldable, // opcode | 292 IrOpcode::kMerge, Operator::kFoldable, // opcode |
| 292 "Merge", // name | 293 "Merge", // name |
| 293 0, 0, control_input_count, 0, 0, 1); // counts | 294 0, 0, control_input_count, 0, 0, 1); // counts |
| 294 } | 295 } |
| 295 | 296 |
| 296 | 297 |
| 297 const Operator* CommonOperatorBuilder::Terminate(int effects) { | |
| 298 return new (zone()) Operator( // -- | |
| 299 IrOpcode::kTerminate, Operator::kPure, // opcode | |
| 300 "Terminate", // name | |
| 301 0, effects, 1, 0, 0, 1); // counts | |
| 302 } | |
| 303 | |
| 304 | |
| 305 const Operator* CommonOperatorBuilder::Parameter(int index) { | 298 const Operator* CommonOperatorBuilder::Parameter(int index) { |
| 306 switch (index) { | 299 switch (index) { |
| 307 #define CACHED_PARAMETER(index) \ | 300 #define CACHED_PARAMETER(index) \ |
| 308 case index: \ | 301 case index: \ |
| 309 return &cache_.kParameter##index##Operator; | 302 return &cache_.kParameter##index##Operator; |
| 310 CACHED_PARAMETER_LIST(CACHED_PARAMETER) | 303 CACHED_PARAMETER_LIST(CACHED_PARAMETER) |
| 311 #undef CACHED_PARAMETER | 304 #undef CACHED_PARAMETER |
| 312 default: | 305 default: |
| 313 break; | 306 break; |
| 314 } | 307 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 | 413 |
| 421 const Operator* CommonOperatorBuilder::EffectPhi(int arguments) { | 414 const Operator* CommonOperatorBuilder::EffectPhi(int arguments) { |
| 422 DCHECK(arguments > 0); // Disallow empty phis. | 415 DCHECK(arguments > 0); // Disallow empty phis. |
| 423 return new (zone()) Operator( // -- | 416 return new (zone()) Operator( // -- |
| 424 IrOpcode::kEffectPhi, Operator::kPure, // opcode | 417 IrOpcode::kEffectPhi, Operator::kPure, // opcode |
| 425 "EffectPhi", // name | 418 "EffectPhi", // name |
| 426 0, arguments, 1, 0, 1, 0); // counts | 419 0, arguments, 1, 0, 1, 0); // counts |
| 427 } | 420 } |
| 428 | 421 |
| 429 | 422 |
| 423 const Operator* CommonOperatorBuilder::EffectSet(int arguments) { |
| 424 DCHECK(arguments > 1); // Disallow empty/singleton sets. |
| 425 return new (zone()) Operator( // -- |
| 426 IrOpcode::kEffectSet, Operator::kPure, // opcode |
| 427 "EffectSet", // name |
| 428 0, arguments, 0, 0, 1, 0); // counts |
| 429 } |
| 430 |
| 431 |
| 430 const Operator* CommonOperatorBuilder::ValueEffect(int arguments) { | 432 const Operator* CommonOperatorBuilder::ValueEffect(int arguments) { |
| 431 DCHECK(arguments > 0); // Disallow empty value effects. | 433 DCHECK(arguments > 0); // Disallow empty value effects. |
| 432 return new (zone()) Operator( // -- | 434 return new (zone()) Operator( // -- |
| 433 IrOpcode::kValueEffect, Operator::kPure, // opcode | 435 IrOpcode::kValueEffect, Operator::kPure, // opcode |
| 434 "ValueEffect", // name | 436 "ValueEffect", // name |
| 435 arguments, 0, 0, 0, 1, 0); // counts | 437 arguments, 0, 0, 0, 1, 0); // counts |
| 436 } | 438 } |
| 437 | 439 |
| 438 | 440 |
| 439 const Operator* CommonOperatorBuilder::Finish(int arguments) { | 441 const Operator* CommonOperatorBuilder::Finish(int arguments) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } else { | 508 } else { |
| 507 UNREACHABLE(); | 509 UNREACHABLE(); |
| 508 return nullptr; | 510 return nullptr; |
| 509 } | 511 } |
| 510 } | 512 } |
| 511 | 513 |
| 512 | 514 |
| 513 } // namespace compiler | 515 } // namespace compiler |
| 514 } // namespace internal | 516 } // namespace internal |
| 515 } // namespace v8 | 517 } // namespace v8 |
| OLD | NEW |