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

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

Issue 456333002: Move MachineRepresentation to machine-type.h and rename to MachineType in preparation for merging i… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/linkage.cc ('k') | src/compiler/machine-node-factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
11 11
12 class LinkageHelper { 12 class LinkageHelper {
13 public: 13 public:
14 static LinkageLocation TaggedStackSlot(int index) { 14 static LinkageLocation TaggedStackSlot(int index) {
15 DCHECK(index < 0); 15 DCHECK(index < 0);
16 return LinkageLocation(kMachineTagged, index); 16 return LinkageLocation(kMachineTagged, index);
17 } 17 }
18 18
19 static LinkageLocation TaggedRegisterLocation(Register reg) { 19 static LinkageLocation TaggedRegisterLocation(Register reg) {
20 return LinkageLocation(kMachineTagged, Register::ToAllocationIndex(reg)); 20 return LinkageLocation(kMachineTagged, Register::ToAllocationIndex(reg));
21 } 21 }
22 22
23 static inline LinkageLocation WordRegisterLocation(Register reg) { 23 static inline LinkageLocation WordRegisterLocation(Register reg) {
24 return LinkageLocation(MachineOperatorBuilder::pointer_rep(), 24 return LinkageLocation(MachineOperatorBuilder::pointer_rep(),
25 Register::ToAllocationIndex(reg)); 25 Register::ToAllocationIndex(reg));
26 } 26 }
27 27
28 static LinkageLocation UnconstrainedRegister(MachineRepresentation rep) { 28 static LinkageLocation UnconstrainedRegister(MachineType rep) {
29 return LinkageLocation(rep, LinkageLocation::ANY_REGISTER); 29 return LinkageLocation(rep, LinkageLocation::ANY_REGISTER);
30 } 30 }
31 31
32 static const RegList kNoCalleeSaved = 0; 32 static const RegList kNoCalleeSaved = 0;
33 33
34 // TODO(turbofan): cache call descriptors for JSFunction calls. 34 // TODO(turbofan): cache call descriptors for JSFunction calls.
35 template <typename LinkageTraits> 35 template <typename LinkageTraits>
36 static CallDescriptor* GetJSCallDescriptor(Zone* zone, int parameter_count) { 36 static CallDescriptor* GetJSCallDescriptor(Zone* zone, int parameter_count) {
37 const int jsfunction_count = 1; 37 const int jsfunction_count = 1;
38 const int context_count = 1; 38 const int context_count = 1;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 locations, // locations 166 locations, // locations
167 Operator::kNoProperties, // properties 167 Operator::kNoProperties, // properties
168 kNoCalleeSaved, // callee-saved registers 168 kNoCalleeSaved, // callee-saved registers
169 can_deoptimize, // deoptimization 169 can_deoptimize, // deoptimization
170 CodeStub::MajorName(descriptor->MajorKey(), false)); 170 CodeStub::MajorName(descriptor->MajorKey(), false));
171 } 171 }
172 172
173 173
174 template <typename LinkageTraits> 174 template <typename LinkageTraits>
175 static CallDescriptor* GetSimplifiedCDescriptor( 175 static CallDescriptor* GetSimplifiedCDescriptor(
176 Zone* zone, int num_params, MachineRepresentation return_type, 176 Zone* zone, int num_params, MachineType return_type,
177 const MachineRepresentation* param_types) { 177 const MachineType* param_types) {
178 LinkageLocation* locations = 178 LinkageLocation* locations =
179 zone->NewArray<LinkageLocation>(num_params + 2); 179 zone->NewArray<LinkageLocation>(num_params + 2);
180 int index = 0; 180 int index = 0;
181 locations[index++] = 181 locations[index++] =
182 TaggedRegisterLocation(LinkageTraits::ReturnValueReg()); 182 TaggedRegisterLocation(LinkageTraits::ReturnValueReg());
183 locations[index++] = LinkageHelper::UnconstrainedRegister( 183 locations[index++] = LinkageHelper::UnconstrainedRegister(
184 MachineOperatorBuilder::pointer_rep()); 184 MachineOperatorBuilder::pointer_rep());
185 // TODO(dcarney): test with lots of parameters. 185 // TODO(dcarney): test with lots of parameters.
186 int i = 0; 186 int i = 0;
187 for (; i < LinkageTraits::CRegisterParametersLength() && i < num_params; 187 for (; i < LinkageTraits::CRegisterParametersLength() && i < num_params;
188 i++) { 188 i++) {
189 locations[index++] = LinkageLocation( 189 locations[index++] = LinkageLocation(
190 param_types[i], 190 param_types[i],
191 Register::ToAllocationIndex(LinkageTraits::CRegisterParameter(i))); 191 Register::ToAllocationIndex(LinkageTraits::CRegisterParameter(i)));
192 } 192 }
193 for (; i < num_params; i++) { 193 for (; i < num_params; i++) {
194 locations[index++] = LinkageLocation(param_types[i], -1 - i); 194 locations[index++] = LinkageLocation(param_types[i], -1 - i);
195 } 195 }
196 return new (zone) CallDescriptor( 196 return new (zone) CallDescriptor(
197 CallDescriptor::kCallAddress, 1, num_params, num_params + 1, locations, 197 CallDescriptor::kCallAddress, 1, num_params, num_params + 1, locations,
198 Operator::kNoProperties, LinkageTraits::CCalleeSaveRegisters(), 198 Operator::kNoProperties, LinkageTraits::CCalleeSaveRegisters(),
199 CallDescriptor::kCannotDeoptimize); // TODO(jarin) should deoptimize! 199 CallDescriptor::kCannotDeoptimize); // TODO(jarin) should deoptimize!
200 } 200 }
201 }; 201 };
202 } 202 }
203 } 203 }
204 } // namespace v8::internal::compiler 204 } // namespace v8::internal::compiler
205 205
206 #endif // V8_COMPILER_LINKAGE_IMPL_H_ 206 #endif // V8_COMPILER_LINKAGE_IMPL_H_
OLDNEW
« no previous file with comments | « src/compiler/linkage.cc ('k') | src/compiler/machine-node-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698