| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // representing the architecture-specific location. The following call node | 165 // representing the architecture-specific location. The following call node |
| 166 // layouts are supported (where {n} is the number value inputs): | 166 // layouts are supported (where {n} is the number value inputs): |
| 167 // | 167 // |
| 168 // #0 #1 #2 #3 [...] #n | 168 // #0 #1 #2 #3 [...] #n |
| 169 // Call[CodeStub] code, arg 1, arg 2, arg 3, [...], context | 169 // Call[CodeStub] code, arg 1, arg 2, arg 3, [...], context |
| 170 // Call[JSFunction] function, rcvr, arg 1, arg 2, [...], context | 170 // Call[JSFunction] function, rcvr, arg 1, arg 2, [...], context |
| 171 // Call[Runtime] CEntryStub, arg 1, arg 2, arg 3, [...], fun, #arg, context | 171 // Call[Runtime] CEntryStub, arg 1, arg 2, arg 3, [...], fun, #arg, context |
| 172 class Linkage : public ZoneObject { | 172 class Linkage : public ZoneObject { |
| 173 public: | 173 public: |
| 174 Linkage(Zone* zone, CompilationInfo* info) | 174 Linkage(Zone* zone, CompilationInfo* info) |
| 175 : zone_(zone), incoming_(ComputeIncoming(zone, info)) {} | 175 : isolate_(info->isolate()), |
| 176 Linkage(Zone* zone, CallDescriptor* incoming) | 176 zone_(zone), |
| 177 : zone_(zone), incoming_(incoming) {} | 177 incoming_(ComputeIncoming(zone, info)) {} |
| 178 Linkage(Isolate* isolate, Zone* zone, CallDescriptor* incoming) |
| 179 : isolate_(isolate), zone_(zone), incoming_(incoming) {} |
| 178 | 180 |
| 179 static CallDescriptor* ComputeIncoming(Zone* zone, CompilationInfo* info); | 181 static CallDescriptor* ComputeIncoming(Zone* zone, CompilationInfo* info); |
| 180 | 182 |
| 181 // The call descriptor for this compilation unit describes the locations | 183 // The call descriptor for this compilation unit describes the locations |
| 182 // of incoming parameters and the outgoing return value(s). | 184 // of incoming parameters and the outgoing return value(s). |
| 183 CallDescriptor* GetIncomingDescriptor() const { return incoming_; } | 185 CallDescriptor* GetIncomingDescriptor() const { return incoming_; } |
| 184 CallDescriptor* GetJSCallDescriptor(int parameter_count, | 186 CallDescriptor* GetJSCallDescriptor(int parameter_count, |
| 185 CallDescriptor::Flags flags) const; | 187 CallDescriptor::Flags flags) const; |
| 186 static CallDescriptor* GetJSCallDescriptor(int parameter_count, Zone* zone, | 188 static CallDescriptor* GetJSCallDescriptor(Zone* zone, int parameter_count, |
| 187 CallDescriptor::Flags flags); | 189 CallDescriptor::Flags flags); |
| 188 CallDescriptor* GetRuntimeCallDescriptor( | 190 CallDescriptor* GetRuntimeCallDescriptor( |
| 189 Runtime::FunctionId function, int parameter_count, | 191 Runtime::FunctionId function, int parameter_count, |
| 190 Operator::Properties properties) const; | 192 Operator::Properties properties) const; |
| 191 static CallDescriptor* GetRuntimeCallDescriptor( | 193 static CallDescriptor* GetRuntimeCallDescriptor( |
| 192 Runtime::FunctionId function, int parameter_count, | 194 Zone* zone, Runtime::FunctionId function, int parameter_count, |
| 193 Operator::Properties properties, Zone* zone); | 195 Operator::Properties properties); |
| 194 | 196 |
| 195 CallDescriptor* GetStubCallDescriptor( | 197 CallDescriptor* GetStubCallDescriptor( |
| 196 const CallInterfaceDescriptor& descriptor, int stack_parameter_count = 0, | 198 const CallInterfaceDescriptor& descriptor, int stack_parameter_count = 0, |
| 197 CallDescriptor::Flags flags = CallDescriptor::kNoFlags, | 199 CallDescriptor::Flags flags = CallDescriptor::kNoFlags, |
| 198 Operator::Properties properties = Operator::kNoProperties) const; | 200 Operator::Properties properties = Operator::kNoProperties) const; |
| 199 static CallDescriptor* GetStubCallDescriptor( | 201 static CallDescriptor* GetStubCallDescriptor( |
| 200 const CallInterfaceDescriptor& descriptor, int stack_parameter_count, | 202 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, |
| 201 CallDescriptor::Flags flags, Operator::Properties properties, Zone* zone); | 203 int stack_parameter_count, CallDescriptor::Flags flags, |
| 204 Operator::Properties properties); |
| 202 | 205 |
| 203 // Creates a call descriptor for simplified C calls that is appropriate | 206 // Creates a call descriptor for simplified C calls that is appropriate |
| 204 // for the host platform. This simplified calling convention only supports | 207 // for the host platform. This simplified calling convention only supports |
| 205 // integers and pointers of one word size each, i.e. no floating point, | 208 // integers and pointers of one word size each, i.e. no floating point, |
| 206 // structs, pointers to members, etc. | 209 // structs, pointers to members, etc. |
| 207 static CallDescriptor* GetSimplifiedCDescriptor(Zone* zone, | 210 static CallDescriptor* GetSimplifiedCDescriptor(Zone* zone, |
| 208 MachineSignature* sig); | 211 MachineSignature* sig); |
| 209 | 212 |
| 210 // Get the location of an (incoming) parameter to this function. | 213 // Get the location of an (incoming) parameter to this function. |
| 211 LinkageLocation GetParameterLocation(int index) const { | 214 LinkageLocation GetParameterLocation(int index) const { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 231 // caller's frame. The {extra} parameter indicates an additional offset from | 234 // caller's frame. The {extra} parameter indicates an additional offset from |
| 232 // the frame offset, e.g. to index into part of a double slot. | 235 // the frame offset, e.g. to index into part of a double slot. |
| 233 FrameOffset GetFrameOffset(int spill_slot, Frame* frame, int extra = 0) const; | 236 FrameOffset GetFrameOffset(int spill_slot, Frame* frame, int extra = 0) const; |
| 234 | 237 |
| 235 static bool NeedsFrameState(Runtime::FunctionId function); | 238 static bool NeedsFrameState(Runtime::FunctionId function); |
| 236 | 239 |
| 237 // Get the location where an incoming OSR value is stored. | 240 // Get the location where an incoming OSR value is stored. |
| 238 LinkageLocation GetOsrValueLocation(int index) const; | 241 LinkageLocation GetOsrValueLocation(int index) const; |
| 239 | 242 |
| 240 private: | 243 private: |
| 244 Isolate* isolate_; |
| 241 Zone* const zone_; | 245 Zone* const zone_; |
| 242 CallDescriptor* const incoming_; | 246 CallDescriptor* const incoming_; |
| 243 | 247 |
| 244 DISALLOW_COPY_AND_ASSIGN(Linkage); | 248 DISALLOW_COPY_AND_ASSIGN(Linkage); |
| 245 }; | 249 }; |
| 246 | 250 |
| 247 } // namespace compiler | 251 } // namespace compiler |
| 248 } // namespace internal | 252 } // namespace internal |
| 249 } // namespace v8 | 253 } // namespace v8 |
| 250 | 254 |
| 251 #endif // V8_COMPILER_LINKAGE_H_ | 255 #endif // V8_COMPILER_LINKAGE_H_ |
| OLD | NEW |