| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_CODE_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_CODE_ASSEMBLER_H_ |
| 6 #define V8_COMPILER_CODE_ASSEMBLER_H_ | 6 #define V8_COMPILER_CODE_ASSEMBLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 Node* Projection(int index, Node* value); | 301 Node* Projection(int index, Node* value); |
| 302 | 302 |
| 303 // Calls | 303 // Calls |
| 304 template <class... TArgs> | 304 template <class... TArgs> |
| 305 Node* CallRuntime(Runtime::FunctionId function, Node* context, TArgs... args); | 305 Node* CallRuntime(Runtime::FunctionId function, Node* context, TArgs... args); |
| 306 | 306 |
| 307 template <class... TArgs> | 307 template <class... TArgs> |
| 308 Node* TailCallRuntime(Runtime::FunctionId function, Node* context, | 308 Node* TailCallRuntime(Runtime::FunctionId function, Node* context, |
| 309 TArgs... args); | 309 TArgs... args); |
| 310 | 310 |
| 311 // A pair of a zero-based argument index and a value. | |
| 312 // It helps writing arguments order independent code. | |
| 313 struct Arg { | |
| 314 Arg(int index, Node* value) : index(index), value(value) {} | |
| 315 | |
| 316 int const index; | |
| 317 Node* const value; | |
| 318 }; | |
| 319 | |
| 320 template <class... TArgs> | 311 template <class... TArgs> |
| 321 Node* CallStub(Callable const& callable, Node* context, TArgs... args) { | 312 Node* CallStub(Callable const& callable, Node* context, TArgs... args) { |
| 322 Node* target = HeapConstant(callable.code()); | 313 Node* target = HeapConstant(callable.code()); |
| 323 return CallStub(callable.descriptor(), target, context, args...); | 314 return CallStub(callable.descriptor(), target, context, args...); |
| 324 } | 315 } |
| 325 | 316 |
| 326 template <class... TArgs> | 317 template <class... TArgs> |
| 327 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 318 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, |
| 328 Node* context, TArgs... args) { | 319 Node* context, TArgs... args) { |
| 329 return CallStubR(descriptor, 1, target, context, args...); | 320 return CallStubR(descriptor, 1, target, context, args...); |
| 330 } | 321 } |
| 331 | 322 |
| 332 template <class... TArgs> | 323 template <class... TArgs> |
| 333 Node* CallStubR(const CallInterfaceDescriptor& descriptor, size_t result_size, | 324 Node* CallStubR(const CallInterfaceDescriptor& descriptor, size_t result_size, |
| 334 Node* target, Node* context, TArgs... args); | 325 Node* target, Node* context, TArgs... args); |
| 335 | 326 |
| 336 Node* CallStubN(const CallInterfaceDescriptor& descriptor, size_t result_size, | 327 Node* CallStubN(const CallInterfaceDescriptor& descriptor, size_t result_size, |
| 337 int input_count, Node* const* inputs); | 328 int input_count, Node* const* inputs); |
| 338 | 329 |
| 339 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | |
| 340 Node* context, const Arg& arg1, const Arg& arg2, | |
| 341 size_t result_size = 1); | |
| 342 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | |
| 343 Node* context, const Arg& arg1, const Arg& arg2, | |
| 344 const Arg& arg3, size_t result_size = 1); | |
| 345 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | |
| 346 Node* context, const Arg& arg1, const Arg& arg2, | |
| 347 const Arg& arg3, const Arg& arg4, size_t result_size = 1); | |
| 348 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | |
| 349 Node* context, const Arg& arg1, const Arg& arg2, | |
| 350 const Arg& arg3, const Arg& arg4, const Arg& arg5, | |
| 351 size_t result_size = 1); | |
| 352 | |
| 353 Node* CallStubN(const CallInterfaceDescriptor& descriptor, | 330 Node* CallStubN(const CallInterfaceDescriptor& descriptor, |
| 354 int js_parameter_count, Node* target, Node** args, | 331 int js_parameter_count, Node* target, Node** args, |
| 355 size_t result_size = 1); | 332 size_t result_size = 1); |
| 356 Node* CallStubN(const CallInterfaceDescriptor& descriptor, Node* target, | 333 Node* CallStubN(const CallInterfaceDescriptor& descriptor, Node* target, |
| 357 Node** args, size_t result_size = 1) { | 334 Node** args, size_t result_size = 1) { |
| 358 return CallStubN(descriptor, 0, target, args, result_size); | 335 return CallStubN(descriptor, 0, target, args, result_size); |
| 359 } | 336 } |
| 360 | 337 |
| 361 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1, | 338 Node* TailCallStub(Callable const& callable, Node* context, Node* arg1, |
| 362 size_t result_size = 1); | 339 size_t result_size = 1); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 383 Node* context, Node* arg1, Node* arg2, Node* arg3, | 360 Node* context, Node* arg1, Node* arg2, Node* arg3, |
| 384 Node* arg4, size_t result_size = 1); | 361 Node* arg4, size_t result_size = 1); |
| 385 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 362 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target, |
| 386 Node* context, Node* arg1, Node* arg2, Node* arg3, | 363 Node* context, Node* arg1, Node* arg2, Node* arg3, |
| 387 Node* arg4, Node* arg5, size_t result_size = 1); | 364 Node* arg4, Node* arg5, size_t result_size = 1); |
| 388 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 365 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target, |
| 389 Node* context, Node* arg1, Node* arg2, Node* arg3, | 366 Node* context, Node* arg1, Node* arg2, Node* arg3, |
| 390 Node* arg4, Node* arg5, Node* arg6, | 367 Node* arg4, Node* arg5, Node* arg6, |
| 391 size_t result_size = 1); | 368 size_t result_size = 1); |
| 392 | 369 |
| 393 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target, | |
| 394 Node* context, const Arg& arg1, const Arg& arg2, | |
| 395 const Arg& arg3, const Arg& arg4, size_t result_size = 1); | |
| 396 Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target, | |
| 397 Node* context, const Arg& arg1, const Arg& arg2, | |
| 398 const Arg& arg3, const Arg& arg4, const Arg& arg5, | |
| 399 size_t result_size = 1); | |
| 400 | |
| 401 Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor, | 370 Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor, |
| 402 Node* code_target_address, Node** args); | 371 Node* code_target_address, Node** args); |
| 403 | 372 |
| 404 Node* CallJS(Callable const& callable, Node* context, Node* function, | 373 Node* CallJS(Callable const& callable, Node* context, Node* function, |
| 405 Node* receiver, size_t result_size = 1); | 374 Node* receiver, size_t result_size = 1); |
| 406 Node* CallJS(Callable const& callable, Node* context, Node* function, | 375 Node* CallJS(Callable const& callable, Node* context, Node* function, |
| 407 Node* receiver, Node* arg1, size_t result_size = 1); | 376 Node* receiver, Node* arg1, size_t result_size = 1); |
| 408 Node* CallJS(Callable const& callable, Node* context, Node* function, | 377 Node* CallJS(Callable const& callable, Node* context, Node* function, |
| 409 Node* receiver, Node* arg1, Node* arg2, size_t result_size = 1); | 378 Node* receiver, Node* arg1, Node* arg2, size_t result_size = 1); |
| 410 Node* CallJS(Callable const& callable, Node* context, Node* function, | 379 Node* CallJS(Callable const& callable, Node* context, Node* function, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 ZoneSet<CodeAssemblerVariable::Impl*> variables_; | 509 ZoneSet<CodeAssemblerVariable::Impl*> variables_; |
| 541 | 510 |
| 542 DISALLOW_COPY_AND_ASSIGN(CodeAssemblerState); | 511 DISALLOW_COPY_AND_ASSIGN(CodeAssemblerState); |
| 543 }; | 512 }; |
| 544 | 513 |
| 545 } // namespace compiler | 514 } // namespace compiler |
| 546 } // namespace internal | 515 } // namespace internal |
| 547 } // namespace v8 | 516 } // namespace v8 |
| 548 | 517 |
| 549 #endif // V8_COMPILER_CODE_ASSEMBLER_H_ | 518 #endif // V8_COMPILER_CODE_ASSEMBLER_H_ |
| OLD | NEW |