Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/common/external-pointer-inl.h')
-rw-r--r--deps/v8/src/common/external-pointer-inl.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/deps/v8/src/common/external-pointer-inl.h b/deps/v8/src/common/external-pointer-inl.h
new file mode 100644
index 00000000000..32a78002e15
--- /dev/null
+++ b/deps/v8/src/common/external-pointer-inl.h
@@ -0,0 +1,32 @@
+// Copyright 2020 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_COMMON_EXTERNAL_POINTER_INL_H_
+#define V8_COMMON_EXTERNAL_POINTER_INL_H_
+
+#include "include/v8-internal.h"
+#include "src/common/external-pointer.h"
+#include "src/execution/isolate.h"
+
+namespace v8 {
+namespace internal {
+
+V8_INLINE ExternalPointer_t EncodeExternalPointer(Isolate* isolate,
+ Address external_pointer) {
+ STATIC_ASSERT(kExternalPointerSize == kSystemPointerSize);
+ if (!V8_HEAP_SANDBOX_BOOL) return external_pointer;
+ return external_pointer ^ kExternalPointerSalt;
+}
+
+V8_INLINE Address DecodeExternalPointer(const Isolate* isolate,
+ ExternalPointer_t encoded_pointer) {
+ STATIC_ASSERT(kExternalPointerSize == kSystemPointerSize);
+ if (!V8_HEAP_SANDBOX_BOOL) return encoded_pointer;
+ return encoded_pointer ^ kExternalPointerSalt;
+}
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_COMMON_EXTERNAL_POINTER_INL_H_