| 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 #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/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/base/compiler-specific.h" |
| 9 #include "src/compiler/frame-states.h" | 10 #include "src/compiler/frame-states.h" |
| 10 #include "src/deoptimize-reason.h" | 11 #include "src/deoptimize-reason.h" |
| 12 #include "src/globals.h" |
| 11 #include "src/machine-type.h" | 13 #include "src/machine-type.h" |
| 12 #include "src/zone/zone-containers.h" | 14 #include "src/zone/zone-containers.h" |
| 13 | 15 |
| 14 namespace v8 { | 16 namespace v8 { |
| 15 namespace internal { | 17 namespace internal { |
| 16 namespace compiler { | 18 namespace compiler { |
| 17 | 19 |
| 18 // Forward declarations. | 20 // Forward declarations. |
| 19 class CallDescriptor; | 21 class CallDescriptor; |
| 20 struct CommonOperatorGlobalCache; | 22 struct CommonOperatorGlobalCache; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 32 return BranchHint::kFalse; | 34 return BranchHint::kFalse; |
| 33 case BranchHint::kFalse: | 35 case BranchHint::kFalse: |
| 34 return BranchHint::kTrue; | 36 return BranchHint::kTrue; |
| 35 } | 37 } |
| 36 UNREACHABLE(); | 38 UNREACHABLE(); |
| 37 return hint; | 39 return hint; |
| 38 } | 40 } |
| 39 | 41 |
| 40 inline size_t hash_value(BranchHint hint) { return static_cast<size_t>(hint); } | 42 inline size_t hash_value(BranchHint hint) { return static_cast<size_t>(hint); } |
| 41 | 43 |
| 42 std::ostream& operator<<(std::ostream&, BranchHint); | 44 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, BranchHint); |
| 43 | 45 |
| 44 BranchHint BranchHintOf(const Operator* const); | 46 V8_EXPORT_PRIVATE BranchHint BranchHintOf(const Operator* const); |
| 45 | 47 |
| 46 // Deoptimize reason for Deoptimize, DeoptimizeIf and DeoptimizeUnless. | 48 // Deoptimize reason for Deoptimize, DeoptimizeIf and DeoptimizeUnless. |
| 47 DeoptimizeReason DeoptimizeReasonOf(Operator const* const); | 49 DeoptimizeReason DeoptimizeReasonOf(Operator const* const); |
| 48 | 50 |
| 49 // Deoptimize bailout kind. | 51 // Deoptimize bailout kind. |
| 50 enum class DeoptimizeKind : uint8_t { kEager, kSoft }; | 52 enum class DeoptimizeKind : uint8_t { kEager, kSoft }; |
| 51 | 53 |
| 52 size_t hash_value(DeoptimizeKind kind); | 54 size_t hash_value(DeoptimizeKind kind); |
| 53 | 55 |
| 54 std::ostream& operator<<(std::ostream&, DeoptimizeKind); | 56 std::ostream& operator<<(std::ostream&, DeoptimizeKind); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 const BranchHint hint_; | 93 const BranchHint hint_; |
| 92 }; | 94 }; |
| 93 | 95 |
| 94 bool operator==(SelectParameters const&, SelectParameters const&); | 96 bool operator==(SelectParameters const&, SelectParameters const&); |
| 95 bool operator!=(SelectParameters const&, SelectParameters const&); | 97 bool operator!=(SelectParameters const&, SelectParameters const&); |
| 96 | 98 |
| 97 size_t hash_value(SelectParameters const& p); | 99 size_t hash_value(SelectParameters const& p); |
| 98 | 100 |
| 99 std::ostream& operator<<(std::ostream&, SelectParameters const& p); | 101 std::ostream& operator<<(std::ostream&, SelectParameters const& p); |
| 100 | 102 |
| 101 SelectParameters const& SelectParametersOf(const Operator* const); | 103 V8_EXPORT_PRIVATE SelectParameters const& SelectParametersOf( |
| 104 const Operator* const); |
| 102 | 105 |
| 103 CallDescriptor const* CallDescriptorOf(const Operator* const); | 106 V8_EXPORT_PRIVATE CallDescriptor const* CallDescriptorOf(const Operator* const); |
| 104 | 107 |
| 105 size_t ProjectionIndexOf(const Operator* const); | 108 V8_EXPORT_PRIVATE size_t ProjectionIndexOf(const Operator* const); |
| 106 | 109 |
| 107 MachineRepresentation PhiRepresentationOf(const Operator* const); | 110 V8_EXPORT_PRIVATE MachineRepresentation |
| 108 | 111 PhiRepresentationOf(const Operator* const); |
| 109 | 112 |
| 110 // The {IrOpcode::kParameter} opcode represents an incoming parameter to the | 113 // The {IrOpcode::kParameter} opcode represents an incoming parameter to the |
| 111 // function. This class bundles the index and a debug name for such operators. | 114 // function. This class bundles the index and a debug name for such operators. |
| 112 class ParameterInfo final { | 115 class ParameterInfo final { |
| 113 public: | 116 public: |
| 114 ParameterInfo(int index, const char* debug_name) | 117 ParameterInfo(int index, const char* debug_name) |
| 115 : index_(index), debug_name_(debug_name) {} | 118 : index_(index), debug_name_(debug_name) {} |
| 116 | 119 |
| 117 int index() const { return index_; } | 120 int index() const { return index_; } |
| 118 const char* debug_name() const { return debug_name_; } | 121 const char* debug_name() const { return debug_name_; } |
| 119 | 122 |
| 120 private: | 123 private: |
| 121 int index_; | 124 int index_; |
| 122 const char* debug_name_; | 125 const char* debug_name_; |
| 123 }; | 126 }; |
| 124 | 127 |
| 125 std::ostream& operator<<(std::ostream&, ParameterInfo const&); | 128 std::ostream& operator<<(std::ostream&, ParameterInfo const&); |
| 126 | 129 |
| 127 int ParameterIndexOf(const Operator* const); | 130 V8_EXPORT_PRIVATE int ParameterIndexOf(const Operator* const); |
| 128 const ParameterInfo& ParameterInfoOf(const Operator* const); | 131 const ParameterInfo& ParameterInfoOf(const Operator* const); |
| 129 | 132 |
| 130 class RelocatablePtrConstantInfo final { | 133 class RelocatablePtrConstantInfo final { |
| 131 public: | 134 public: |
| 132 enum Type { kInt32, kInt64 }; | 135 enum Type { kInt32, kInt64 }; |
| 133 | 136 |
| 134 RelocatablePtrConstantInfo(int32_t value, RelocInfo::Mode rmode) | 137 RelocatablePtrConstantInfo(int32_t value, RelocInfo::Mode rmode) |
| 135 : value_(value), rmode_(rmode), type_(kInt32) {} | 138 : value_(value), rmode_(rmode), type_(kInt32) {} |
| 136 RelocatablePtrConstantInfo(int64_t value, RelocInfo::Mode rmode) | 139 RelocatablePtrConstantInfo(int64_t value, RelocInfo::Mode rmode) |
| 137 : value_(value), rmode_(rmode), type_(kInt64) {} | 140 : value_(value), rmode_(rmode), type_(kInt64) {} |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 176 |
| 174 int OsrValueIndexOf(Operator const*); | 177 int OsrValueIndexOf(Operator const*); |
| 175 | 178 |
| 176 enum class OsrGuardType { kUninitialized, kSignedSmall, kAny }; | 179 enum class OsrGuardType { kUninitialized, kSignedSmall, kAny }; |
| 177 size_t hash_value(OsrGuardType type); | 180 size_t hash_value(OsrGuardType type); |
| 178 std::ostream& operator<<(std::ostream&, OsrGuardType); | 181 std::ostream& operator<<(std::ostream&, OsrGuardType); |
| 179 OsrGuardType OsrGuardTypeOf(Operator const*); | 182 OsrGuardType OsrGuardTypeOf(Operator const*); |
| 180 | 183 |
| 181 // Interface for building common operators that can be used at any level of IR, | 184 // Interface for building common operators that can be used at any level of IR, |
| 182 // including JavaScript, mid-level, and low-level. | 185 // including JavaScript, mid-level, and low-level. |
| 183 class CommonOperatorBuilder final : public ZoneObject { | 186 class V8_EXPORT_PRIVATE CommonOperatorBuilder final |
| 187 : public NON_EXPORTED_BASE(ZoneObject) { |
| 184 public: | 188 public: |
| 185 explicit CommonOperatorBuilder(Zone* zone); | 189 explicit CommonOperatorBuilder(Zone* zone); |
| 186 | 190 |
| 187 const Operator* Dead(); | 191 const Operator* Dead(); |
| 188 const Operator* End(size_t control_input_count); | 192 const Operator* End(size_t control_input_count); |
| 189 const Operator* Branch(BranchHint = BranchHint::kNone); | 193 const Operator* Branch(BranchHint = BranchHint::kNone); |
| 190 const Operator* IfTrue(); | 194 const Operator* IfTrue(); |
| 191 const Operator* IfFalse(); | 195 const Operator* IfFalse(); |
| 192 const Operator* IfSuccess(); | 196 const Operator* IfSuccess(); |
| 193 const Operator* IfException(); | 197 const Operator* IfException(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 Zone* const zone_; | 267 Zone* const zone_; |
| 264 | 268 |
| 265 DISALLOW_COPY_AND_ASSIGN(CommonOperatorBuilder); | 269 DISALLOW_COPY_AND_ASSIGN(CommonOperatorBuilder); |
| 266 }; | 270 }; |
| 267 | 271 |
| 268 } // namespace compiler | 272 } // namespace compiler |
| 269 } // namespace internal | 273 } // namespace internal |
| 270 } // namespace v8 | 274 } // namespace v8 |
| 271 | 275 |
| 272 #endif // V8_COMPILER_COMMON_OPERATOR_H_ | 276 #endif // V8_COMPILER_COMMON_OPERATOR_H_ |
| OLD | NEW |