| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8e04c91 commit b323844
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,7 +38,7 @@ | |||
| 38 | 38 | ||
| 39 | 39 | # Reset this number to 0 on major V8 upgrades. | |
| 40 | 40 | # Increment by one for each non-official patch applied to deps/v8. | |
| 41 | - 'v8_embedder_string': '-node.4', | ||
| 41 | + 'v8_embedder_string': '-node.5', | ||
| 42 | 42 | ||
| 43 | 43 | ##### V8 defaults for Node.js ##### | |
| 44 | 44 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2052,7 +2052,16 @@ TNode<Code> CodeStubAssembler::LoadCodeObjectFromJSDispatchTable( | |||
| 2052 | 2052 | TNode<UintPtrT> shifted_value; | |
| 2053 | 2053 | if (JSDispatchEntry::kObjectPointerOffset == 0) { | |
| 2054 | 2054 | shifted_value = | |
| 2055 | + #if defined(__illumos__) && defined(V8_HOST_ARCH_64_BIT) | ||
| 2056 | + // Pointers in illumos span both the low 2^47 range and the high 2^47 range | ||
| 2057 | + // as well. Checking the high bit being set in illumos means all higher bits | ||
| 2058 | + // need to be set to 1 after shifting right. | ||
| 2059 | + // Use WordSar() so any high-bit check wouldn't be necessary. | ||
| 2060 | + UncheckedCast<UintPtrT>(WordSar(UncheckedCast<IntPtrT>(value), | ||
| 2061 | + IntPtrConstant(JSDispatchEntry::kObjectPointerShift))); | ||
| 2062 | + #else | ||
| 2055 | 2063 | WordShr(value, UintPtrConstant(JSDispatchEntry::kObjectPointerShift)); | |
| 2064 | + #endif /* __illumos__ and 64-bit */ | ||
| 2056 | 2065 | } else { | |
| 2057 | 2066 | shifted_value = UintPtrAdd( | |
| 2058 | 2067 | WordShr(value, UintPtrConstant(JSDispatchEntry::kObjectPointerShift)), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,13 +23,15 @@ void JSDispatchEntry::MakeJSDispatchEntry(Address object, Address entrypoint, | |||
| 23 | 23 | uint16_t parameter_count, | |
| 24 | 24 | bool mark_as_alive) { | |
| 25 | 25 | DCHECK_EQ(object & kHeapObjectTag, 0); | |
| 26 | + #if !defined(__illumos__) || !defined(V8_TARGET_ARCH_64_BIT) | ||
| 26 | 27 | DCHECK_EQ((((object - kObjectPointerOffset) << kObjectPointerShift) >> | |
| 27 | 28 | kObjectPointerShift) + | |
| 28 | 29 | kObjectPointerOffset, | |
| 29 | 30 | object); | |
| 30 | 31 | DCHECK_EQ((object - kObjectPointerOffset) + kObjectPointerOffset, object); | |
| 31 | 32 | DCHECK_LT((object - kObjectPointerOffset), | |
| 32 | 33 | 1ULL << ((sizeof(encoded_word_) * 8) - kObjectPointerShift)); | |
| 34 | + #endif /* __illumos__ & 64-bit */ | ||
| 33 | 35 | ||
| 34 | 36 | Address payload = ((object - kObjectPointerOffset) << kObjectPointerShift) | | |
| 35 | 37 | (parameter_count & kParameterCountMask); | |
@@ -55,8 +57,16 @@ Address JSDispatchEntry::GetCodePointer() const { | |||
| 55 | 57 | // and so may be 0 or 1 here. As the return value is a tagged pointer, the | |
| 56 | 58 | // bit must be 1 when returned, so we need to set it here. | |
| 57 | 59 | Address payload = encoded_word_.load(std::memory_order_relaxed); | |
| 60 | + #if defined(__illumos__) && defined(V8_TARGET_ARCH_64_BIT) | ||
| 61 | + // Unsigned types won't sign-extend on shift-right, but we need to do | ||
| 62 | + // this with illumos VA48 addressing. | ||
| 63 | + DCHECK_EQ(kObjectPointerOffset, 0); | ||
| 64 | + return (Address)((intptr_t)payload >> (int)kObjectPointerShift) | | ||
| 65 | + kHeapObjectTag; | ||
| 66 | + #else | ||
| 58 | 67 | return ((payload >> kObjectPointerShift) + kObjectPointerOffset) | | |
| 59 | 68 | kHeapObjectTag; | |
| 69 | + #endif /* __illumos__ & 64-bit */ | ||
| 60 | 70 | } | |
| 61 | 71 | ||
| 62 | 72 | Tagged<Code> JSDispatchEntry::GetCode() const { | |
@@ -214,7 +224,12 @@ void JSDispatchEntry::MakeFreelistEntry(uint32_t next_entry_index) { | |||
| 214 | 224 | bool JSDispatchEntry::IsFreelistEntry() const { | |
| 215 | 225 | #ifdef V8_TARGET_ARCH_64_BIT | |
| 216 | 226 | auto entrypoint = entrypoint_.load(std::memory_order_relaxed); | |
| 227 | + #ifdef __illumos__ | ||
| 228 | + // See the illumos definition of kFreeEntryTag for why we have to do this. | ||
| 229 | + return (entrypoint & 0xffff000000000000ull) == kFreeEntryTag; | ||
| 230 | + #else | ||
| 217 | 231 | return (entrypoint & kFreeEntryTag) == kFreeEntryTag; | |
| 232 | + #endif /* __illumos__ */ | ||
| 218 | 233 | #else | |
| 219 | 234 | return next_free_entry_.load(std::memory_order_relaxed) != 0; | |
| 220 | 235 | #endif | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -90,7 +90,22 @@ struct JSDispatchEntry { | |||
| 90 | 90 | #if defined(V8_TARGET_ARCH_64_BIT) | |
| 91 | 91 | // Freelist entries contain the index of the next free entry in their lower 32 | |
| 92 | 92 | // bits and are tagged with this tag. | |
| 93 | + #ifdef __illumos__ | ||
| 94 | + // In illumos 64-bit apps, pointers are allocated both the bottom 2^47 range | ||
| 95 | + // AND the top 2^47 range in the 64-bit space. Instead of 47 bits of VA space | ||
| 96 | + // we have 48 bits. This means, however, the top 16-bits may be 0xffff. We | ||
| 97 | + // therefore pick a different value for the kFreeEntryTag. If/when we go to | ||
| 98 | + // VA57, aka 5-level paging, we'll need to revisit this again, as will node | ||
| 99 | + // by default, since the fixed-bits on the high end will shrink from top | ||
| 100 | + // 16-bits to top 8-bits. | ||
| 101 | + // | ||
| 102 | + // Unless illumos ships an Oracle-Solaris-like VA47 link-time options to | ||
| 103 | + // restrict pointers from allocating from above the Virtual Address hole, | ||
| 104 | + // we need to be mindful of this. | ||
| 105 | + static constexpr Address kFreeEntryTag = 0xfeed000000000000ull; | ||
| 106 | + #else | ||
| 93 | 107 | static constexpr Address kFreeEntryTag = 0xffff000000000000ull; | |
| 108 | + #endif /* __illumos__ */ | ||
| 94 | 109 | #ifdef V8_TARGET_BIG_ENDIAN | |
| 95 | 110 | // 2-byte parameter count is on the least significant side of encoded_word_. | |
| 96 | 111 | static constexpr int kBigEndianParamCountOffset = | |
| Back | FazBrowse Home | New Git URL |
0 commit comments