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

Side by Side Diff: src/compiler/linkage-impl.h

Issue 552803002: Get CallInterfaceDescriptor directly from CodeStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
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 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace compiler { 10 namespace compiler {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 js_parameter_count, // js_parameter_count 122 js_parameter_count, // js_parameter_count
123 properties, // properties 123 properties, // properties
124 kNoCalleeSaved, // callee-saved 124 kNoCalleeSaved, // callee-saved
125 flags, // flags 125 flags, // flags
126 function->name); // debug name 126 function->name); // debug name
127 } 127 }
128 128
129 129
130 // TODO(turbofan): cache call descriptors for code stub calls. 130 // TODO(turbofan): cache call descriptors for code stub calls.
131 static CallDescriptor* GetStubCallDescriptor( 131 static CallDescriptor* GetStubCallDescriptor(
132 Zone* zone, CodeStubInterfaceDescriptor* descriptor, 132 Zone* zone, CallInterfaceDescriptor descriptor, int stack_parameter_count,
133 int stack_parameter_count, CallDescriptor::Flags flags) { 133 CallDescriptor::Flags flags) {
134 const int register_parameter_count = 134 const int register_parameter_count =
135 descriptor->GetEnvironmentParameterCount(); 135 descriptor.GetEnvironmentParameterCount();
136 const int js_parameter_count = 136 const int js_parameter_count =
137 register_parameter_count + stack_parameter_count; 137 register_parameter_count + stack_parameter_count;
138 const int context_count = 1; 138 const int context_count = 1;
139 const size_t return_count = 1; 139 const size_t return_count = 1;
140 const size_t parameter_count = 140 const size_t parameter_count =
141 static_cast<size_t>(js_parameter_count + context_count); 141 static_cast<size_t>(js_parameter_count + context_count);
142 142
143 LocationSignature::Builder locations(zone, return_count, parameter_count); 143 LocationSignature::Builder locations(zone, return_count, parameter_count);
144 MachineSignature::Builder types(zone, return_count, parameter_count); 144 MachineSignature::Builder types(zone, return_count, parameter_count);
145 145
146 // Add return location. 146 // Add return location.
147 AddReturnLocations(&locations); 147 AddReturnLocations(&locations);
148 types.AddReturn(kMachAnyTagged); 148 types.AddReturn(kMachAnyTagged);
149 149
150 // Add parameters in registers and on the stack. 150 // Add parameters in registers and on the stack.
151 for (int i = 0; i < js_parameter_count; i++) { 151 for (int i = 0; i < js_parameter_count; i++) {
152 if (i < register_parameter_count) { 152 if (i < register_parameter_count) {
153 // The first parameters go in registers. 153 // The first parameters go in registers.
154 Register reg = descriptor->GetEnvironmentParameterRegister(i); 154 Register reg = descriptor.GetEnvironmentParameterRegister(i);
155 locations.AddParam(regloc(reg)); 155 locations.AddParam(regloc(reg));
156 } else { 156 } else {
157 // The rest of the parameters go on the stack. 157 // The rest of the parameters go on the stack.
158 int stack_slot = i - register_parameter_count - stack_parameter_count; 158 int stack_slot = i - register_parameter_count - stack_parameter_count;
159 locations.AddParam(stackloc(stack_slot)); 159 locations.AddParam(stackloc(stack_slot));
160 } 160 }
161 types.AddParam(kMachAnyTagged); 161 types.AddParam(kMachAnyTagged);
162 } 162 }
163 // Add context. 163 // Add context.
164 locations.AddParam(regloc(LinkageTraits::ContextReg())); 164 locations.AddParam(regloc(LinkageTraits::ContextReg()));
165 types.AddParam(kMachAnyTagged); 165 types.AddParam(kMachAnyTagged);
166 166
167 // The target for stub calls is a code object. 167 // The target for stub calls is a code object.
168 MachineType target_type = kMachAnyTagged; 168 MachineType target_type = kMachAnyTagged;
169 LinkageLocation target_loc = LinkageLocation::AnyRegister(); 169 LinkageLocation target_loc = LinkageLocation::AnyRegister();
170 return new (zone) 170 return new (zone) CallDescriptor(CallDescriptor::kCallCodeObject, // kind
171 CallDescriptor(CallDescriptor::kCallCodeObject, // kind 171 target_type, // target MachineType
172 target_type, // target MachineType 172 target_loc, // target location
173 target_loc, // target location 173 types.Build(), // machine_sig
174 types.Build(), // machine_sig 174 locations.Build(), // location_sig
175 locations.Build(), // location_sig 175 js_parameter_count, // js_parameter_count
176 js_parameter_count, // js_parameter_count 176 Operator::kNoProperties, // properties
177 Operator::kNoProperties, // properties 177 kNoCalleeSaved, // callee-saved registers
178 kNoCalleeSaved, // callee-saved registers 178 flags, // flags
179 flags, // flags 179 descriptor.DebugName(zone->isolate()));
180 CodeStub::MajorName(descriptor->MajorKey(), false));
181 } 180 }
182 181
183 static CallDescriptor* GetSimplifiedCDescriptor(Zone* zone, 182 static CallDescriptor* GetSimplifiedCDescriptor(Zone* zone,
184 MachineSignature* msig) { 183 MachineSignature* msig) {
185 LocationSignature::Builder locations(zone, msig->return_count(), 184 LocationSignature::Builder locations(zone, msig->return_count(),
186 msig->parameter_count()); 185 msig->parameter_count());
187 // Add return location(s). 186 // Add return location(s).
188 AddReturnLocations(&locations); 187 AddReturnLocations(&locations);
189 188
190 // Add register and/or stack parameter(s). 189 // Add register and/or stack parameter(s).
(...skipping 27 matching lines...) Expand all
218 static LinkageLocation stackloc(int i) { 217 static LinkageLocation stackloc(int i) {
219 DCHECK_LT(i, 0); 218 DCHECK_LT(i, 0);
220 return LinkageLocation(i); 219 return LinkageLocation(i);
221 } 220 }
222 }; 221 };
223 } // namespace compiler 222 } // namespace compiler
224 } // namespace internal 223 } // namespace internal
225 } // namespace v8 224 } // namespace v8
226 225
227 #endif // V8_COMPILER_LINKAGE_IMPL_H_ 226 #endif // V8_COMPILER_LINKAGE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698