Index: include/v8-ffi.h |
diff --git a/include/v8-ffi.h b/include/v8-ffi.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6cd1aedc7e42c9945f3fa535e709e33d675e368c |
--- /dev/null |
+++ b/include/v8-ffi.h |
@@ -0,0 +1,75 @@ |
+// Copyright 2016 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef V8_FFI_H_ |
+#define V8_FFI_H_ |
+ |
+#include "v8.h" // NOLINT(build/include) |
+ |
+namespace v8 { |
+ |
+class Function; |
+template <class T> |
+class Local; |
+class String; |
+ |
+namespace ffi { |
+ |
+enum class FFIType { |
+ kInt32, |
+ kInt64, |
+ kFloat32, |
+ kFloat64, |
+ kCharPtr, |
+ kTypedArray, |
+ kBufferNoCopy, |
+ kFunction, |
+ kStructPtr, |
+ kForeign, |
+ kRawJS |
+}; |
+ |
+struct FFISignature; |
+struct FFITypeElement; |
+ |
+struct FFIStructElement { |
+ const char* name; |
+ FFITypeElement* type; |
+}; |
+ |
+struct FFIStructSignature { |
+ size_t elem_count; |
+ FFIStructElement* elems; |
+}; |
+ |
+union FFISupplementalInfo { |
+ FFISignature* function_signature; |
+ FFIStructSignature* struct_elements; |
+}; |
+ |
+struct FFITypeElement { |
+ FFIType type; |
+ FFISupplementalInfo* info; // For specifying function type |
+}; |
+ |
+struct FFISignature { |
+ size_t return_count; |
+ size_t param_count; |
+ FFITypeElement* representations; |
+}; |
+ |
+struct NativeFunction { |
+ FFISignature* sig; |
+ uint8_t* start; |
+}; |
+ |
+Local<Function> CompileJSToNativeWrapper(Isolate* isolate, Local<String> name, |
+ NativeFunction func); |
+void* FFIFunctionBind(Isolate* isolate, NativeFunction func, Object* args); |
+void* BuildFFIArgumentSerializer(Isolate* isolate, NativeFunction func); |
+void* BuildFFIArgumentDeserializer(Isolate* isolate, NativeFunction func); |
+} // namespace ffi |
+} // namespace v8 |
+ |
+#endif // V8_FFI_H_ |