@downdraft/native-mobile-android-arm64 0.0.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/README.md +7 -0
  2. package/include/node/cppgc/allocation.h +308 -0
  3. package/include/node/cppgc/common.h +28 -0
  4. package/include/node/cppgc/cross-thread-persistent.h +462 -0
  5. package/include/node/cppgc/custom-space.h +97 -0
  6. package/include/node/cppgc/default-platform.h +68 -0
  7. package/include/node/cppgc/explicit-management.h +100 -0
  8. package/include/node/cppgc/garbage-collected.h +114 -0
  9. package/include/node/cppgc/heap-consistency.h +309 -0
  10. package/include/node/cppgc/heap-handle.h +48 -0
  11. package/include/node/cppgc/heap-state.h +82 -0
  12. package/include/node/cppgc/heap-statistics.h +126 -0
  13. package/include/node/cppgc/heap.h +202 -0
  14. package/include/node/cppgc/internal/api-constants.h +75 -0
  15. package/include/node/cppgc/internal/atomic-entry-flag.h +48 -0
  16. package/include/node/cppgc/internal/base-page-handle.h +43 -0
  17. package/include/node/cppgc/internal/caged-heap-local-data.h +117 -0
  18. package/include/node/cppgc/internal/caged-heap.h +64 -0
  19. package/include/node/cppgc/internal/compiler-specific.h +46 -0
  20. package/include/node/cppgc/internal/conditional-stack-allocated.h +41 -0
  21. package/include/node/cppgc/internal/finalizer-trait.h +93 -0
  22. package/include/node/cppgc/internal/gc-info.h +150 -0
  23. package/include/node/cppgc/internal/logging.h +50 -0
  24. package/include/node/cppgc/internal/member-storage.h +305 -0
  25. package/include/node/cppgc/internal/name-trait.h +141 -0
  26. package/include/node/cppgc/internal/persistent-node.h +219 -0
  27. package/include/node/cppgc/internal/pointer-policies.h +280 -0
  28. package/include/node/cppgc/internal/write-barrier.h +487 -0
  29. package/include/node/cppgc/liveness-broker.h +78 -0
  30. package/include/node/cppgc/macros.h +56 -0
  31. package/include/node/cppgc/member.h +669 -0
  32. package/include/node/cppgc/name-provider.h +75 -0
  33. package/include/node/cppgc/object-size-trait.h +58 -0
  34. package/include/node/cppgc/persistent.h +376 -0
  35. package/include/node/cppgc/platform.h +174 -0
  36. package/include/node/cppgc/prefinalizer.h +75 -0
  37. package/include/node/cppgc/process-heap-statistics.h +36 -0
  38. package/include/node/cppgc/sentinel-pointer.h +39 -0
  39. package/include/node/cppgc/source-location.h +16 -0
  40. package/include/node/cppgc/tagged-member.h +114 -0
  41. package/include/node/cppgc/testing.h +106 -0
  42. package/include/node/cppgc/trace-trait.h +127 -0
  43. package/include/node/cppgc/type-traits.h +272 -0
  44. package/include/node/cppgc/visitor.h +534 -0
  45. package/include/node/js_native_api.h +634 -0
  46. package/include/node/js_native_api_types.h +244 -0
  47. package/include/node/libplatform/libplatform-export.h +29 -0
  48. package/include/node/libplatform/libplatform.h +112 -0
  49. package/include/node/libplatform/v8-tracing.h +343 -0
  50. package/include/node/node.h +1744 -0
  51. package/include/node/node_api.h +265 -0
  52. package/include/node/node_api_types.h +58 -0
  53. package/include/node/node_buffer.h +94 -0
  54. package/include/node/node_object_wrap.h +145 -0
  55. package/include/node/node_version.h +116 -0
  56. package/include/node/uv/aix.h +32 -0
  57. package/include/node/uv/bsd.h +34 -0
  58. package/include/node/uv/darwin.h +61 -0
  59. package/include/node/uv/errno.h +483 -0
  60. package/include/node/uv/linux.h +34 -0
  61. package/include/node/uv/os390.h +33 -0
  62. package/include/node/uv/posix.h +31 -0
  63. package/include/node/uv/sunos.h +44 -0
  64. package/include/node/uv/threadpool.h +37 -0
  65. package/include/node/uv/tree.h +521 -0
  66. package/include/node/uv/unix.h +509 -0
  67. package/include/node/uv/version.h +43 -0
  68. package/include/node/uv/win.h +698 -0
  69. package/include/node/uv.h +1994 -0
  70. package/include/node/v8-array-buffer.h +646 -0
  71. package/include/node/v8-callbacks.h +533 -0
  72. package/include/node/v8-container.h +183 -0
  73. package/include/node/v8-context.h +580 -0
  74. package/include/node/v8-cpp-heap-external.h +56 -0
  75. package/include/node/v8-cppgc.h +194 -0
  76. package/include/node/v8-data.h +96 -0
  77. package/include/node/v8-date.h +57 -0
  78. package/include/node/v8-debug.h +210 -0
  79. package/include/node/v8-embedder-heap.h +54 -0
  80. package/include/node/v8-embedder-state-scope.h +52 -0
  81. package/include/node/v8-exception.h +298 -0
  82. package/include/node/v8-extension.h +60 -0
  83. package/include/node/v8-external-memory-accounter.h +60 -0
  84. package/include/node/v8-external.h +73 -0
  85. package/include/node/v8-fast-api-calls.h +784 -0
  86. package/include/node/v8-forward.h +82 -0
  87. package/include/node/v8-function-callback.h +708 -0
  88. package/include/node/v8-function.h +148 -0
  89. package/include/node/v8-handle-base.h +155 -0
  90. package/include/node/v8-initialization.h +343 -0
  91. package/include/node/v8-inspector-protocol.h +13 -0
  92. package/include/node/v8-inspector.h +458 -0
  93. package/include/node/v8-internal.h +1827 -0
  94. package/include/node/v8-isolate.h +1925 -0
  95. package/include/node/v8-json.h +54 -0
  96. package/include/node/v8-local-handle.h +884 -0
  97. package/include/node/v8-locker.h +138 -0
  98. package/include/node/v8-maybe.h +185 -0
  99. package/include/node/v8-memory-span.h +273 -0
  100. package/include/node/v8-message.h +215 -0
  101. package/include/node/v8-metrics.h +273 -0
  102. package/include/node/v8-microtask-queue.h +152 -0
  103. package/include/node/v8-microtask.h +28 -0
  104. package/include/node/v8-object.h +1134 -0
  105. package/include/node/v8-persistent-handle.h +556 -0
  106. package/include/node/v8-platform.h +1552 -0
  107. package/include/node/v8-primitive-object.h +118 -0
  108. package/include/node/v8-primitive.h +1056 -0
  109. package/include/node/v8-profiler.h +1401 -0
  110. package/include/node/v8-promise.h +185 -0
  111. package/include/node/v8-proxy.h +49 -0
  112. package/include/node/v8-regexp.h +105 -0
  113. package/include/node/v8-sandbox.h +170 -0
  114. package/include/node/v8-script.h +996 -0
  115. package/include/node/v8-snapshot.h +302 -0
  116. package/include/node/v8-source-location.h +91 -0
  117. package/include/node/v8-statistics.h +246 -0
  118. package/include/node/v8-template.h +1096 -0
  119. package/include/node/v8-trace-categories.h +28 -0
  120. package/include/node/v8-traced-handle.h +420 -0
  121. package/include/node/v8-typed-array.h +386 -0
  122. package/include/node/v8-unwinder-state.h +30 -0
  123. package/include/node/v8-unwinder.h +146 -0
  124. package/include/node/v8-util.h +549 -0
  125. package/include/node/v8-value-serializer-version.h +24 -0
  126. package/include/node/v8-value-serializer.h +316 -0
  127. package/include/node/v8-value.h +674 -0
  128. package/include/node/v8-version-string.h +38 -0
  129. package/include/node/v8-version.h +20 -0
  130. package/include/node/v8-wasm-trap-handler-posix.h +31 -0
  131. package/include/node/v8-wasm-trap-handler-win.h +28 -0
  132. package/include/node/v8-wasm.h +325 -0
  133. package/include/node/v8-weak-callback-info.h +88 -0
  134. package/include/node/v8.h +88 -0
  135. package/include/node/v8config.h +1077 -0
  136. package/lib/libc++_shared.so +0 -0
  137. package/lib/libnode.so +4 -0
  138. package/package.json +23 -3
