Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: src/compiler/runtime-linkage.cc

Issue 1272883003: [turbofan] Remove architecture-specific linkage files and LinkageTraits. Use macro-assembler-define… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
10 #include "src/compiler/linkage-impl.h"
11
12 namespace v8 {
13 namespace internal {
14 namespace compiler {
15
16 CallDescriptor* Linkage::GetRuntimeCallDescriptor(
17 Zone* zone, Runtime::FunctionId function_id, int js_parameter_count,
18 Operator::Properties properties) {
19 const size_t function_count = 1;
20 const size_t num_args_count = 1;
21 const size_t context_count = 1;
22 const size_t parameter_count = function_count +
23 static_cast<size_t>(js_parameter_count) +
24 num_args_count + context_count;
25
26 const Runtime::Function* function = Runtime::FunctionForId(function_id);
27 const size_t return_count = static_cast<size_t>(function->result_size);
28
29 LocationSignature::Builder locations(zone, return_count, parameter_count);
30 MachineSignature::Builder types(zone, return_count, parameter_count);
31
32 // Add returns.
33 if (locations.return_count_ > 0) {
34 locations.AddReturn(regloc(kReturnRegister0));
35 }
36 if (locations.return_count_ > 1) {
37 locations.AddReturn(regloc(kReturnRegister1));
38 }
39 for (size_t i = 0; i < return_count; i++) {
40 types.AddReturn(kMachAnyTagged);
41 }
42
43 // All parameters to the runtime call go on the stack.
44 for (int i = 0; i < js_parameter_count; i++) {
45 locations.AddParam(stackloc(i - js_parameter_count));
46 types.AddParam(kMachAnyTagged);
47 }
48 // Add runtime function itself.
49 locations.AddParam(regloc(kRuntimeCallFunctionRegister));
50 types.AddParam(kMachAnyTagged);
51
52 // Add runtime call argument count.
53 locations.AddParam(regloc(kRuntimeCallArgCountRegister));
54 types.AddParam(kMachPtr);
55
56 // Add context.
57 locations.AddParam(regloc(kContextRegister));
58 types.AddParam(kMachAnyTagged);
59
60 CallDescriptor::Flags flags = Linkage::FrameStateInputCount(function_id) > 0
61 ? CallDescriptor::kNeedsFrameState
62 : CallDescriptor::kNoFlags;
63
64 // The target for runtime calls is a code object.
65 MachineType target_type = kMachAnyTagged;
66 LinkageLocation target_loc = LinkageLocation::ForAnyRegister();
67 return new (zone) CallDescriptor( // --
68 CallDescriptor::kCallCodeObject, // kind
69 target_type, // target MachineType
70 target_loc, // target location
71 types.Build(), // machine_sig
72 locations.Build(), // location_sig
73 js_parameter_count, // stack_parameter_count
74 properties, // properties
75 kNoCalleeSaved, // callee-saved
76 kNoCalleeSaved, // callee-saved fp
77 flags, // flags
78 function->name); // debug name
79 }
80 }
81 }
82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698