| 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/compiler/frame.h" | 9 #include "src/compiler/frame.h" | 
| 10 #include "src/compiler/machine-type.h" | 10 #include "src/compiler/machine-type.h" | 
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 120     kNeedsNopAfterCall = 1u << 2, | 120     kNeedsNopAfterCall = 1u << 2, | 
| 121     kHasExceptionHandler = 1u << 3, | 121     kHasExceptionHandler = 1u << 3, | 
| 122     kHasLocalCatchHandler = 1u << 4, | 122     kHasLocalCatchHandler = 1u << 4, | 
| 123     kSupportsTailCalls = 1u << 5, | 123     kSupportsTailCalls = 1u << 5, | 
| 124     kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall | 124     kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall | 
| 125   }; | 125   }; | 
| 126   typedef base::Flags<Flag> Flags; | 126   typedef base::Flags<Flag> Flags; | 
| 127 | 127 | 
| 128   CallDescriptor(Kind kind, MachineType target_type, LinkageLocation target_loc, | 128   CallDescriptor(Kind kind, MachineType target_type, LinkageLocation target_loc, | 
| 129                  const MachineSignature* machine_sig, | 129                  const MachineSignature* machine_sig, | 
| 130                  LocationSignature* location_sig, size_t js_param_count, | 130                  LocationSignature* location_sig, size_t stack_param_count, | 
| 131                  Operator::Properties properties, | 131                  Operator::Properties properties, | 
| 132                  RegList callee_saved_registers, | 132                  RegList callee_saved_registers, | 
| 133                  RegList callee_saved_fp_registers, Flags flags, | 133                  RegList callee_saved_fp_registers, Flags flags, | 
| 134                  const char* debug_name = "") | 134                  const char* debug_name = "") | 
| 135       : kind_(kind), | 135       : kind_(kind), | 
| 136         target_type_(target_type), | 136         target_type_(target_type), | 
| 137         target_loc_(target_loc), | 137         target_loc_(target_loc), | 
| 138         machine_sig_(machine_sig), | 138         machine_sig_(machine_sig), | 
| 139         location_sig_(location_sig), | 139         location_sig_(location_sig), | 
| 140         js_param_count_(js_param_count), | 140         stack_param_count_(stack_param_count), | 
| 141         properties_(properties), | 141         properties_(properties), | 
| 142         callee_saved_registers_(callee_saved_registers), | 142         callee_saved_registers_(callee_saved_registers), | 
| 143         callee_saved_fp_registers_(callee_saved_fp_registers), | 143         callee_saved_fp_registers_(callee_saved_fp_registers), | 
| 144         flags_(flags), | 144         flags_(flags), | 
| 145         debug_name_(debug_name) { | 145         debug_name_(debug_name) { | 
| 146     DCHECK(machine_sig->return_count() == location_sig->return_count()); | 146     DCHECK(machine_sig->return_count() == location_sig->return_count()); | 
| 147     DCHECK(machine_sig->parameter_count() == location_sig->parameter_count()); | 147     DCHECK(machine_sig->parameter_count() == location_sig->parameter_count()); | 
| 148   } | 148   } | 
| 149 | 149 | 
| 150   // Returns the kind of this call. | 150   // Returns the kind of this call. | 
| 151   Kind kind() const { return kind_; } | 151   Kind kind() const { return kind_; } | 
| 152 | 152 | 
| 153   // Returns {true} if this descriptor is a call to a C function. | 153   // Returns {true} if this descriptor is a call to a C function. | 
| 154   bool IsCFunctionCall() const { return kind_ == kCallAddress; } | 154   bool IsCFunctionCall() const { return kind_ == kCallAddress; } | 
| 155 | 155 | 
| 156   // Returns {true} if this descriptor is a call to a JSFunction. | 156   // Returns {true} if this descriptor is a call to a JSFunction. | 
| 157   bool IsJSFunctionCall() const { return kind_ == kCallJSFunction; } | 157   bool IsJSFunctionCall() const { return kind_ == kCallJSFunction; } | 
| 158 | 158 | 
| 159   bool IsInterpreterDispatch() const { return kind_ == kInterpreterDispatch; } | 159   bool IsInterpreterDispatch() const { return kind_ == kInterpreterDispatch; } | 
| 160 | 160 | 
| 161   // The number of return values from this call. | 161   // The number of return values from this call. | 
| 162   size_t ReturnCount() const { return machine_sig_->return_count(); } | 162   size_t ReturnCount() const { return machine_sig_->return_count(); } | 
| 163 | 163 | 
| 164   // The number of C parameters to this call. | 164   // The number of C parameters to this call. | 
| 165   size_t CParameterCount() const { return machine_sig_->parameter_count(); } | 165   size_t CParameterCount() const { return machine_sig_->parameter_count(); } | 
| 166 | 166 | 
| 167   // The number of JavaScript parameters to this call, including the receiver | 167   // The number of stack parameters to the call. | 
| 168   // object. | 168   size_t StackParameterCount() const { return stack_param_count_; } | 
| 169   size_t JSParameterCount() const { return js_param_count_; } | 169 | 
|  | 170   // The number of parameters to the JS function call. | 
|  | 171   size_t JSParameterCount() const { | 
|  | 172     DCHECK(IsJSFunctionCall()); | 
|  | 173     return stack_param_count_; | 
|  | 174   } | 
| 170 | 175 | 
| 171   // The total number of inputs to this call, which includes the target, | 176   // The total number of inputs to this call, which includes the target, | 
| 172   // receiver, context, etc. | 177   // receiver, context, etc. | 
| 173   // TODO(titzer): this should input the framestate input too. | 178   // TODO(titzer): this should input the framestate input too. | 
| 174   size_t InputCount() const { return 1 + machine_sig_->parameter_count(); } | 179   size_t InputCount() const { return 1 + machine_sig_->parameter_count(); } | 
| 175 | 180 | 
| 176   size_t FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } | 181   size_t FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } | 
| 177 | 182 | 
| 178   Flags flags() const { return flags_; } | 183   Flags flags() const { return flags_; } | 
| 179 | 184 | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 218   bool CanTailCall(const Node* call) const; | 223   bool CanTailCall(const Node* call) const; | 
| 219 | 224 | 
| 220  private: | 225  private: | 
| 221   friend class Linkage; | 226   friend class Linkage; | 
| 222 | 227 | 
| 223   const Kind kind_; | 228   const Kind kind_; | 
| 224   const MachineType target_type_; | 229   const MachineType target_type_; | 
| 225   const LinkageLocation target_loc_; | 230   const LinkageLocation target_loc_; | 
| 226   const MachineSignature* const machine_sig_; | 231   const MachineSignature* const machine_sig_; | 
| 227   const LocationSignature* const location_sig_; | 232   const LocationSignature* const location_sig_; | 
| 228   const size_t js_param_count_; | 233   const size_t stack_param_count_; | 
| 229   const Operator::Properties properties_; | 234   const Operator::Properties properties_; | 
| 230   const RegList callee_saved_registers_; | 235   const RegList callee_saved_registers_; | 
| 231   const RegList callee_saved_fp_registers_; | 236   const RegList callee_saved_fp_registers_; | 
| 232   const Flags flags_; | 237   const Flags flags_; | 
| 233   const char* const debug_name_; | 238   const char* const debug_name_; | 
| 234 | 239 | 
| 235   DISALLOW_COPY_AND_ASSIGN(CallDescriptor); | 240   DISALLOW_COPY_AND_ASSIGN(CallDescriptor); | 
| 236 }; | 241 }; | 
| 237 | 242 | 
| 238 DEFINE_OPERATORS_FOR_FLAGS(CallDescriptor::Flags) | 243 DEFINE_OPERATORS_FOR_FLAGS(CallDescriptor::Flags) | 
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 333   CallDescriptor* const incoming_; | 338   CallDescriptor* const incoming_; | 
| 334 | 339 | 
| 335   DISALLOW_COPY_AND_ASSIGN(Linkage); | 340   DISALLOW_COPY_AND_ASSIGN(Linkage); | 
| 336 }; | 341 }; | 
| 337 | 342 | 
| 338 }  // namespace compiler | 343 }  // namespace compiler | 
| 339 }  // namespace internal | 344 }  // namespace internal | 
| 340 }  // namespace v8 | 345 }  // namespace v8 | 
| 341 | 346 | 
| 342 #endif  // V8_COMPILER_LINKAGE_H_ | 347 #endif  // V8_COMPILER_LINKAGE_H_ | 
| OLD | NEW | 
|---|