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 |
11 // Clients of this interface shouldn't depend on lots of compiler internals. | 11 // Clients of this interface shouldn't depend on lots of compiler internals. |
12 // Do not include anything from src/compiler here! | 12 // Do not include anything from src/compiler here! |
13 #include "src/allocation.h" | 13 #include "src/allocation.h" |
14 #include "src/builtins/builtins.h" | 14 #include "src/builtins/builtins.h" |
| 15 #include "src/code-factory.h" |
15 #include "src/globals.h" | 16 #include "src/globals.h" |
16 #include "src/heap/heap.h" | 17 #include "src/heap/heap.h" |
17 #include "src/machine-type.h" | 18 #include "src/machine-type.h" |
18 #include "src/runtime/runtime.h" | 19 #include "src/runtime/runtime.h" |
19 #include "src/zone/zone-containers.h" | 20 #include "src/zone/zone-containers.h" |
20 | 21 |
21 namespace v8 { | 22 namespace v8 { |
22 namespace internal { | 23 namespace internal { |
23 | 24 |
24 class Callable; | 25 class Callable; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 310 |
310 // A pair of a zero-based argument index and a value. | 311 // A pair of a zero-based argument index and a value. |
311 // It helps writing arguments order independent code. | 312 // It helps writing arguments order independent code. |
312 struct Arg { | 313 struct Arg { |
313 Arg(int index, Node* value) : index(index), value(value) {} | 314 Arg(int index, Node* value) : index(index), value(value) {} |
314 | 315 |
315 int const index; | 316 int const index; |
316 Node* const value; | 317 Node* const value; |
317 }; | 318 }; |
318 | 319 |
319 Node* CallStub(Callable const& callable, Node* context, Node* arg1, | 320 template <class... TArgs> |
320 size_t result_size = 1); | 321 Node* CallStub(Callable const& callable, Node* context, TArgs... args) { |
321 Node* CallStub(Callable const& callable, Node* context, Node* arg1, | 322 Node* target = HeapConstant(callable.code()); |
322 Node* arg2, size_t result_size = 1); | 323 return CallStub(callable.descriptor(), target, context, args...); |
323 Node* CallStub(Callable const& callable, Node* context, Node* arg1, | 324 } |
324 Node* arg2, Node* arg3, size_t result_size = 1); | |
325 Node* CallStub(Callable const& callable, Node* context, Node* arg1, | |
326 Node* arg2, Node* arg3, Node* arg4, size_t result_size = 1); | |
327 Node* CallStubN(Callable const& callable, Node** args, | |
328 size_t result_size = 1); | |
329 | 325 |
| 326 template <class... TArgs> |
330 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 327 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, |
331 Node* context, size_t result_size = 1); | 328 Node* context, TArgs... args) { |
332 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 329 return CallStubR(descriptor, 1, target, context, args...); |
333 Node* context, Node* arg1, size_t result_size = 1); | 330 } |
334 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 331 |
335 Node* context, Node* arg1, Node* arg2, size_t result_size = 1); | 332 template <class... TArgs> |
336 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 333 Node* CallStubR(const CallInterfaceDescriptor& descriptor, size_t result_size, |
337 Node* context, Node* arg1, Node* arg2, Node* arg3, | 334 Node* target, Node* context, TArgs... args); |
338 size_t result_size = 1); | 335 |
339 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 336 Node* CallStubN(const CallInterfaceDescriptor& descriptor, size_t result_size, |
340 Node* context, Node* arg1, Node* arg2, Node* arg3, Node* arg4, | 337 int input_count, Node* const* inputs); |
341 size_t result_size = 1); | |
342 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | |
343 Node* context, Node* arg1, Node* arg2, Node* arg3, Node* arg4, | |
344 Node* arg5, size_t result_size = 1); | |
345 | 338 |
346 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 339 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, |
347 Node* context, const Arg& arg1, const Arg& arg2, | 340 Node* context, const Arg& arg1, const Arg& arg2, |
348 size_t result_size = 1); | 341 size_t result_size = 1); |
349 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 342 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, |
350 Node* context, const Arg& arg1, const Arg& arg2, | 343 Node* context, const Arg& arg1, const Arg& arg2, |
351 const Arg& arg3, size_t result_size = 1); | 344 const Arg& arg3, size_t result_size = 1); |
352 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, | 345 Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, |
353 Node* context, const Arg& arg1, const Arg& arg2, | 346 Node* context, const Arg& arg1, const Arg& arg2, |
354 const Arg& arg3, const Arg& arg4, size_t result_size = 1); | 347 const Arg& arg3, const Arg& arg4, size_t result_size = 1); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 ZoneSet<CodeAssemblerVariable::Impl*> variables_; | 540 ZoneSet<CodeAssemblerVariable::Impl*> variables_; |
548 | 541 |
549 DISALLOW_COPY_AND_ASSIGN(CodeAssemblerState); | 542 DISALLOW_COPY_AND_ASSIGN(CodeAssemblerState); |
550 }; | 543 }; |
551 | 544 |
552 } // namespace compiler | 545 } // namespace compiler |
553 } // namespace internal | 546 } // namespace internal |
554 } // namespace v8 | 547 } // namespace v8 |
555 | 548 |
556 #endif // V8_COMPILER_CODE_ASSEMBLER_H_ | 549 #endif // V8_COMPILER_CODE_ASSEMBLER_H_ |
OLD | NEW |