OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "src/assembler.h" | |
6 #include "src/macro-assembler.h" | |
7 | |
8 #include "src/compiler/linkage.h" | |
9 #include "src/compiler/linkage-impl.h" | |
10 | |
11 namespace v8 { | |
12 namespace internal { | |
13 namespace compiler { | |
14 | |
15 CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr, | |
16 int js_parameter_count, | |
17 CallDescriptor::Flags flags) { | |
18 const size_t return_count = 1; | |
19 const size_t context_count = 1; | |
20 const size_t parameter_count = js_parameter_count + context_count; | |
21 | |
22 LocationSignature::Builder locations(zone, return_count, parameter_count); | |
23 MachineSignature::Builder types(zone, return_count, parameter_count); | |
24 | |
25 // All JS calls have exactly one return value. | |
26 locations.AddReturn(regloc(kReturnRegister0)); | |
27 types.AddReturn(kMachAnyTagged); | |
28 | |
29 // All parameters to JS calls go on the stack. | |
30 for (int i = 0; i < js_parameter_count; i++) { | |
31 int spill_slot_index = i - js_parameter_count; | |
32 locations.AddParam(stackloc(spill_slot_index)); | |
33 types.AddParam(kMachAnyTagged); | |
34 } | |
35 // Add context. | |
36 locations.AddParam(regloc(kContextRegister)); | |
37 types.AddParam(kMachAnyTagged); | |
38 | |
39 // The target for JS function calls is the JSFunction object. | |
40 MachineType target_type = kMachAnyTagged; | |
41 // TODO(titzer): When entering into an OSR function from unoptimized code, | |
42 // the JSFunction is not in a register, but it is on the stack in an | |
43 // unaddressable spill slot. We hack this in the OSR prologue. Fix. | |
44 LinkageLocation target_loc = regloc(kJSFunctionRegister); | |
45 return new (zone) CallDescriptor( // -- | |
46 CallDescriptor::kCallJSFunction, // kind | |
47 target_type, // target MachineType | |
48 target_loc, // target location | |
49 types.Build(), // machine_sig | |
50 locations.Build(), // location_sig | |
51 js_parameter_count, // stack_parameter_count | |
52 Operator::kNoProperties, // properties | |
53 kNoCalleeSaved, // callee-saved | |
54 kNoCalleeSaved, // callee-saved fp | |
55 flags, // flags | |
56 "js-call"); | |
57 } | |
58 } | |
Michael Starzinger
2015/08/07 07:59:03
nit:
} // namespace compiler
} // namespace int
| |
59 } | |
60 } | |
OLD | NEW |