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

Side by Side Diff: test/unittests/compiler/raw-machine-assembler.cc

Issue 1205023002: [turbofan] Add basic support for calling to (a subset of) C functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix argument slots. Created 5 years, 6 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
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 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compiler/pipeline.h" 6 #include "src/compiler/pipeline.h"
7 #include "src/compiler/scheduler.h" 7 #include "src/compiler/scheduler.h"
8 #include "test/unittests/compiler/raw-machine-assembler.h" 8 #include "test/unittests/compiler/raw-machine-assembler.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 common()->ExternalConstant(ExternalReference(function, isolate()))); 137 common()->ExternalConstant(ExternalReference(function, isolate())));
138 Node* arity = Int32Constant(1); 138 Node* arity = Int32Constant(1);
139 139
140 Node* call = graph()->NewNode(common()->Call(descriptor), centry, arg0, ref, 140 Node* call = graph()->NewNode(common()->Call(descriptor), centry, arg0, ref,
141 arity, context, frame_state); 141 arity, context, frame_state);
142 schedule()->AddNode(CurrentBlock(), call); 142 schedule()->AddNode(CurrentBlock(), call);
143 return call; 143 return call;
144 } 144 }
145 145
146 146
147 Node* RawMachineAssembler::CallCFunction0(MachineType return_type,
148 Node* function) {
149 MachineSignature::Builder builder(zone(), 1, 0);
150 builder.AddReturn(return_type);
151 const CallDescriptor* descriptor =
152 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
153
154 Node* call = graph()->NewNode(common()->Call(descriptor), function);
155 schedule()->AddNode(CurrentBlock(), call);
156 return call;
157 }
158
159
160 Node* RawMachineAssembler::CallCFunction1(MachineType return_type,
161 MachineType arg0_type, Node* function,
162 Node* arg0) {
163 MachineSignature::Builder builder(zone(), 1, 1);
164 builder.AddReturn(return_type);
165 builder.AddParam(arg0_type);
166 const CallDescriptor* descriptor =
167 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
168
169 Node* call = graph()->NewNode(common()->Call(descriptor), function, arg0);
170 schedule()->AddNode(CurrentBlock(), call);
171 return call;
172 }
173
174
175 Node* RawMachineAssembler::CallCFunction2(MachineType return_type,
176 MachineType arg0_type,
177 MachineType arg1_type, Node* function,
178 Node* arg0, Node* arg1) {
179 MachineSignature::Builder builder(zone(), 1, 2);
180 builder.AddReturn(return_type);
181 builder.AddParam(arg0_type);
182 builder.AddParam(arg1_type);
183 const CallDescriptor* descriptor =
184 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
185
186 Node* call =
187 graph()->NewNode(common()->Call(descriptor), function, arg0, arg1);
188 schedule()->AddNode(CurrentBlock(), call);
189 return call;
190 }
191
192
193 Node* RawMachineAssembler::CallCFunction8(
194 MachineType return_type, MachineType arg0_type, MachineType arg1_type,
195 MachineType arg2_type, MachineType arg3_type, MachineType arg4_type,
196 MachineType arg5_type, MachineType arg6_type, MachineType arg7_type,
197 Node* function, Node* arg0, Node* arg1, Node* arg2, Node* arg3, Node* arg4,
198 Node* arg5, Node* arg6, Node* arg7) {
199 MachineSignature::Builder builder(zone(), 1, 8);
200 builder.AddReturn(return_type);
201 builder.AddParam(arg0_type);
202 builder.AddParam(arg1_type);
203 builder.AddParam(arg2_type);
204 builder.AddParam(arg3_type);
205 builder.AddParam(arg4_type);
206 builder.AddParam(arg5_type);
207 builder.AddParam(arg6_type);
208 builder.AddParam(arg7_type);
209 const CallDescriptor* descriptor =
210 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
211
212 Node* call = graph()->NewNode(common()->Call(descriptor), function, arg0,
213 arg1, arg2, arg3, arg4, arg5, arg6, arg7);
214 schedule()->AddNode(CurrentBlock(), call);
215 return call;
216 }
217
218
147 void RawMachineAssembler::Bind(Label* label) { 219 void RawMachineAssembler::Bind(Label* label) {
148 DCHECK(current_block_ == NULL); 220 DCHECK(current_block_ == NULL);
149 DCHECK(!label->bound_); 221 DCHECK(!label->bound_);
150 label->bound_ = true; 222 label->bound_ = true;
151 current_block_ = EnsureBlock(label); 223 current_block_ = EnsureBlock(label);
152 } 224 }
153 225
154 226
155 BasicBlock* RawMachineAssembler::Use(Label* label) { 227 BasicBlock* RawMachineAssembler::Use(Label* label) {
156 label->used_ = true; 228 label->used_ = true;
(...skipping 22 matching lines...) Expand all
179 : CurrentBlock(); 251 : CurrentBlock();
180 if (op->opcode() != IrOpcode::kReturn) { 252 if (op->opcode() != IrOpcode::kReturn) {
181 schedule()->AddNode(block, node); 253 schedule()->AddNode(block, node);
182 } 254 }
183 return node; 255 return node;
184 } 256 }
185 257
186 } // namespace compiler 258 } // namespace compiler
187 } // namespace internal 259 } // namespace internal
188 } // namespace v8 260 } // namespace v8
OLDNEW
« test/cctest/compiler/test-run-machops.cc ('K') | « test/unittests/compiler/raw-machine-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698