| OLD | NEW |
| 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/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
| 9 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
| 10 #include "src/compiler/scheduler.h" | 10 #include "src/compiler/scheduler.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 Node** buffer = zone()->NewArray<Node*>(input_count); | 193 Node** buffer = zone()->NewArray<Node*>(input_count); |
| 194 int index = 0; | 194 int index = 0; |
| 195 buffer[index++] = function; | 195 buffer[index++] = function; |
| 196 for (int i = 0; i < param_count; i++) { | 196 for (int i = 0; i < param_count; i++) { |
| 197 buffer[index++] = args[i]; | 197 buffer[index++] = args[i]; |
| 198 } | 198 } |
| 199 buffer[index++] = frame_state; | 199 buffer[index++] = frame_state; |
| 200 return AddNode(common()->Call(desc), input_count, buffer); | 200 return AddNode(common()->Call(desc), input_count, buffer); |
| 201 } | 201 } |
| 202 | 202 |
| 203 Node* RawMachineAssembler::CallRuntime0(Runtime::FunctionId function, | |
| 204 Node* context) { | |
| 205 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( | |
| 206 zone(), function, 0, Operator::kNoProperties, CallDescriptor::kNoFlags); | |
| 207 int return_count = static_cast<int>(descriptor->ReturnCount()); | |
| 208 | |
| 209 Node* centry = HeapConstant(CEntryStub(isolate(), return_count).GetCode()); | |
| 210 Node* ref = AddNode( | |
| 211 common()->ExternalConstant(ExternalReference(function, isolate()))); | |
| 212 Node* arity = Int32Constant(0); | |
| 213 | |
| 214 return AddNode(common()->Call(descriptor), centry, ref, arity, context); | |
| 215 } | |
| 216 | |
| 217 Node* RawMachineAssembler::CallRuntime1(Runtime::FunctionId function, | |
| 218 Node* arg1, Node* context) { | |
| 219 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( | |
| 220 zone(), function, 1, Operator::kNoProperties, CallDescriptor::kNoFlags); | |
| 221 int return_count = static_cast<int>(descriptor->ReturnCount()); | |
| 222 | |
| 223 Node* centry = HeapConstant(CEntryStub(isolate(), return_count).GetCode()); | |
| 224 Node* ref = AddNode( | |
| 225 common()->ExternalConstant(ExternalReference(function, isolate()))); | |
| 226 Node* arity = Int32Constant(1); | |
| 227 | |
| 228 return AddNode(common()->Call(descriptor), centry, arg1, ref, arity, context); | |
| 229 } | |
| 230 | |
| 231 | |
| 232 Node* RawMachineAssembler::CallRuntime2(Runtime::FunctionId function, | |
| 233 Node* arg1, Node* arg2, Node* context) { | |
| 234 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( | |
| 235 zone(), function, 2, Operator::kNoProperties, CallDescriptor::kNoFlags); | |
| 236 int return_count = static_cast<int>(descriptor->ReturnCount()); | |
| 237 | |
| 238 Node* centry = HeapConstant(CEntryStub(isolate(), return_count).GetCode()); | |
| 239 Node* ref = AddNode( | |
| 240 common()->ExternalConstant(ExternalReference(function, isolate()))); | |
| 241 Node* arity = Int32Constant(2); | |
| 242 | |
| 243 return AddNode(common()->Call(descriptor), centry, arg1, arg2, ref, arity, | |
| 244 context); | |
| 245 } | |
| 246 | |
| 247 Node* RawMachineAssembler::CallRuntime3(Runtime::FunctionId function, | |
| 248 Node* arg1, Node* arg2, Node* arg3, | |
| 249 Node* context) { | |
| 250 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( | |
| 251 zone(), function, 3, Operator::kNoProperties, CallDescriptor::kNoFlags); | |
| 252 int return_count = static_cast<int>(descriptor->ReturnCount()); | |
| 253 | |
| 254 Node* centry = HeapConstant(CEntryStub(isolate(), return_count).GetCode()); | |
| 255 Node* ref = AddNode( | |
| 256 common()->ExternalConstant(ExternalReference(function, isolate()))); | |
| 257 Node* arity = Int32Constant(3); | |
| 258 | |
| 259 return AddNode(common()->Call(descriptor), centry, arg1, arg2, arg3, ref, | |
| 260 arity, context); | |
| 261 } | |
| 262 | |
| 263 Node* RawMachineAssembler::CallRuntime4(Runtime::FunctionId function, | |
| 264 Node* arg1, Node* arg2, Node* arg3, | |
| 265 Node* arg4, Node* context) { | |
| 266 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( | |
| 267 zone(), function, 4, Operator::kNoProperties, CallDescriptor::kNoFlags); | |
| 268 int return_count = static_cast<int>(descriptor->ReturnCount()); | |
| 269 | |
| 270 Node* centry = HeapConstant(CEntryStub(isolate(), return_count).GetCode()); | |
| 271 Node* ref = AddNode( | |
| 272 common()->ExternalConstant(ExternalReference(function, isolate()))); | |
| 273 Node* arity = Int32Constant(4); | |
| 274 | |
| 275 return AddNode(common()->Call(descriptor), centry, arg1, arg2, arg3, arg4, | |
| 276 ref, arity, context); | |
| 277 } | |
| 278 | |
| 279 Node* RawMachineAssembler::CallRuntime5(Runtime::FunctionId function, | |
| 280 Node* arg1, Node* arg2, Node* arg3, | |
| 281 Node* arg4, Node* arg5, Node* context) { | |
| 282 CallDescriptor* descriptor = Linkage::GetRuntimeCallDescriptor( | |
| 283 zone(), function, 5, Operator::kNoProperties, CallDescriptor::kNoFlags); | |
| 284 int return_count = static_cast<int>(descriptor->ReturnCount()); | |
| 285 | |
| 286 Node* centry = HeapConstant(CEntryStub(isolate(), return_count).GetCode()); | |
| 287 Node* ref = AddNode( | |
| 288 common()->ExternalConstant(ExternalReference(function, isolate()))); | |
| 289 Node* arity = Int32Constant(5); | |
| 290 | |
| 291 return AddNode(common()->Call(descriptor), centry, arg1, arg2, arg3, arg4, | |
| 292 arg5, ref, arity, context); | |
| 293 } | |
| 294 | |
| 295 Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function, | 203 Node* RawMachineAssembler::TailCallN(CallDescriptor* desc, Node* function, |
| 296 Node** args) { | 204 Node** args) { |
| 297 int param_count = static_cast<int>(desc->ParameterCount()); | 205 int param_count = static_cast<int>(desc->ParameterCount()); |
| 298 int input_count = param_count + 1; | 206 int input_count = param_count + 1; |
| 299 Node** buffer = zone()->NewArray<Node*>(input_count); | 207 Node** buffer = zone()->NewArray<Node*>(input_count); |
| 300 int index = 0; | 208 int index = 0; |
| 301 buffer[index++] = function; | 209 buffer[index++] = function; |
| 302 for (int i = 0; i < param_count; i++) { | 210 for (int i = 0; i < param_count; i++) { |
| 303 buffer[index++] = args[i]; | 211 buffer[index++] = args[i]; |
| 304 } | 212 } |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 // The raw machine assembler nodes do not have effect and control inputs, | 490 // The raw machine assembler nodes do not have effect and control inputs, |
| 583 // so we disable checking input counts here. | 491 // so we disable checking input counts here. |
| 584 return graph()->NewNodeUnchecked(op, input_count, inputs); | 492 return graph()->NewNodeUnchecked(op, input_count, inputs); |
| 585 } | 493 } |
| 586 | 494 |
| 587 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } | 495 RawMachineLabel::~RawMachineLabel() { DCHECK(bound_ || !used_); } |
| 588 | 496 |
| 589 } // namespace compiler | 497 } // namespace compiler |
| 590 } // namespace internal | 498 } // namespace internal |
| 591 } // namespace v8 | 499 } // namespace v8 |
| OLD | NEW |