| 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/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| 11 #include "src/compiler/frame.h" | 11 #include "src/compiler/frame.h" |
| 12 #include "src/compiler/machine-operator.h" | 12 #include "src/compiler/machine-operator.h" |
| 13 #include "src/compiler/node.h" | 13 #include "src/compiler/node.h" |
| 14 #include "src/compiler/operator.h" | 14 #include "src/compiler/operator.h" |
| 15 #include "src/zone.h" | 15 #include "src/zone.h" |
| 16 | 16 |
| 17 namespace v8 { | 17 namespace v8 { |
| 18 namespace internal { | 18 namespace internal { |
| 19 namespace compiler { | 19 namespace compiler { |
| 20 | 20 |
| 21 // Describes the location for a parameter or a return value to a call. | 21 // Describes the location for a parameter or a return value to a call. |
| 22 // TODO(titzer): replace with Radium locations when they are ready. | 22 // TODO(titzer): replace with Radium locations when they are ready. |
| 23 class LinkageLocation { | 23 class LinkageLocation { |
| 24 public: | 24 public: |
| 25 LinkageLocation(MachineRepresentation rep, int location) | 25 LinkageLocation(MachineType rep, int location) |
| 26 : rep_(rep), location_(location) {} | 26 : rep_(rep), location_(location) {} |
| 27 | 27 |
| 28 inline MachineRepresentation representation() const { return rep_; } | 28 inline MachineType representation() const { return rep_; } |
| 29 | 29 |
| 30 static const int16_t ANY_REGISTER = 32767; | 30 static const int16_t ANY_REGISTER = 32767; |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 friend class CallDescriptor; | 33 friend class CallDescriptor; |
| 34 friend class OperandGenerator; | 34 friend class OperandGenerator; |
| 35 MachineRepresentation rep_; | 35 MachineType rep_; |
| 36 int16_t location_; // >= 0 implies register, otherwise stack slot. | 36 int16_t location_; // >= 0 implies register, otherwise stack slot. |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 | 39 |
| 40 class CallDescriptor : public ZoneObject { | 40 class CallDescriptor : public ZoneObject { |
| 41 public: | 41 public: |
| 42 // Describes whether the first parameter is a code object, a JSFunction, | 42 // Describes whether the first parameter is a code object, a JSFunction, |
| 43 // or an address--all of which require different machine sequences to call. | 43 // or an address--all of which require different machine sequences to call. |
| 44 enum Kind { kCallCodeObject, kCallJSFunction, kCallAddress }; | 44 enum Kind { kCallCodeObject, kCallJSFunction, kCallAddress }; |
| 45 | 45 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 CallDescriptor::kCannotDeoptimize); | 153 CallDescriptor::kCannotDeoptimize); |
| 154 static CallDescriptor* GetStubCallDescriptor( | 154 static CallDescriptor* GetStubCallDescriptor( |
| 155 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count, | 155 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count, |
| 156 CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone); | 156 CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone); |
| 157 | 157 |
| 158 // Creates a call descriptor for simplified C calls that is appropriate | 158 // Creates a call descriptor for simplified C calls that is appropriate |
| 159 // for the host platform. This simplified calling convention only supports | 159 // for the host platform. This simplified calling convention only supports |
| 160 // integers and pointers of one word size each, i.e. no floating point, | 160 // integers and pointers of one word size each, i.e. no floating point, |
| 161 // structs, pointers to members, etc. | 161 // structs, pointers to members, etc. |
| 162 static CallDescriptor* GetSimplifiedCDescriptor( | 162 static CallDescriptor* GetSimplifiedCDescriptor( |
| 163 Zone* zone, int num_params, MachineRepresentation return_type, | 163 Zone* zone, int num_params, MachineType return_type, |
| 164 const MachineRepresentation* param_types); | 164 const MachineType* param_types); |
| 165 | 165 |
| 166 // Get the location of an (incoming) parameter to this function. | 166 // Get the location of an (incoming) parameter to this function. |
| 167 LinkageLocation GetParameterLocation(int index) { | 167 LinkageLocation GetParameterLocation(int index) { |
| 168 return incoming_->GetInputLocation(index + 1); | 168 return incoming_->GetInputLocation(index + 1); |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Get the location where this function should place its return value. | 171 // Get the location where this function should place its return value. |
| 172 LinkageLocation GetReturnLocation() { | 172 LinkageLocation GetReturnLocation() { |
| 173 return incoming_->GetReturnLocation(0); | 173 return incoming_->GetReturnLocation(0); |
| 174 } | 174 } |
| 175 | 175 |
| 176 // Get the frame offset for a given spill slot. The location depends on the | 176 // Get the frame offset for a given spill slot. The location depends on the |
| 177 // calling convention and the specific frame layout, and may thus be | 177 // calling convention and the specific frame layout, and may thus be |
| 178 // architecture-specific. Negative spill slots indicate arguments on the | 178 // architecture-specific. Negative spill slots indicate arguments on the |
| 179 // caller's frame. The {extra} parameter indicates an additional offset from | 179 // caller's frame. The {extra} parameter indicates an additional offset from |
| 180 // the frame offset, e.g. to index into part of a double slot. | 180 // the frame offset, e.g. to index into part of a double slot. |
| 181 FrameOffset GetFrameOffset(int spill_slot, Frame* frame, int extra = 0); | 181 FrameOffset GetFrameOffset(int spill_slot, Frame* frame, int extra = 0); |
| 182 | 182 |
| 183 CompilationInfo* info() const { return info_; } | 183 CompilationInfo* info() const { return info_; } |
| 184 | 184 |
| 185 private: | 185 private: |
| 186 CompilationInfo* info_; | 186 CompilationInfo* info_; |
| 187 CallDescriptor* incoming_; | 187 CallDescriptor* incoming_; |
| 188 }; | 188 }; |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 } // namespace v8::internal::compiler | 191 } // namespace v8::internal::compiler |
| 192 | 192 |
| 193 #endif // V8_COMPILER_LINKAGE_H_ | 193 #endif // V8_COMPILER_LINKAGE_H_ |
| OLD | NEW |