Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: include/v8-ffi.h

Issue 2250863002: WIP: prototype ffi support (from 2084663004) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | src/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « BUILD.gn ('k') | src/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698