| 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/operator.h" | 10 #include "src/compiler/operator.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 kPatchableCallSite = 1u << 1, | 150 kPatchableCallSite = 1u << 1, |
| 151 kNeedsNopAfterCall = 1u << 2, | 151 kNeedsNopAfterCall = 1u << 2, |
| 152 kHasExceptionHandler = 1u << 3, | 152 kHasExceptionHandler = 1u << 3, |
| 153 kHasLocalCatchHandler = 1u << 4, | 153 kHasLocalCatchHandler = 1u << 4, |
| 154 kSupportsTailCalls = 1u << 5, | 154 kSupportsTailCalls = 1u << 5, |
| 155 kCanUseRoots = 1u << 6, | 155 kCanUseRoots = 1u << 6, |
| 156 // (arm64 only) native stack should be used for arguments. | 156 // (arm64 only) native stack should be used for arguments. |
| 157 kUseNativeStack = 1u << 7, | 157 kUseNativeStack = 1u << 7, |
| 158 // (arm64 only) call instruction has to restore JSSP. | 158 // (arm64 only) call instruction has to restore JSSP. |
| 159 kRestoreJSSP = 1u << 8, | 159 kRestoreJSSP = 1u << 8, |
| 160 // Causes the code generator to initialize the root register. |
| 161 kInitializeRootRegister = 1u << 9, |
| 160 kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall | 162 kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall |
| 161 }; | 163 }; |
| 162 typedef base::Flags<Flag> Flags; | 164 typedef base::Flags<Flag> Flags; |
| 163 | 165 |
| 164 CallDescriptor(Kind kind, MachineType target_type, LinkageLocation target_loc, | 166 CallDescriptor(Kind kind, MachineType target_type, LinkageLocation target_loc, |
| 165 const MachineSignature* machine_sig, | 167 const MachineSignature* machine_sig, |
| 166 LocationSignature* location_sig, size_t stack_param_count, | 168 LocationSignature* location_sig, size_t stack_param_count, |
| 167 Operator::Properties properties, | 169 Operator::Properties properties, |
| 168 RegList callee_saved_registers, | 170 RegList callee_saved_registers, |
| 169 RegList callee_saved_fp_registers, Flags flags, | 171 RegList callee_saved_fp_registers, Flags flags, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // TODO(titzer): this should input the framestate input too. | 218 // TODO(titzer): this should input the framestate input too. |
| 217 size_t InputCount() const { return 1 + machine_sig_->parameter_count(); } | 219 size_t InputCount() const { return 1 + machine_sig_->parameter_count(); } |
| 218 | 220 |
| 219 size_t FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } | 221 size_t FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } |
| 220 | 222 |
| 221 Flags flags() const { return flags_; } | 223 Flags flags() const { return flags_; } |
| 222 | 224 |
| 223 bool NeedsFrameState() const { return flags() & kNeedsFrameState; } | 225 bool NeedsFrameState() const { return flags() & kNeedsFrameState; } |
| 224 bool SupportsTailCalls() const { return flags() & kSupportsTailCalls; } | 226 bool SupportsTailCalls() const { return flags() & kSupportsTailCalls; } |
| 225 bool UseNativeStack() const { return flags() & kUseNativeStack; } | 227 bool UseNativeStack() const { return flags() & kUseNativeStack; } |
| 228 bool InitializeRootRegister() const { |
| 229 return flags() & kInitializeRootRegister; |
| 230 } |
| 226 | 231 |
| 227 LinkageLocation GetReturnLocation(size_t index) const { | 232 LinkageLocation GetReturnLocation(size_t index) const { |
| 228 return location_sig_->GetReturn(index); | 233 return location_sig_->GetReturn(index); |
| 229 } | 234 } |
| 230 | 235 |
| 231 LinkageLocation GetInputLocation(size_t index) const { | 236 LinkageLocation GetInputLocation(size_t index) const { |
| 232 if (index == 0) return target_loc_; | 237 if (index == 0) return target_loc_; |
| 233 return location_sig_->GetParam(index - 1); | 238 return location_sig_->GetParam(index - 1); |
| 234 } | 239 } |
| 235 | 240 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, | 325 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, |
| 321 int stack_parameter_count, CallDescriptor::Flags flags, | 326 int stack_parameter_count, CallDescriptor::Flags flags, |
| 322 Operator::Properties properties = Operator::kNoProperties, | 327 Operator::Properties properties = Operator::kNoProperties, |
| 323 MachineType return_type = MachineType::AnyTagged(), | 328 MachineType return_type = MachineType::AnyTagged(), |
| 324 size_t return_count = 1); | 329 size_t return_count = 1); |
| 325 | 330 |
| 326 // Creates a call descriptor for simplified C calls that is appropriate | 331 // Creates a call descriptor for simplified C calls that is appropriate |
| 327 // for the host platform. This simplified calling convention only supports | 332 // for the host platform. This simplified calling convention only supports |
| 328 // integers and pointers of one word size each, i.e. no floating point, | 333 // integers and pointers of one word size each, i.e. no floating point, |
| 329 // structs, pointers to members, etc. | 334 // structs, pointers to members, etc. |
| 330 static CallDescriptor* GetSimplifiedCDescriptor(Zone* zone, | 335 static CallDescriptor* GetSimplifiedCDescriptor( |
| 331 const MachineSignature* sig); | 336 Zone* zone, const MachineSignature* sig, |
| 337 bool set_initialize_root_flag = false); |
| 332 | 338 |
| 333 // Creates a call descriptor for interpreter handler code stubs. These are not | 339 // Creates a call descriptor for interpreter handler code stubs. These are not |
| 334 // intended to be called directly but are instead dispatched to by the | 340 // intended to be called directly but are instead dispatched to by the |
| 335 // interpreter. | 341 // interpreter. |
| 336 static CallDescriptor* GetInterpreterDispatchDescriptor(Zone* zone); | 342 static CallDescriptor* GetInterpreterDispatchDescriptor(Zone* zone); |
| 337 | 343 |
| 338 // Get the location of an (incoming) parameter to this function. | 344 // Get the location of an (incoming) parameter to this function. |
| 339 LinkageLocation GetParameterLocation(int index) const { | 345 LinkageLocation GetParameterLocation(int index) const { |
| 340 return incoming_->GetInputLocation(index + 1); // + 1 to skip target. | 346 return incoming_->GetInputLocation(index + 1); // + 1 to skip target. |
| 341 } | 347 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 CallDescriptor* const incoming_; | 403 CallDescriptor* const incoming_; |
| 398 | 404 |
| 399 DISALLOW_COPY_AND_ASSIGN(Linkage); | 405 DISALLOW_COPY_AND_ASSIGN(Linkage); |
| 400 }; | 406 }; |
| 401 | 407 |
| 402 } // namespace compiler | 408 } // namespace compiler |
| 403 } // namespace internal | 409 } // namespace internal |
| 404 } // namespace v8 | 410 } // namespace v8 |
| 405 | 411 |
| 406 #endif // V8_COMPILER_LINKAGE_H_ | 412 #endif // V8_COMPILER_LINKAGE_H_ |
| OLD | NEW |