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_IMPL_H_ | 5 #ifndef V8_COMPILER_LINKAGE_IMPL_H_ |
6 #define V8_COMPILER_LINKAGE_IMPL_H_ | 6 #define V8_COMPILER_LINKAGE_IMPL_H_ |
7 | 7 |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler/osr.h" | 9 #include "src/compiler/osr.h" |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // TODO(titzer): When entering into an OSR function from unoptimized code, | 60 // TODO(titzer): When entering into an OSR function from unoptimized code, |
61 // the JSFunction is not in a register, but it is on the stack in an | 61 // the JSFunction is not in a register, but it is on the stack in an |
62 // unaddressable spill slot. We hack this in the OSR prologue. Fix. | 62 // unaddressable spill slot. We hack this in the OSR prologue. Fix. |
63 LinkageLocation target_loc = regloc(LinkageTraits::JSCallFunctionReg()); | 63 LinkageLocation target_loc = regloc(LinkageTraits::JSCallFunctionReg()); |
64 return new (zone) CallDescriptor( // -- | 64 return new (zone) CallDescriptor( // -- |
65 CallDescriptor::kCallJSFunction, // kind | 65 CallDescriptor::kCallJSFunction, // kind |
66 target_type, // target MachineType | 66 target_type, // target MachineType |
67 target_loc, // target location | 67 target_loc, // target location |
68 types.Build(), // machine_sig | 68 types.Build(), // machine_sig |
69 locations.Build(), // location_sig | 69 locations.Build(), // location_sig |
70 js_parameter_count, // js_parameter_count | 70 js_parameter_count, // stack_parameter_count |
71 Operator::kNoProperties, // properties | 71 Operator::kNoProperties, // properties |
72 kNoCalleeSaved, // callee-saved | 72 kNoCalleeSaved, // callee-saved |
73 kNoCalleeSaved, // callee-saved fp | 73 kNoCalleeSaved, // callee-saved fp |
74 flags, // flags | 74 flags, // flags |
75 "js-call"); | 75 "js-call"); |
76 } | 76 } |
77 | 77 |
78 | 78 |
79 // TODO(turbofan): cache call descriptors for runtime calls. | 79 // TODO(turbofan): cache call descriptors for runtime calls. |
80 static CallDescriptor* GetRuntimeCallDescriptor( | 80 static CallDescriptor* GetRuntimeCallDescriptor( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 // The target for runtime calls is a code object. | 123 // The target for runtime calls is a code object. |
124 MachineType target_type = kMachAnyTagged; | 124 MachineType target_type = kMachAnyTagged; |
125 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); | 125 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); |
126 return new (zone) CallDescriptor( // -- | 126 return new (zone) CallDescriptor( // -- |
127 CallDescriptor::kCallCodeObject, // kind | 127 CallDescriptor::kCallCodeObject, // kind |
128 target_type, // target MachineType | 128 target_type, // target MachineType |
129 target_loc, // target location | 129 target_loc, // target location |
130 types.Build(), // machine_sig | 130 types.Build(), // machine_sig |
131 locations.Build(), // location_sig | 131 locations.Build(), // location_sig |
132 js_parameter_count, // js_parameter_count | 132 js_parameter_count, // stack_parameter_count |
133 properties, // properties | 133 properties, // properties |
134 kNoCalleeSaved, // callee-saved | 134 kNoCalleeSaved, // callee-saved |
135 kNoCalleeSaved, // callee-saved fp | 135 kNoCalleeSaved, // callee-saved fp |
136 flags, // flags | 136 flags, // flags |
137 function->name); // debug name | 137 function->name); // debug name |
138 } | 138 } |
139 | 139 |
140 | 140 |
141 // TODO(all): Add support for return representations/locations to | 141 // TODO(all): Add support for return representations/locations to |
142 // CallInterfaceDescriptor. | 142 // CallInterfaceDescriptor. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 // The target for stub calls is a code object. | 183 // The target for stub calls is a code object. |
184 MachineType target_type = kMachAnyTagged; | 184 MachineType target_type = kMachAnyTagged; |
185 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); | 185 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); |
186 return new (zone) CallDescriptor( // -- | 186 return new (zone) CallDescriptor( // -- |
187 CallDescriptor::kCallCodeObject, // kind | 187 CallDescriptor::kCallCodeObject, // kind |
188 target_type, // target MachineType | 188 target_type, // target MachineType |
189 target_loc, // target location | 189 target_loc, // target location |
190 types.Build(), // machine_sig | 190 types.Build(), // machine_sig |
191 locations.Build(), // location_sig | 191 locations.Build(), // location_sig |
192 js_parameter_count, // js_parameter_count | 192 stack_parameter_count, // stack_parameter_count |
193 properties, // properties | 193 properties, // properties |
194 kNoCalleeSaved, // callee-saved registers | 194 kNoCalleeSaved, // callee-saved registers |
195 kNoCalleeSaved, // callee-saved fp | 195 kNoCalleeSaved, // callee-saved fp |
196 flags, // flags | 196 flags, // flags |
197 descriptor.DebugName(isolate)); | 197 descriptor.DebugName(isolate)); |
198 } | 198 } |
199 | 199 |
200 static CallDescriptor* GetInterpreterDispatchDescriptor(Zone* zone) { | 200 static CallDescriptor* GetInterpreterDispatchDescriptor(Zone* zone) { |
201 MachineSignature::Builder types(zone, 0, 3); | 201 MachineSignature::Builder types(zone, 0, 3); |
202 LocationSignature::Builder locations(zone, 0, 3); | 202 LocationSignature::Builder locations(zone, 0, 3); |
(...skipping 11 matching lines...) Expand all Loading... |
214 types.AddParam(kMachPtr); | 214 types.AddParam(kMachPtr); |
215 locations.AddParam(regloc(LinkageTraits::InterpreterDispatchTableReg())); | 215 locations.AddParam(regloc(LinkageTraits::InterpreterDispatchTableReg())); |
216 | 216 |
217 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); | 217 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); |
218 return new (zone) CallDescriptor( // -- | 218 return new (zone) CallDescriptor( // -- |
219 CallDescriptor::kInterpreterDispatch, // kind | 219 CallDescriptor::kInterpreterDispatch, // kind |
220 kMachNone, // target MachineType | 220 kMachNone, // target MachineType |
221 target_loc, // target location | 221 target_loc, // target location |
222 types.Build(), // machine_sig | 222 types.Build(), // machine_sig |
223 locations.Build(), // location_sig | 223 locations.Build(), // location_sig |
224 0, // js_parameter_count | 224 0, // stack_parameter_count |
225 Operator::kNoProperties, // properties | 225 Operator::kNoProperties, // properties |
226 kNoCalleeSaved, // callee-saved registers | 226 kNoCalleeSaved, // callee-saved registers |
227 kNoCalleeSaved, // callee-saved fp regs | 227 kNoCalleeSaved, // callee-saved fp regs |
228 CallDescriptor::kSupportsTailCalls, // flags | 228 CallDescriptor::kSupportsTailCalls, // flags |
229 "interpreter-dispatch"); | 229 "interpreter-dispatch"); |
230 } | 230 } |
231 | 231 |
232 static LinkageLocation regloc(Register reg) { | 232 static LinkageLocation regloc(Register reg) { |
233 return LinkageLocation::ForRegister(Register::ToAllocationIndex(reg)); | 233 return LinkageLocation::ForRegister(Register::ToAllocationIndex(reg)); |
234 } | 234 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 int parameter_index = 1 + index; // skip index 0, which is the target. | 286 int parameter_index = 1 + index; // skip index 0, which is the target. |
287 return incoming_->GetInputLocation(parameter_index); | 287 return incoming_->GetInputLocation(parameter_index); |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 } // namespace compiler | 291 } // namespace compiler |
292 } // namespace internal | 292 } // namespace internal |
293 } // namespace v8 | 293 } // namespace v8 |
294 | 294 |
295 #endif // V8_COMPILER_LINKAGE_IMPL_H_ | 295 #endif // V8_COMPILER_LINKAGE_IMPL_H_ |
OLD | NEW |