@@ -0,0 +1,148 @@
1
+ // Copyright 2021 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 INCLUDE_V8_FUNCTION_H_
6
+ #define INCLUDE_V8_FUNCTION_H_
7
+
8
+ #include <stddef.h>
9
+ #include <stdint.h>
10
+
11
+ #include "v8-function-callback.h" // NOLINT(build/include_directory)
12
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
13
+ #include "v8-message.h" // NOLINT(build/include_directory)
14
+ #include "v8-object.h" // NOLINT(build/include_directory)
15
+ #include "v8-template.h" // NOLINT(build/include_directory)
16
+ #include "v8config.h" // NOLINT(build/include_directory)
17
+
18
+ namespace v8 {
19
+
20
+ class Context;
21
+ class Location;
22
+ class UnboundScript;
23
+
24
+ /**
25
+ * A JavaScript function object (ECMA-262, 15.3).
26
+ */
27
+ class V8_EXPORT Function : public Object {
28
+ public:
29
+ /**
30
+ * Create a function in the current execution context
31
+ * for a given FunctionCallback.
32
+ */
33
+ static MaybeLocal<Function> New(
34
+ Local<Context> context, FunctionCallback callback, Local<Data> data = {},
35
+ int length = 0,
36
+ ConstructorBehavior behavior = ConstructorBehavior::kAllow,
37
+ SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
38
+
39
+ V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
40
+ Local<Context> context, int argc, Local<Value> argv[]) const;
41
+
42
+ V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
43
+ Local<Context> context) const {
44
+ return NewInstance(context, 0, nullptr);
45
+ }
46
+
47
+ /**
48
+ * When side effect checks are enabled, passing kHasNoSideEffect allows the
49
+ * constructor to be invoked without throwing. Calls made within the
50
+ * constructor are still checked.
51
+ */
52
+ V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstanceWithSideEffectType(
53
+ Local<Context> context, int argc, Local<Value> argv[],
54
+ SideEffectType side_effect_type = SideEffectType::kHasSideEffect) const;
55
+
56
+ V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(v8::Isolate* isolate,
57
+ Local<Context> context,
58
+ Local<Value> recv, int argc,
59
+ Local<Value> argv[]);
60
+ V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(Local<Context> context,
61
+ Local<Value> recv, int argc,
62
+ Local<Value> argv[]);
63
+
64
+ void SetName(Local<String> name);
65
+ Local<Value> GetName() const;
66
+
67
+ /**
68
+ * Name inferred from variable or property assignment of this function.
69
+ * Used to facilitate debugging and profiling of JavaScript code written
70
+ * in an OO style, where many functions are anonymous but are assigned
71
+ * to object properties.
72
+ */
73
+ Local<Value> GetInferredName() const;
74
+
75
+ /**
76
+ * displayName if it is set, otherwise name if it is configured, otherwise
77
+ * function name, otherwise inferred name.
78
+ */
79
+ Local<Value> GetDebugName() const;
80
+
81
+ /**
82
+ * Returns zero based line number of function body and
83
+ * kLineOffsetNotFound if no information available.
84
+ */
85
+ int GetScriptLineNumber() const;
86
+ /**
87
+ * Returns zero based column number of function body and
88
+ * kLineOffsetNotFound if no information available.
89
+ */
90
+ int GetScriptColumnNumber() const;
91
+
92
+ /**
93
+ * Returns zero based line and column number of function body, else returns
94
+ * {-1, -1}.
95
+ */
96
+ Location GetScriptLocation() const;
97
+
98
+ /**
99
+ * Returns zero based start position (character offset) of function body and
100
+ * kLineOffsetNotFound if no information available.
101
+ */
102
+ int GetScriptStartPosition() const;
103
+
104
+ /**
105
+ * Returns scriptId.
106
+ */
107
+ int ScriptId() const;
108
+
109
+ /**
110
+ * Returns the original function if this function is bound, else returns
111
+ * v8::Undefined.
112
+ */
113
+ Local<Value> GetBoundFunction() const;
114
+
115
+ /**
116
+ * Calls builtin Function.prototype.toString on this function.
117
+ * This is different from Value::ToString() that may call a user-defined
118
+ * toString() function, and different than Object::ObjectProtoToString() which
119
+ * always serializes "[object Function]".
120
+ */
121
+ V8_WARN_UNUSED_RESULT MaybeLocal<String> FunctionProtoToString(
122
+ Local<Context> context);
123
+
124
+ /**
125
+ * Returns true if the function does nothing.
126
+ * The function returns false on error.
127
+ * Note that this function is experimental. Embedders should not rely on
128
+ * this existing. We may remove this function in the future.
129
+ */
130
+ V8_WARN_UNUSED_RESULT bool Experimental_IsNopFunction() const;
131
+
132
+ ScriptOrigin GetScriptOrigin() const;
133
+ V8_INLINE static Function* Cast(Value* value) {
134
+ #ifdef V8_ENABLE_CHECKS
135
+ CheckCast(value);
136
+ #endif
137
+ return static_cast<Function*>(value);
138
+ }
139
+
140
+ static const int kLineOffsetNotFound;
141
+
142
+ private:
143
+ Function();
144
+ static void CheckCast(Value* obj);
145
+ };
146
+ } // namespace v8
147
+
148
+ #endif // INCLUDE_V8_FUNCTION_H_
@@ -0,0 +1,155 @@
1
+ // Copyright 2023 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 INCLUDE_V8_HANDLE_BASE_H_
6
+ #define INCLUDE_V8_HANDLE_BASE_H_
7
+
8
+ #include "v8-internal.h" // NOLINT(build/include_directory)
9
+
10
+ namespace v8::api_internal {
11
+
12
+ template <bool check_statically_enabled>
13
+ class StackAllocated {
14
+ public:
15
+ V8_INLINE StackAllocated() = default;
16
+
17
+ protected:
18
+ struct no_checking_tag {};
19
+ static constexpr no_checking_tag do_not_check{};
20
+
21
+ V8_INLINE explicit StackAllocated(no_checking_tag) {}
22
+ V8_INLINE explicit StackAllocated(const StackAllocated& other,
23
+ no_checking_tag) {}
24
+
25
+ V8_INLINE void VerifyOnStack() const {}
26
+ };
27
+
28
+ template <>
29
+ class V8_TRIVIAL_ABI StackAllocated<true> : public StackAllocated<false> {
30
+ public:
31
+ V8_INLINE StackAllocated() { VerifyOnStack(); }
32
+
33
+ #if V8_HAS_ATTRIBUTE_TRIVIAL_ABI
34
+ // In this case, StackAllocated becomes not trivially copyable.
35
+ V8_INLINE StackAllocated(const StackAllocated& other) { VerifyOnStack(); }
36
+ StackAllocated& operator=(const StackAllocated&) = default;
37
+ #endif
38
+
39
+ protected:
40
+ V8_INLINE explicit StackAllocated(no_checking_tag tag)
41
+ : StackAllocated<false>(tag) {}
42
+ V8_INLINE explicit StackAllocated(const StackAllocated& other,
43
+ no_checking_tag tag)
44
+ : StackAllocated<false>(other, tag) {}
45
+
46
+ #ifdef ENABLE_SLOW_DCHECKS
47
+ V8_EXPORT void VerifyOnStack() const;
48
+ #else
49
+ V8_INLINE V8_EXPORT void VerifyOnStack() const {}
50
+ #endif
51
+ };
52
+
53
+ /**
54
+ * A base class for abstract handles containing indirect pointers.
55
+ * These are useful regardless of whether direct local support is enabled.
56
+ */
57
+ class IndirectHandleBase {
58
+ public:
59
+ // Returns true if the handle is empty.
60
+ V8_INLINE bool IsEmpty() const { return location_ == nullptr; }
61
+
62
+ // Sets the handle to be empty. IsEmpty() will then return true.
63
+ V8_INLINE void Clear() { location_ = nullptr; }
64
+
65
+ protected:
66
+ friend class internal::ValueHelper;
67
+ friend class internal::HandleHelper;
68
+
69
+ V8_INLINE IndirectHandleBase() = default;
70
+ V8_INLINE IndirectHandleBase(const IndirectHandleBase& other) = default;
71
+ V8_INLINE IndirectHandleBase& operator=(const IndirectHandleBase& that) =
72
+ default;
73
+
74
+ V8_INLINE explicit IndirectHandleBase(internal::Address* location)
75
+ : location_(location) {}
76
+
77
+ // Returns the address of the actual heap object (tagged).
78
+ // This method must be called only if the handle is not empty, otherwise it
79
+ // will crash.
80
+ V8_INLINE internal::Address ptr() const { return *location_; }
81
+
82
+ // Returns a reference to the slot (indirect pointer).
83
+ V8_INLINE internal::Address* const& slot() const { return location_; }
84
+ V8_INLINE internal::Address*& slot() { return location_; }
85
+
86
+ // Returns the handler's "value" (direct or indirect pointer, depending on
87
+ // whether direct local support is enabled).
88
+ template <typename T, bool check_null = false>
89
+ V8_INLINE T* value() const {
90
+ return internal::ValueHelper::SlotAsValue<T, check_null>(slot());
91
+ }
92
+
93
+ #ifdef V8_ENABLE_DIRECT_HANDLE
94
+ V8_INLINE internal::ValueHelper::InternalRepresentationType repr() const {
95
+ return location_ ? *location_ : internal::ValueHelper::kEmpty;
96
+ }
97
+ #else
98
+ V8_INLINE internal::ValueHelper::InternalRepresentationType repr() const {
99
+ return location_;
100
+ }
101
+ #endif // V8_ENABLE_DIRECT_HANDLE
102
+
103
+ private:
104
+ internal::Address* location_ = nullptr;
105
+ };
106
+
107
+ #ifdef V8_ENABLE_DIRECT_HANDLE
108
+
109
+ /**
110
+ * A base class for abstract handles containing direct pointers.
111
+ * These are only possible when conservative stack scanning is enabled.
112
+ */
113
+ class DirectHandleBase {
114
+ public:
115
+ // Returns true if the handle is empty.
116
+ V8_INLINE bool IsEmpty() const {
117
+ return ptr_ == internal::ValueHelper::kEmpty;
118
+ }
119
+
120
+ // Sets the handle to be empty. IsEmpty() will then return true.
121
+ V8_INLINE void Clear() { ptr_ = internal::ValueHelper::kEmpty; }
122
+
123
+ protected:
124
+ friend class internal::ValueHelper;
125
+ friend class internal::HandleHelper;
126
+
127
+ V8_INLINE DirectHandleBase() = default;
128
+ V8_INLINE DirectHandleBase(const DirectHandleBase& other) = default;
129
+ V8_INLINE DirectHandleBase& operator=(const DirectHandleBase& that) = default;
130
+
131
+ V8_INLINE explicit DirectHandleBase(internal::Address ptr) : ptr_(ptr) {}
132
+
133
+ // Returns the address of the referenced object.
134
+ V8_INLINE internal::Address ptr() const { return ptr_; }
135
+
136
+ // Returns the handler's "value" (direct pointer, as direct local support
137
+ // is guaranteed to be enabled here).
138
+ template <typename T, bool check_null = false>
139
+ V8_INLINE T* value() const {
140
+ return reinterpret_cast<T*>(ptr_);
141
+ }
142
+
143
+ V8_INLINE internal::ValueHelper::InternalRepresentationType repr() const {
144
+ return ptr_;
145
+ }
146
+
147
+ private:
148
+ internal::Address ptr_ = internal::ValueHelper::kEmpty;
149
+ };
150
+
151
+ #endif // V8_ENABLE_DIRECT_HANDLE
152
+
153
+ } // namespace v8::api_internal
154
+
155
+ #endif // INCLUDE_V8_HANDLE_BASE_H_
@@ -0,0 +1,343 @@
1
+ // Copyright 2021 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 INCLUDE_V8_INITIALIZATION_H_
6
+ #define INCLUDE_V8_INITIALIZATION_H_
7
+
8
+ #include <stddef.h>
9
+ #include <stdint.h>
10
+
11
+ #include "v8-callbacks.h" // NOLINT(build/include_directory)
12
+ #include "v8-internal.h" // NOLINT(build/include_directory)
13
+ #include "v8-isolate.h" // NOLINT(build/include_directory)
14
+ #include "v8-platform.h" // NOLINT(build/include_directory)
15
+ #include "v8config.h" // NOLINT(build/include_directory)
16
+
17
+ // We reserve the V8_* prefix for macros defined in V8 public API and
18
+ // assume there are no name conflicts with the embedder's code.
19
+
20
+ /**
21
+ * The v8 JavaScript engine.
22
+ */
23
+ namespace v8 {
24
+
25
+ class PageAllocator;
26
+ class Platform;
27
+ template <class K, class V, class T>
28
+ class PersistentValueMapBase;
29
+
30
+ /**
31
+ * EntropySource is used as a callback function when v8 needs a source
32
+ * of entropy.
33
+ */
34
+ using EntropySource = bool (*)(unsigned char* buffer, size_t length);
35
+
36
+ /**
37
+ * ReturnAddressLocationResolver is used as a callback function when v8 is
38
+ * resolving the location of a return address on the stack. Profilers that
39
+ * change the return address on the stack can use this to resolve the stack
40
+ * location to wherever the profiler stashed the original return address.
41
+ *
42
+ * \param return_addr_location A location on stack where a machine
43
+ * return address resides.
44
+ * \returns Either return_addr_location, or else a pointer to the profiler's
45
+ * copy of the original return address.
46
+ *
47
+ * \note The resolver function must not cause garbage collection.
48
+ */
49
+ using ReturnAddressLocationResolver =
50
+ uintptr_t (*)(uintptr_t return_addr_location);
51
+
52
+ using DcheckErrorCallback = void (*)(const char* file, int line,
53
+ const char* message);
54
+
55
+ using V8FatalErrorCallback = void (*)(const char* file, int line,
56
+ const char* message);
57
+
58
+ /**
59
+ * Container class for static utility functions.
60
+ */
61
+ class V8_EXPORT V8 {
62
+ public:
63
+ /**
64
+ * Hand startup data to V8, in case the embedder has chosen to build
65
+ * V8 with external startup data.
66
+ *
67
+ * Note:
68
+ * - By default the startup data is linked into the V8 library, in which
69
+ * case this function is not meaningful.
70
+ * - If this needs to be called, it needs to be called before V8
71
+ * tries to make use of its built-ins.
72
+ * - To avoid unnecessary copies of data, V8 will point directly into the
73
+ * given data blob, so pretty please keep it around until V8 exit.
74
+ * - Compression of the startup blob might be useful, but needs to
75
+ * handled entirely on the embedders' side.
76
+ * - The call will abort if the data is invalid.
77
+ */
78
+ static void SetSnapshotDataBlob(StartupData* startup_blob);
79
+
80
+ /** Set the callback to invoke in case of Dcheck failures. */
81
+ static void SetDcheckErrorHandler(DcheckErrorCallback that);
82
+
83
+ /** Set the callback to invoke in the case of CHECK failures or fatal
84
+ * errors. This is distinct from Isolate::SetFatalErrorHandler, which
85
+ * is invoked in response to API usage failures.
86
+ * */
87
+ static void SetFatalErrorHandler(V8FatalErrorCallback that);
88
+
89
+ /**
90
+ * Sets V8 flags from a string.
91
+ */
92
+ static void SetFlagsFromString(const char* str);
93
+ static void SetFlagsFromString(const char* str, size_t length);
94
+
95
+ /**
96
+ * Sets V8 flags from the command line.
97
+ */
98
+ static void SetFlagsFromCommandLine(int* argc, char** argv,
99
+ bool remove_flags);
100
+
101
+ /** Get the version string. */
102
+ static const char* GetVersion();
103
+
104
+ /**
105
+ * Initializes V8. This function needs to be called before the first Isolate
106
+ * is created. It always returns true.
107
+ */
108
+ V8_INLINE static bool Initialize() {
109
+ #ifdef V8_TARGET_OS_ANDROID
110
+ const bool kV8TargetOsIsAndroid = true;
111
+ #else
112
+ const bool kV8TargetOsIsAndroid = false;
113
+ #endif
114
+
115
+ #ifdef V8_ENABLE_CHECKS
116
+ const bool kV8EnableChecks = true;
117
+ #else
118
+ const bool kV8EnableChecks = false;
119
+ #endif
120
+
121
+ const int kBuildConfiguration =
122
+ (internal::PointerCompressionIsEnabled() ? kPointerCompression : 0) |
123
+ (internal::SmiValuesAre31Bits() ? k31BitSmis : 0) |
124
+ (internal::SandboxIsEnabled() ? kSandbox : 0) |
125
+ (kV8TargetOsIsAndroid ? kTargetOsIsAndroid : 0) |
126
+ (kV8EnableChecks ? kEnableChecks : 0);
127
+ return Initialize(kBuildConfiguration);
128
+ }
129
+
130
+ /**
131
+ * Allows the host application to provide a callback which can be used
132
+ * as a source of entropy for random number generators.
133
+ */
134
+ static void SetEntropySource(EntropySource source);
135
+
136
+ /**
137
+ * Allows the host application to provide a callback that allows v8 to
138
+ * cooperate with a profiler that rewrites return addresses on stack.
139
+ */
140
+ static void SetReturnAddressLocationResolver(
141
+ ReturnAddressLocationResolver return_address_resolver);
142
+
143
+ /**
144
+ * Releases any resources used by v8 and stops any utility threads
145
+ * that may be running. Note that disposing v8 is permanent, it
146
+ * cannot be reinitialized.
147
+ *
148
+ * It should generally not be necessary to dispose v8 before exiting
149
+ * a process, this should happen automatically. It is only necessary
150
+ * to use if the process needs the resources taken up by v8.
151
+ */
152
+ static bool Dispose();
153
+
154
+ /**
155
+ * Initialize the ICU library bundled with V8. The embedder should only
156
+ * invoke this method when using the bundled ICU. Returns true on success.
157
+ *
158
+ * If V8 was compiled with the ICU data in an external file, the location
159
+ * of the data file has to be provided.
160
+ */
161
+ static bool InitializeICU(const char* icu_data_file = nullptr);
162
+
163
+ /**
164
+ * Initialize the ICU library bundled with V8. The embedder should only
165
+ * invoke this method when using the bundled ICU. If V8 was compiled with
166
+ * the ICU data in an external file and when the default location of that
167
+ * file should be used, a path to the executable must be provided.
168
+ * Returns true on success.
169
+ *
170
+ * The default is a file called icudtl.dat side-by-side with the executable.
171
+ *
172
+ * Optionally, the location of the data file can be provided to override the
173
+ * default.
174
+ */
175
+ static bool InitializeICUDefaultLocation(const char* exec_path,
176
+ const char* icu_data_file = nullptr);
177
+
178
+ /**
179
+ * Initialize the external startup data. The embedder only needs to
180
+ * invoke this method when external startup data was enabled in a build.
181
+ *
182
+ * If V8 was compiled with the startup data in an external file, then
183
+ * V8 needs to be given those external files during startup. There are
184
+ * three ways to do this:
185
+ * - InitializeExternalStartupData(const char*)
186
+ * This will look in the given directory for the file "snapshot_blob.bin".
187
+ * - InitializeExternalStartupDataFromFile(const char*)
188
+ * As above, but will directly use the given file name.
189
+ * - Call SetSnapshotDataBlob.
190
+ * This will read the blobs from the given data structure and will
191
+ * not perform any file IO.
192
+ */
193
+ static void InitializeExternalStartupData(const char* directory_path);
194
+ static void InitializeExternalStartupDataFromFile(const char* snapshot_blob);
195
+
196
+ /**
197
+ * Sets the v8::Platform to use. This should be invoked before V8 is
198
+ * initialized.
199
+ */
200
+ static void InitializePlatform(Platform* platform);
201
+
202
+ /**
203
+ * Clears all references to the v8::Platform. This should be invoked after
204
+ * V8 was disposed.
205
+ */
206
+ static void DisposePlatform();
207
+
208
+ #if defined(V8_ENABLE_SANDBOX)
209
+ /**
210
+ * Returns true if the sandbox is configured securely.
211
+ *
212
+ * If V8 cannot create a regular sandbox during initialization, for example
213
+ * because not enough virtual address space can be reserved, it will instead
214
+ * create a fallback sandbox that still allows it to function normally but
215
+ * does not have the same security properties as a regular sandbox. This API
216
+ * can be used to determine if such a fallback sandbox is being used, in
217
+ * which case it will return false.
218
+ */
219
+ static bool IsSandboxConfiguredSecurely();
220
+
221
+ /**
222
+ * Provides access to the virtual address subspace backing the sandbox.
223
+ *
224
+ * This can be used to allocate pages inside the sandbox, for example to
225
+ * obtain virtual memory for ArrayBuffer backing stores, which must be
226
+ * located inside the sandbox.
227
+ *
228
+ * It should be assumed that an attacker can corrupt data inside the sandbox,
229
+ * and so in particular the contents of pages allocagted in this virtual
230
+ * address space, arbitrarily and concurrently. Due to this, it is
231
+ * recommended to to only place pure data buffers in them.
232
+ */
233
+ static VirtualAddressSpace* GetSandboxAddressSpace();
234
+
235
+ /**
236
+ * Returns the size of the sandbox in bytes.
237
+ *
238
+ * This represents the size of the address space that V8 can directly address
239
+ * and in which it allocates its objects.
240
+ */
241
+ static size_t GetSandboxSizeInBytes();
242
+
243
+ /**
244
+ * Returns the size of the address space reservation backing the sandbox.
245
+ *
246
+ * This may be larger than the sandbox (i.e. |GetSandboxSizeInBytes()|) due
247
+ * to surrounding guard regions, or may be smaller than the sandbox in case a
248
+ * fallback sandbox is being used, which will use a smaller virtual address
249
+ * space reservation. In the latter case this will also be different from
250
+ * |GetSandboxAddressSpace()->size()| as that will cover a larger part of the
251
+ * address space than what has actually been reserved.
252
+ */
253
+ static size_t GetSandboxReservationSizeInBytes();
254
+ #endif // V8_ENABLE_SANDBOX
255
+
256
+ enum class WasmMemoryType {
257
+ kMemory32,
258
+ kMemory64,
259
+ };
260
+
261
+ /**
262
+ * Returns the virtual address space reservation size (in bytes) needed
263
+ * for one WebAssembly memory instance of the given capacity.
264
+ *
265
+ * \param type Whether this is a memory32 or memory64 instance.
266
+ * \param byte_capacity The maximum size, in bytes, of the WebAssembly
267
+ * memory. Values exceeding the engine's maximum allocatable memory
268
+ * size for the given type (determined by max_mem32_pages or
269
+ * max_mem64_pages) are clamped.
270
+ *
271
+ * When trap-based bounds checking is enabled by
272
+ * EnableWebAssemblyTrapHandler(), the amount of virtual address space
273
+ * that V8 needs to reserve for each WebAssembly memory instance can
274
+ * be much bigger than the requested size. If the process does
275
+ * not have enough virtual memory available, WebAssembly memory allocation
276
+ * would fail. During the initialization of V8, embedders can use this method
277
+ * to estimate whether the process has enough virtual memory for their
278
+ * usage of WebAssembly, and decide whether to enable the trap handler
279
+ * via EnableWebAssemblyTrapHandler(), or to skip it and reduce the amount of
280
+ * virtual memory required to keep the application running.
281
+ */
282
+ static size_t GetWasmMemoryReservationSizeInBytes(WasmMemoryType type,
283
+ size_t byte_capacity);
284
+
285
+ /**
286
+ * Activate trap-based bounds checking for WebAssembly.
287
+ *
288
+ * \param use_v8_signal_handler Whether V8 should install its own signal
289
+ * handler or rely on the embedder's.
290
+ */
291
+ static bool EnableWebAssemblyTrapHandler(bool use_v8_signal_handler);
292
+
293
+ #if defined(V8_OS_WIN)
294
+ /**
295
+ * On Win64, by default V8 does not emit unwinding data for jitted code,
296
+ * which means the OS cannot walk the stack frames and the system Structured
297
+ * Exception Handling (SEH) cannot unwind through V8-generated code:
298
+ * https://code.google.com/p/v8/issues/detail?id=3598.
299
+ *
300
+ * This function allows embedders to register a custom exception handler for
301
+ * exceptions in V8-generated code.
302
+ */
303
+ static void SetUnhandledExceptionCallback(
304
+ UnhandledExceptionCallback callback);
305
+ #endif
306
+
307
+ /**
308
+ * Allows the host application to provide a callback that will be called when
309
+ * v8 has encountered a fatal failure to allocate memory and is about to
310
+ * terminate.
311
+ */
312
+ static void SetFatalMemoryErrorCallback(OOMErrorCallback callback);
313
+
314
+ /**
315
+ * Get statistics about the shared memory usage.
316
+ */
317
+ static void GetSharedMemoryStatistics(SharedMemoryStatistics* statistics);
318
+
319
+ private:
320
+ V8();
321
+
322
+ enum BuildConfigurationFeatures {
323
+ kPointerCompression = 1 << 0,
324
+ k31BitSmis = 1 << 1,
325
+ kSandbox = 1 << 2,
326
+ kTargetOsIsAndroid = 1 << 3,
327
+ kEnableChecks = 1 << 4,
328
+ };
329
+
330
+ /**
331
+ * Checks that the embedder build configuration is compatible with
332
+ * the V8 binary and if so initializes V8.
333
+ */
334
+ static bool Initialize(int build_config);
335
+
336
+ friend class Context;
337
+ template <class K, class V, class T>
338
+ friend class PersistentValueMapBase;
339
+ };
340
+
341
+ } // namespace v8
342
+
343
+ #endif // INCLUDE_V8_INITIALIZATION_H_
@@ -0,0 +1,13 @@
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_V8_INSPECTOR_PROTOCOL_H_
6
+ #define V8_V8_INSPECTOR_PROTOCOL_H_
7
+
8
+ #include "inspector/Debugger.h" // NOLINT(build/include_directory)
9
+ #include "inspector/Runtime.h" // NOLINT(build/include_directory)
10
+ #include "inspector/Schema.h" // NOLINT(build/include_directory)
11
+ #include "v8-inspector.h" // NOLINT(build/include_directory)
12
+
13
+ #endif // V8_V8_INSPECTOR_PROTOCOL_H_