Index: src/builtins/builtins-utils.h |
diff --git a/src/builtins/builtins-utils.h b/src/builtins/builtins-utils.h |
index 6378fdfad5d3413b8d826ae5bb6ccde2e9b05955..80e0d29f17ec42303a0ef0c7185546be09d17b4f 100644 |
--- a/src/builtins/builtins-utils.h |
+++ b/src/builtins/builtins-utils.h |
@@ -102,6 +102,31 @@ class BuiltinArguments : public Arguments { |
Isolate* isolate) |
// ---------------------------------------------------------------------------- |
+// Support macro for defining builtins with Turbofan. |
+// ---------------------------------------------------------------------------- |
+// |
+// A builtin function is defined by writing: |
+// |
+// TF_BUILTIN(name, code_assember_base_class) { |
+// ... |
+// } |
+// |
+// In the body of the builtin function the arguments can be accessed |
+// as "Parameter(n)". |
+#define TF_BUILTIN(Name, AssemblerBase) \ |
+ class Name##Assembler : public AssemblerBase { \ |
+ public: \ |
+ explicit Name##Assembler(compiler::CodeAssemblerState* state) \ |
+ : AssemblerBase(state) {} \ |
+ void Generate##Name(); \ |
+ }; \ |
+ void Builtins::Generate_##Name(compiler::CodeAssemblerState* state) { \ |
+ Name##Assembler assembler(state); \ |
+ assembler.Generate##Name(); \ |
+ } \ |
+ void Name##Assembler::Generate##Name() |
+ |
+// ---------------------------------------------------------------------------- |
#define CHECK_RECEIVER(Type, name, method) \ |
if (!args.receiver()->Is##Type()) { \ |