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

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

Issue 1475953002: [stubs] A new approach to TF stubs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Win64 build Created 5 years 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
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/heap/heap.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 #include "src/compiler/raw-machine-assembler.h" 5 #include "src/compiler/raw-machine-assembler.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/pipeline.h" 8 #include "src/compiler/pipeline.h"
9 #include "src/compiler/scheduler.h" 9 #include "src/compiler/scheduler.h"
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 for (int i = 0; i < param_count; i++) { 145 for (int i = 0; i < param_count; i++) {
146 buffer[index++] = args[i]; 146 buffer[index++] = args[i];
147 } 147 }
148 buffer[index++] = frame_state; 148 buffer[index++] = frame_state;
149 buffer[index++] = graph()->start(); 149 buffer[index++] = graph()->start();
150 buffer[index++] = graph()->start(); 150 buffer[index++] = graph()->start();
151 return AddNode(common()->Call(desc), input_count, buffer); 151 return AddNode(common()->Call(desc), input_count, buffer);
152 } 152 }
153 153
154 154
155 Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function,
156 Node** args) {
157 int param_count =
158 static_cast<int>(desc->GetMachineSignature()->parameter_count());
159 int input_count = param_count + 3;
160 Node** buffer = zone()->NewArray<Node*>(input_count);
161 int index = 0;
162 buffer[index++] = function;
163 for (int i = 0; i < param_count; i++) {
164 buffer[index++] = args[i];
165 }
166 buffer[index++] = graph()->start();
167 buffer[index++] = graph()->start();
168 Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer);
169 schedule()->AddTailCall(CurrentBlock(), tail_call);
170 current_block_ = nullptr;
171 return tail_call;
172 }
173
174
175 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, 155 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function,
176 Node* arg1, Node* context) { 156 Node* arg1, Node* context) {
177 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( 157 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor(
178 zone(), function, 1, Operator::kNoProperties, false); 158 zone(), function, 1, Operator::kNoProperties, CallDescriptor::kNoFlags);
179 159
180 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); 160 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
181 Node* ref = AddNode( 161 Node* ref = AddNode(
182 common()->ExternalConstant(ExternalReference(function, isolate()))); 162 common()->ExternalConstant(ExternalReference(function, isolate())));
183 Node* arity = Int32Constant(1); 163 Node* arity = Int32Constant(1);
184 164
185 return AddNode(common()->Call(descriptor), centry, arg1, ref, arity, context, 165 return AddNode(common()->Call(descriptor), centry, arg1, ref, arity, context,
186 graph()->start(), graph()->start()); 166 graph()->start(), graph()->start());
187 } 167 }
188 168
189 169
190 Node* RawMachineAssembler::CallRuntime2(Runtime::FunctionId function, 170 Node* RawMachineAssembler::CallRuntime2(Runtime::FunctionId function,
191 Node* arg1, Node* arg2, Node* context) { 171 Node* arg1, Node* arg2, Node* context) {
192 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( 172 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor(
193 zone(), function, 2, Operator::kNoProperties, false); 173 zone(), function, 2, Operator::kNoProperties, CallDescriptor::kNoFlags);
194 174
195 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); 175 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
196 Node* ref = AddNode( 176 Node* ref = AddNode(
197 common()->ExternalConstant(ExternalReference(function, isolate()))); 177 common()->ExternalConstant(ExternalReference(function, isolate())));
198 Node* arity = Int32Constant(2); 178 Node* arity = Int32Constant(2);
199 179
200 return AddNode(common()->Call(descriptor), centry, arg1, arg2, ref, arity, 180 return AddNode(common()->Call(descriptor), centry, arg1, arg2, ref, arity,
201 context, graph()->start(), graph()->start()); 181 context, graph()->start(), graph()->start());
202 } 182 }
203 183
204 184
205 Node* RawMachineAssembler::CallRuntime4(Runtime::FunctionId function, 185 Node* RawMachineAssembler::CallRuntime4(Runtime::FunctionId function,
206 Node* arg1, Node* arg2, Node* arg3, 186 Node* arg1, Node* arg2, Node* arg3,
207 Node* arg4, Node* context) { 187 Node* arg4, Node* context) {
208 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( 188 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor(
209 zone(), function, 4, Operator::kNoProperties, false); 189 zone(), function, 4, Operator::kNoProperties, CallDescriptor::kNoFlags);
210 190
211 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode()); 191 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
212 Node* ref = AddNode( 192 Node* ref = AddNode(
213 common()->ExternalConstant(ExternalReference(function, isolate()))); 193 common()->ExternalConstant(ExternalReference(function, isolate())));
214 Node* arity = Int32Constant(4); 194 Node* arity = Int32Constant(4);
215 195
216 return AddNode(common()->Call(descriptor), centry, arg1, arg2, arg3, arg4, 196 return AddNode(common()->Call(descriptor), centry, arg1, arg2, arg3, arg4,
217 ref, arity, context, graph()->start(), graph()->start()); 197 ref, arity, context, graph()->start(), graph()->start());
218 } 198 }
219 199
220 200
201 Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function,
202 Node** args) {
203 int param_count =
204 static_cast<int>(desc->GetMachineSignature()->parameter_count());
205 int input_count = param_count + 3;
206 Node** buffer = zone()->NewArray<Node*>(input_count);
207 int index = 0;
208 buffer[index++] = function;
209 for (int i = 0; i < param_count; i++) {
210 buffer[index++] = args[i];
211 }
212 buffer[index++] = graph()->start();
213 buffer[index++] = graph()->start();
214 Node* tail_call = MakeNode(common()->TailCall(desc), input_count, buffer);
215 schedule()->AddTailCall(CurrentBlock(), tail_call);
216 current_block_ = nullptr;
217 return tail_call;
218 }
219
220
221 Node* RawMachineAssembler::TailCallRuntime1(Runtime::FunctionId function,
222 Node* arg1, Node* context) {
223 const int kArity = 1;
224 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(
225 zone(), function, kArity, Operator::kNoProperties,
226 CallDescriptor::kSupportsTailCalls);
227
228 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
229 Node* ref = AddNode(
230 common()->ExternalConstant(ExternalReference(function, isolate())));
231 Node* arity = Int32Constant(kArity);
232
233 Node* nodes[] = {centry, arg1, ref, arity, context, graph()->start(),
234 graph()->start()};
235 Node* tail_call = MakeNode(common()->TailCall(desc), arraysize(nodes), nodes);
236
237 schedule()->AddTailCall(CurrentBlock(), tail_call);
238 current_block_ = nullptr;
239 return tail_call;
240 }
241
242
243 Node* RawMachineAssembler::TailCallRuntime2(Runtime::FunctionId function,
244 Node* arg1, Node* arg2,
245 Node* context) {
246 const int kArity = 2;
247 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(
248 zone(), function, kArity, Operator::kNoProperties,
249 CallDescriptor::kSupportsTailCalls);
250
251 Node* centry = HeapConstant(CEntryStub(isolate(), 1).GetCode());
252 Node* ref = AddNode(
253 common()->ExternalConstant(ExternalReference(function, isolate())));
254 Node* arity = Int32Constant(kArity);
255
256 Node* nodes[] = {
257 centry, arg1, arg2, ref, arity, context, graph()->start(),
258 graph()->start()};
259 Node* tail_call = MakeNode(common()->TailCall(desc), arraysize(nodes), nodes);
260
261 schedule()->AddTailCall(CurrentBlock(), tail_call);
262 current_block_ = nullptr;
263 return tail_call;
264 }
265
266
221 Node* RawMachineAssembler::CallCFunction0(MachineType return_type, 267 Node* RawMachineAssembler::CallCFunction0(MachineType return_type,
222 Node* function) { 268 Node* function) {
223 MachineSignature::Builder builder(zone(), 1, 0); 269 MachineSignature::Builder builder(zone(), 1, 0);
224 builder.AddReturn(return_type); 270 builder.AddReturn(return_type);
225 const CallDescriptor* descriptor = 271 const CallDescriptor* descriptor =
226 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build()); 272 Linkage::GetSimplifiedCDescriptor(zone(), builder.Build());
227 273
228 return AddNode(common()->Call(descriptor), function, graph()->start(), 274 return AddNode(common()->Call(descriptor), function, graph()->start(),
229 graph()->start()); 275 graph()->start());
230 } 276 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 385
340 RawMachineLabel::RawMachineLabel() 386 RawMachineLabel::RawMachineLabel()
341 : block_(NULL), used_(false), bound_(false) {} 387 : block_(NULL), used_(false), bound_(false) {}
342 388
343 389
344 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } 390 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); }
345 391
346 } // namespace compiler 392 } // namespace compiler
347 } // namespace internal 393 } // namespace internal
348 } // namespace v8 394 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/raw-machine-assembler.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698