| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef V8_COMPILER_COMMON_OPERATOR_H_ | 5 #ifndef V8_COMPILER_COMMON_OPERATOR_H_ |
| 6 #define V8_COMPILER_COMMON_OPERATOR_H_ | 6 #define V8_COMPILER_COMMON_OPERATOR_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| 11 #include "src/compiler/linkage.h" | 11 #include "src/compiler/linkage.h" |
| 12 #include "src/compiler/opcodes.h" | 12 #include "src/compiler/opcodes.h" |
| 13 #include "src/compiler/operator.h" | 13 #include "src/compiler/operator.h" |
| 14 #include "src/unique.h" | 14 #include "src/unique.h" |
| 15 | 15 |
| 16 namespace v8 { | 16 namespace v8 { |
| 17 namespace internal { | 17 namespace internal { |
| 18 | 18 |
| 19 class OStream; | 19 class OStream; |
| 20 | 20 |
| 21 namespace compiler { | 21 namespace compiler { |
| 22 | 22 |
| 23 class ControlOperator : public Operator1<int> { | 23 class ControlOperator FINAL : public Operator1<int> { |
| 24 public: | 24 public: |
| 25 ControlOperator(IrOpcode::Value opcode, uint16_t properties, int inputs, | 25 ControlOperator(IrOpcode::Value opcode, Properties properties, int inputs, |
| 26 int outputs, int controls, const char* mnemonic) | 26 int outputs, int controls, const char* mnemonic) |
| 27 : Operator1<int>(opcode, properties, inputs, outputs, mnemonic, | 27 : Operator1<int>(opcode, properties, inputs, outputs, mnemonic, |
| 28 controls) {} | 28 controls) {} |
| 29 | 29 |
| 30 virtual OStream& PrintParameter(OStream& os) const { return os; } // NOLINT | 30 virtual OStream& PrintParameter(OStream& os) const OVERRIDE { // NOLINT |
| 31 return os; |
| 32 } |
| 31 int ControlInputCount() const { return parameter(); } | 33 int ControlInputCount() const { return parameter(); } |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 class CallOperator : public Operator1<CallDescriptor*> { | 36 class CallOperator FINAL : public Operator1<CallDescriptor*> { |
| 35 public: | 37 public: |
| 36 CallOperator(CallDescriptor* descriptor, const char* mnemonic) | 38 CallOperator(CallDescriptor* descriptor, const char* mnemonic) |
| 37 : Operator1<CallDescriptor*>( | 39 : Operator1<CallDescriptor*>( |
| 38 IrOpcode::kCall, descriptor->properties(), | 40 IrOpcode::kCall, descriptor->properties(), |
| 39 descriptor->InputCount() + descriptor->FrameStateCount(), | 41 descriptor->InputCount() + descriptor->FrameStateCount(), |
| 40 descriptor->ReturnCount(), mnemonic, descriptor) {} | 42 descriptor->ReturnCount(), mnemonic, descriptor) {} |
| 41 | 43 |
| 42 virtual OStream& PrintParameter(OStream& os) const { // NOLINT | 44 virtual OStream& PrintParameter(OStream& os) const OVERRIDE { // NOLINT |
| 43 return os << "[" << *parameter() << "]"; | 45 return os << "[" << *parameter() << "]"; |
| 44 } | 46 } |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 // Flag that describes how to combine the current environment with | 49 // Flag that describes how to combine the current environment with |
| 48 // the output of a node to obtain a framestate for lazy bailout. | 50 // the output of a node to obtain a framestate for lazy bailout. |
| 49 enum OutputFrameStateCombine { | 51 enum OutputFrameStateCombine { |
| 50 kPushOutput, // Push the output on the expression stack. | 52 kPushOutput, // Push the output on the expression stack. |
| 51 kIgnoreOutput // Use the frame state as-is. | 53 kIgnoreOutput // Use the frame state as-is. |
| 52 }; | 54 }; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 outputs, 0, "Start"); | 86 outputs, 0, "Start"); |
| 85 } | 87 } |
| 86 Operator* Dead() { CONTROL_OP(Dead, 0, 0); } | 88 Operator* Dead() { CONTROL_OP(Dead, 0, 0); } |
| 87 Operator* End() { CONTROL_OP(End, 0, 1); } | 89 Operator* End() { CONTROL_OP(End, 0, 1); } |
| 88 Operator* Branch() { CONTROL_OP(Branch, 1, 1); } | 90 Operator* Branch() { CONTROL_OP(Branch, 1, 1); } |
| 89 Operator* IfTrue() { CONTROL_OP(IfTrue, 0, 1); } | 91 Operator* IfTrue() { CONTROL_OP(IfTrue, 0, 1); } |
| 90 Operator* IfFalse() { CONTROL_OP(IfFalse, 0, 1); } | 92 Operator* IfFalse() { CONTROL_OP(IfFalse, 0, 1); } |
| 91 Operator* Throw() { CONTROL_OP(Throw, 1, 1); } | 93 Operator* Throw() { CONTROL_OP(Throw, 1, 1); } |
| 92 | 94 |
| 93 Operator* Return() { | 95 Operator* Return() { |
| 94 return new (zone_) ControlOperator(IrOpcode::kReturn, 0, 1, 0, 1, "Return"); | 96 return new (zone_) ControlOperator( |
| 97 IrOpcode::kReturn, Operator::kNoProperties, 1, 0, 1, "Return"); |
| 95 } | 98 } |
| 96 | 99 |
| 97 Operator* Merge(int controls) { | 100 Operator* Merge(int controls) { |
| 98 return new (zone_) ControlOperator(IrOpcode::kMerge, Operator::kFoldable, 0, | 101 return new (zone_) ControlOperator(IrOpcode::kMerge, Operator::kFoldable, 0, |
| 99 0, controls, "Merge"); | 102 0, controls, "Merge"); |
| 100 } | 103 } |
| 101 | 104 |
| 102 Operator* Loop(int controls) { | 105 Operator* Loop(int controls) { |
| 103 return new (zone_) ControlOperator(IrOpcode::kLoop, Operator::kFoldable, 0, | 106 return new (zone_) ControlOperator(IrOpcode::kLoop, Operator::kFoldable, 0, |
| 104 0, controls, "Loop"); | 107 0, controls, "Loop"); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 309 |
| 307 template <typename T> | 310 template <typename T> |
| 308 inline T ValueOf(Operator* op) { | 311 inline T ValueOf(Operator* op) { |
| 309 return CommonOperatorTraits<T>::ValueOf(op); | 312 return CommonOperatorTraits<T>::ValueOf(op); |
| 310 } | 313 } |
| 311 } | 314 } |
| 312 } | 315 } |
| 313 } // namespace v8::internal::compiler | 316 } // namespace v8::internal::compiler |
| 314 | 317 |
| 315 #endif // V8_COMPILER_COMMON_OPERATOR_H_ | 318 #endif // V8_COMPILER_COMMON_OPERATOR_H_ |
| OLD | NEW |