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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | src/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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_FFI_H_
6 #define V8_FFI_H_
7
8 #include "v8.h" // NOLINT(build/include)
9
10 namespace v8 {
11
12 class Function;
13 template <class T>
14 class Local;
15 class String;
16
17 namespace ffi {
18
19 enum class FFIType {
20 kInt32,
21 kInt64,
22 kFloat32,
23 kFloat64,
24 kCharPtr,
25 kTypedArray,
26 kBufferNoCopy,
27 kFunction,
28 kStructPtr,
29 kForeign,
30 kRawJS
31 };
32
33 struct FFISignature;
34 struct FFITypeElement;
35
36 struct FFIStructElement {
37 const char* name;
38 FFITypeElement* type;
39 };
40
41 struct FFIStructSignature {
42 size_t elem_count;
43 FFIStructElement* elems;
44 };
45
46 union FFISupplementalInfo {
47 FFISignature* function_signature;
48 FFIStructSignature* struct_elements;
49 };
50
51 struct FFITypeElement {
52 FFIType type;
53 FFISupplementalInfo* info; // For specifying function type
54 };
55
56 struct FFISignature {
57 size_t return_count;
58 size_t param_count;
59 FFITypeElement* representations;
60 };
61
62 struct NativeFunction {
63 FFISignature* sig;
64 uint8_t* start;
65 };
66
67 Local<Function> CompileJSToNativeWrapper(Isolate* isolate, Local<String> name,
68 NativeFunction func);
69 void* FFIFunctionBind(Isolate* isolate, NativeFunction func, Object* args);
70 void* BuildFFIArgumentSerializer(Isolate* isolate, NativeFunction func);
71 void* BuildFFIArgumentDeserializer(Isolate* isolate, NativeFunction func);
72 } // namespace ffi
73 } // namespace v8
74
75 #endif // V8_FFI_H_
OLDNEW
« 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