diff --git a/include/v8-internal.h b/include/v8-internal.h index ee3633826eb6..e4d698e6ce7e 100644 --- a/include/v8-internal.h +++ b/include/v8-internal.h @@ -308,9 +308,9 @@ class Internals { V8_INLINE static internal::Address ReadTaggedPointerField( internal::Address heap_object_ptr, int offset) { #ifdef V8_COMPRESS_POINTERS - int32_t value = ReadRawField(heap_object_ptr, offset); + uint32_t value = ReadRawField(heap_object_ptr, offset); internal::Address root = GetRootFromOnHeapAddress(heap_object_ptr); - return root + static_cast(static_cast(value)); + return root + static_cast(static_cast(value)); #else return ReadRawField(heap_object_ptr, offset); #endif @@ -319,8 +319,8 @@ class Internals { V8_INLINE static internal::Address ReadTaggedSignedField( internal::Address heap_object_ptr, int offset) { #ifdef V8_COMPRESS_POINTERS - int32_t value = ReadRawField(heap_object_ptr, offset); - return static_cast(static_cast(value)); + uint32_t value = ReadRawField(heap_object_ptr, offset); + return static_cast(static_cast(value)); #else return ReadRawField(heap_object_ptr, offset); #endif @@ -337,13 +337,9 @@ class Internals { } V8_INLINE static internal::Address DecompressTaggedAnyField( - internal::Address heap_object_ptr, int32_t value) { - internal::Address root_mask = static_cast( - -static_cast(value & kSmiTagMask)); - internal::Address root_or_zero = - root_mask & GetRootFromOnHeapAddress(heap_object_ptr); - return root_or_zero + - static_cast(static_cast(value)); + internal::Address heap_object_ptr, uint32_t value) { + internal::Address root = GetRootFromOnHeapAddress(heap_object_ptr); + return root + static_cast(static_cast(value)); } #endif // V8_COMPRESS_POINTERS }; diff --git a/include/v8.h b/include/v8.h index c967f42c3ff0..caae20abef88 100644 --- a/include/v8.h +++ b/include/v8.h @@ -11064,7 +11064,7 @@ Local Object::GetInternalField(int index) { #ifdef V8_COMPRESS_POINTERS // We read the full pointer value and then decompress it in order to avoid // dealing with potential endiannes issues. - value = I::DecompressTaggedAnyField(obj, static_cast(value)); + value = I::DecompressTaggedAnyField(obj, static_cast(value)); #endif internal::Isolate* isolate = internal::IsolateFromNeverReadOnlySpaceObject(obj); @@ -11709,7 +11709,7 @@ Local Context::GetEmbedderData(int index) { // We read the full pointer value and then decompress it in order to avoid // dealing with potential endiannes issues. value = - I::DecompressTaggedAnyField(embedder_data, static_cast(value)); + I::DecompressTaggedAnyField(embedder_data, static_cast(value)); #endif internal::Isolate* isolate = internal::IsolateFromNeverReadOnlySpaceObject( *reinterpret_cast(this));