aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/common/ptr-compr-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/common/ptr-compr-inl.h')
-rw-r--r--deps/v8/src/common/ptr-compr-inl.h31
1 files changed, 14 insertions, 17 deletions
diff --git a/deps/v8/src/common/ptr-compr-inl.h b/deps/v8/src/common/ptr-compr-inl.h
index fd0f97e904..00a79bb291 100644
--- a/deps/v8/src/common/ptr-compr-inl.h
+++ b/deps/v8/src/common/ptr-compr-inl.h
@@ -25,8 +25,12 @@ V8_INLINE Address GetIsolateRoot(TOnHeapAddress on_heap_addr);
template <>
V8_INLINE Address GetIsolateRoot<Address>(Address on_heap_addr) {
+ // We subtract 1 here in order to let the compiler generate addition of 32-bit
+ // signed constant instead of 64-bit constant (the problem is that 2Gb looks
+ // like a negative 32-bit value). It's correct because we will never use
+ // leftmost address of V8 heap as |on_heap_addr|.
return RoundDown<kPtrComprIsolateRootAlignment>(on_heap_addr +
- kPtrComprIsolateRootBias);
+ kPtrComprIsolateRootBias - 1);
}
template <>
@@ -34,17 +38,10 @@ V8_INLINE Address GetIsolateRoot<Isolate*>(Isolate* isolate) {
return isolate->isolate_root();
}
-template <>
-V8_INLINE Address GetIsolateRoot<const Isolate*>(const Isolate* isolate) {
- return isolate->isolate_root();
-}
-
// Decompresses smi value.
V8_INLINE Address DecompressTaggedSigned(Tagged_t raw_value) {
- // Current compression scheme requires |raw_value| to be sign-extended
- // from int32_t to intptr_t.
- intptr_t value = static_cast<intptr_t>(static_cast<int32_t>(raw_value));
- return static_cast<Address>(value);
+ // For runtime code the upper 32-bits of the Smi value do not matter.
+ return static_cast<Address>(raw_value);
}
// Decompresses weak or strong heap object pointer or forwarding pointer,
@@ -63,18 +60,18 @@ V8_INLINE Address DecompressTaggedPointer(TOnHeapAddress on_heap_addr,
template <typename TOnHeapAddress>
V8_INLINE Address DecompressTaggedAny(TOnHeapAddress on_heap_addr,
Tagged_t raw_value) {
- // Current compression scheme requires |raw_value| to be sign-extended
- // from int32_t to intptr_t.
- intptr_t value = static_cast<intptr_t>(static_cast<int32_t>(raw_value));
- if (kUseBranchlessPtrDecompression) {
+ if (kUseBranchlessPtrDecompressionInRuntime) {
+ // Current compression scheme requires |raw_value| to be sign-extended
+ // from int32_t to intptr_t.
+ intptr_t value = static_cast<intptr_t>(static_cast<int32_t>(raw_value));
// |root_mask| is 0 if the |value| was a smi or -1 otherwise.
Address root_mask = static_cast<Address>(-(value & kSmiTagMask));
Address root_or_zero = root_mask & GetIsolateRoot(on_heap_addr);
return root_or_zero + static_cast<Address>(value);
} else {
- return HAS_SMI_TAG(value)
- ? static_cast<Address>(value)
- : (GetIsolateRoot(on_heap_addr) + static_cast<Address>(value));
+ return HAS_SMI_TAG(raw_value)
+ ? DecompressTaggedSigned(raw_value)
+ : DecompressTaggedPointer(on_heap_addr, raw_value);
}
}