| 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_LINKAGE_H_ | 5 #ifndef V8_COMPILER_LINKAGE_H_ |
| 6 #define V8_COMPILER_LINKAGE_H_ | 6 #define V8_COMPILER_LINKAGE_H_ |
| 7 | 7 |
| 8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compiler/frame.h" | 10 #include "src/compiler/frame.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 kNoFlags = 0u, | 47 kNoFlags = 0u, |
| 48 kNeedsFrameState = 1u << 0, | 48 kNeedsFrameState = 1u << 0, |
| 49 kPatchableCallSite = 1u << 1, | 49 kPatchableCallSite = 1u << 1, |
| 50 kNeedsNopAfterCall = 1u << 2, | 50 kNeedsNopAfterCall = 1u << 2, |
| 51 kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall | 51 kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall |
| 52 }; | 52 }; |
| 53 typedef base::Flags<Flag> Flags; | 53 typedef base::Flags<Flag> Flags; |
| 54 | 54 |
| 55 CallDescriptor(Kind kind, int8_t return_count, int16_t parameter_count, | 55 CallDescriptor(Kind kind, int8_t return_count, int16_t parameter_count, |
| 56 int16_t input_count, LinkageLocation* locations, | 56 int16_t input_count, LinkageLocation* locations, |
| 57 Operator::Property properties, RegList callee_saved_registers, | 57 Operator::Properties properties, |
| 58 Flags flags, const char* debug_name = "") | 58 RegList callee_saved_registers, Flags flags, |
| 59 const char* debug_name = "") |
| 59 : kind_(kind), | 60 : kind_(kind), |
| 60 return_count_(return_count), | 61 return_count_(return_count), |
| 61 parameter_count_(parameter_count), | 62 parameter_count_(parameter_count), |
| 62 input_count_(input_count), | 63 input_count_(input_count), |
| 63 locations_(locations), | 64 locations_(locations), |
| 64 properties_(properties), | 65 properties_(properties), |
| 65 callee_saved_registers_(callee_saved_registers), | 66 callee_saved_registers_(callee_saved_registers), |
| 66 flags_(flags), | 67 flags_(flags), |
| 67 debug_name_(debug_name) {} | 68 debug_name_(debug_name) {} |
| 68 // Returns the kind of this call. | 69 // Returns the kind of this call. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 90 DCHECK(index < return_count_); | 91 DCHECK(index < return_count_); |
| 91 return locations_[0 + index]; // return locations start at 0. | 92 return locations_[0 + index]; // return locations start at 0. |
| 92 } | 93 } |
| 93 | 94 |
| 94 LinkageLocation GetInputLocation(int index) { | 95 LinkageLocation GetInputLocation(int index) { |
| 95 DCHECK(index < input_count_ + 1); // input_count + 1 is the context. | 96 DCHECK(index < input_count_ + 1); // input_count + 1 is the context. |
| 96 return locations_[return_count_ + index]; // inputs start after returns. | 97 return locations_[return_count_ + index]; // inputs start after returns. |
| 97 } | 98 } |
| 98 | 99 |
| 99 // Operator properties describe how this call can be optimized, if at all. | 100 // Operator properties describe how this call can be optimized, if at all. |
| 100 Operator::Property properties() const { return properties_; } | 101 Operator::Properties properties() const { return properties_; } |
| 101 | 102 |
| 102 // Get the callee-saved registers, if any, across this call. | 103 // Get the callee-saved registers, if any, across this call. |
| 103 RegList CalleeSavedRegisters() { return callee_saved_registers_; } | 104 RegList CalleeSavedRegisters() { return callee_saved_registers_; } |
| 104 | 105 |
| 105 const char* debug_name() const { return debug_name_; } | 106 const char* debug_name() const { return debug_name_; } |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 friend class Linkage; | 109 friend class Linkage; |
| 109 | 110 |
| 110 Kind kind_; | 111 Kind kind_; |
| 111 int8_t return_count_; | 112 int8_t return_count_; |
| 112 int16_t parameter_count_; | 113 int16_t parameter_count_; |
| 113 int16_t input_count_; | 114 int16_t input_count_; |
| 114 LinkageLocation* locations_; | 115 LinkageLocation* locations_; |
| 115 Operator::Property properties_; | 116 Operator::Properties properties_; |
| 116 RegList callee_saved_registers_; | 117 RegList callee_saved_registers_; |
| 117 Flags flags_; | 118 Flags flags_; |
| 118 const char* debug_name_; | 119 const char* debug_name_; |
| 119 }; | 120 }; |
| 120 | 121 |
| 121 DEFINE_OPERATORS_FOR_FLAGS(CallDescriptor::Flags) | 122 DEFINE_OPERATORS_FOR_FLAGS(CallDescriptor::Flags) |
| 122 | 123 |
| 123 OStream& operator<<(OStream& os, const CallDescriptor& d); | 124 OStream& operator<<(OStream& os, const CallDescriptor& d); |
| 124 OStream& operator<<(OStream& os, const CallDescriptor::Kind& k); | 125 OStream& operator<<(OStream& os, const CallDescriptor::Kind& k); |
| 125 | 126 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 142 explicit Linkage(CompilationInfo* info, CallDescriptor* incoming) | 143 explicit Linkage(CompilationInfo* info, CallDescriptor* incoming) |
| 143 : info_(info), incoming_(incoming) {} | 144 : info_(info), incoming_(incoming) {} |
| 144 | 145 |
| 145 // The call descriptor for this compilation unit describes the locations | 146 // The call descriptor for this compilation unit describes the locations |
| 146 // of incoming parameters and the outgoing return value(s). | 147 // of incoming parameters and the outgoing return value(s). |
| 147 CallDescriptor* GetIncomingDescriptor() { return incoming_; } | 148 CallDescriptor* GetIncomingDescriptor() { return incoming_; } |
| 148 CallDescriptor* GetJSCallDescriptor(int parameter_count); | 149 CallDescriptor* GetJSCallDescriptor(int parameter_count); |
| 149 static CallDescriptor* GetJSCallDescriptor(int parameter_count, Zone* zone); | 150 static CallDescriptor* GetJSCallDescriptor(int parameter_count, Zone* zone); |
| 150 CallDescriptor* GetRuntimeCallDescriptor(Runtime::FunctionId function, | 151 CallDescriptor* GetRuntimeCallDescriptor(Runtime::FunctionId function, |
| 151 int parameter_count, | 152 int parameter_count, |
| 152 Operator::Property properties); | 153 Operator::Properties properties); |
| 153 static CallDescriptor* GetRuntimeCallDescriptor(Runtime::FunctionId function, | 154 static CallDescriptor* GetRuntimeCallDescriptor( |
| 154 int parameter_count, | 155 Runtime::FunctionId function, int parameter_count, |
| 155 Operator::Property properties, | 156 Operator::Properties properties, Zone* zone); |
| 156 Zone* zone); | |
| 157 | 157 |
| 158 CallDescriptor* GetStubCallDescriptor( | 158 CallDescriptor* GetStubCallDescriptor( |
| 159 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count = 0, | 159 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count = 0, |
| 160 CallDescriptor::Flags flags = CallDescriptor::kNoFlags); | 160 CallDescriptor::Flags flags = CallDescriptor::kNoFlags); |
| 161 static CallDescriptor* GetStubCallDescriptor( | 161 static CallDescriptor* GetStubCallDescriptor( |
| 162 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count, | 162 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count, |
| 163 CallDescriptor::Flags flags, Zone* zone); | 163 CallDescriptor::Flags flags, Zone* zone); |
| 164 | 164 |
| 165 // Creates a call descriptor for simplified C calls that is appropriate | 165 // Creates a call descriptor for simplified C calls that is appropriate |
| 166 // for the host platform. This simplified calling convention only supports | 166 // for the host platform. This simplified calling convention only supports |
| (...skipping 27 matching lines...) Expand all Loading... |
| 194 private: | 194 private: |
| 195 CompilationInfo* info_; | 195 CompilationInfo* info_; |
| 196 CallDescriptor* incoming_; | 196 CallDescriptor* incoming_; |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 } // namespace compiler | 199 } // namespace compiler |
| 200 } // namespace internal | 200 } // namespace internal |
| 201 } // namespace v8 | 201 } // namespace v8 |
| 202 | 202 |
| 203 #endif // V8_COMPILER_LINKAGE_H_ | 203 #endif // V8_COMPILER_LINKAGE_H_ |
| OLD | NEW |