OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8_BUILTINS_BUILTINS_UTILS_GEN_H_ |
| 6 #define V8_BUILTINS_BUILTINS_UTILS_GEN_H_ |
| 7 |
| 8 namespace v8 { |
| 9 namespace internal { |
| 10 |
| 11 namespace compiler { |
| 12 class CodeAssemblerState; |
| 13 } // namespace compiler |
| 14 |
| 15 // ---------------------------------------------------------------------------- |
| 16 // Support macro for defining builtins with Turbofan. |
| 17 // ---------------------------------------------------------------------------- |
| 18 // |
| 19 // A builtin function is defined by writing: |
| 20 // |
| 21 // TF_BUILTIN(name, code_assember_base_class) { |
| 22 // ... |
| 23 // } |
| 24 // |
| 25 // In the body of the builtin function the arguments can be accessed |
| 26 // as "Parameter(n)". |
| 27 #define TF_BUILTIN(Name, AssemblerBase) \ |
| 28 class Name##Assembler : public AssemblerBase { \ |
| 29 public: \ |
| 30 explicit Name##Assembler(compiler::CodeAssemblerState* state) \ |
| 31 : AssemblerBase(state) {} \ |
| 32 void Generate##Name##Impl(); \ |
| 33 }; \ |
| 34 void Builtins::Generate_##Name(compiler::CodeAssemblerState* state) { \ |
| 35 Name##Assembler assembler(state); \ |
| 36 assembler.Generate##Name##Impl(); \ |
| 37 } \ |
| 38 void Name##Assembler::Generate##Name##Impl() |
| 39 |
| 40 } // namespace internal |
| 41 } // namespace v8 |
| 42 |
| 43 #endif // V8_BUILTINS_BUILTINS_UTILS_GEN_H_ |
OLD | NEW |