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

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: Created 5 years, 5 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
147 void RawMachineAssembler::Bind(Label* label) { 193 void RawMachineAssembler::Bind(Label* label) {
148 DCHECK(current_block_ == NULL); 194 DCHECK(current_block_ == NULL);
149 DCHECK(!label->bound_); 195 DCHECK(!label->bound_);
150 label->bound_ = true; 196 label->bound_ = true;
151 current_block_ = EnsureBlock(label); 197 current_block_ = EnsureBlock(label);
152 } 198 }
153 199
154 200
155 BasicBlock* RawMachineAssembler::Use(Label* label) { 201 BasicBlock* RawMachineAssembler::Use(Label* label) {
156 label->used_ = true; 202 label->used_ = true;
(...skipping 22 matching lines...) Expand all
179 : CurrentBlock(); 225 : CurrentBlock();
180 if (op->opcode() != IrOpcode::kReturn) { 226 if (op->opcode() != IrOpcode::kReturn) {
181 schedule()->AddNode(block, node); 227 schedule()->AddNode(block, node);
182 } 228 }
183 return node; 229 return node;
184 } 230 }
185 231
186 } // namespace compiler 232 } // namespace compiler
187 } // namespace internal 233 } // namespace internal
188 } // namespace v8 234 } // 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