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