| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2243e58 commit 5e41e52
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 | |
|---|---|---|---|
@@ -2043,7 +2043,16 @@ TNode<Code> CodeStubAssembler::LoadCodeObjectFromJSDispatchTable( | |||
| 2043 | 2043 | TNode<UintPtrT> shifted_value; | |
| 2044 | 2044 | if (JSDispatchEntry::kObjectPointerOffset == 0) { | |
| 2045 | 2045 | shifted_value = | |
| 2046 | + #if defined(__illumos__) && defined(V8_HOST_ARCH_64_BIT) | ||
| 2047 | + // Pointers in illumos span both the low 2^47 range and the high 2^47 range | ||
| 2048 | + // as well. Checking the high bit being set in illumos means all higher bits | ||
| 2049 | + // need to be set to 1 after shifting right. | ||
| 2050 | + // Use WordSar() so any high-bit check wouldn't be necessary. | ||
| 2051 | + UncheckedCast<UintPtrT>(WordSar(UncheckedCast<IntPtrT>(value), | ||
| 2052 | + IntPtrConstant(JSDispatchEntry::kObjectPointerShift))); | ||
| 2053 | + #else | ||
| 2046 | 2054 | WordShr(value, UintPtrConstant(JSDispatchEntry::kObjectPointerShift)); | |
| 2055 | + #endif /* __illumos__ and 64-bit */ | ||
| 2047 | 2056 | } else { | |
| 2048 | 2057 | shifted_value = UintPtrAdd( | |
| 2049 | 2058 | WordShr(value, UintPtrConstant(JSDispatchEntry::kObjectPointerShift)), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,13 +25,15 @@ void JSDispatchEntry::MakeJSDispatchEntry(Address object, Address entrypoint, | |||
| 25 | 25 | uint16_t parameter_count, | |
| 26 | 26 | bool mark_as_alive) { | |
| 27 | 27 | DCHECK_EQ(object & kHeapObjectTag, 0); | |
| 28 | + #if !defined(__illumos__) || !defined(V8_TARGET_ARCH_64_BIT) | ||
| 28 | 29 | DCHECK_EQ((((object - kObjectPointerOffset) << kObjectPointerShift) >> | |
| 29 | 30 | kObjectPointerShift) + | |
| 30 | 31 | kObjectPointerOffset, | |
| 31 | 32 | object); | |
| 32 | 33 | DCHECK_EQ((object - kObjectPointerOffset) + kObjectPointerOffset, object); | |
| 33 | 34 | DCHECK_LT((object - kObjectPointerOffset), | |
| 34 | 35 | 1ULL << ((sizeof(encoded_word_) * 8) - kObjectPointerShift)); | |
| 36 | + #endif /* __illumos__ & 64-bit */ | ||
| 35 | 37 | ||
| 36 | 38 | Address payload = ((object - kObjectPointerOffset) << kObjectPointerShift) | | |
| 37 | 39 | (parameter_count & kParameterCountMask); | |
@@ -57,8 +59,16 @@ Address JSDispatchEntry::GetCodePointer() const { | |||
| 57 | 59 | // and so may be 0 or 1 here. As the return value is a tagged pointer, the | |
| 58 | 60 | // bit must be 1 when returned, so we need to set it here. | |
| 59 | 61 | Address payload = encoded_word_.load(std::memory_order_acquire); | |
| 62 | + #if defined(__illumos__) && defined(V8_TARGET_ARCH_64_BIT) | ||
| 63 | + // Unsigned types won't sign-extend on shift-right, but we need to do | ||
| 64 | + // this with illumos VA48 addressing. | ||
| 65 | + DCHECK_EQ(kObjectPointerOffset, 0); | ||
| 66 | + return (Address)((intptr_t)payload >> (int)kObjectPointerShift) | | ||
| 67 | + kHeapObjectTag; | ||
| 68 | + #else | ||
| 60 | 69 | return ((payload >> kObjectPointerShift) + kObjectPointerOffset) | | |
| 61 | 70 | kHeapObjectTag; | |
| 71 | + #endif /* __illumos__ & 64-bit */ | ||
| 62 | 72 | } | |
| 63 | 73 | ||
| 64 | 74 | Tagged<Code> JSDispatchEntry::GetCode() const { | |
@@ -220,7 +230,12 @@ void JSDispatchEntry::MakeFreelistEntry(uint32_t next_entry_index) { | |||
| 220 | 230 | bool JSDispatchEntry::IsFreelistEntry() const { | |
| 221 | 231 | #ifdef V8_TARGET_ARCH_64_BIT | |
| 222 | 232 | auto entrypoint = entrypoint_.load(std::memory_order_relaxed); | |
| 233 | + #ifdef __illumos__ | ||
| 234 | + // See the illumos definition of kFreeEntryTag for why we have to do this. | ||
| 235 | + return (entrypoint & 0xffff000000000000ull) == kFreeEntryTag; | ||
| 236 | + #else | ||
| 223 | 237 | return (entrypoint & kFreeEntryTag) == kFreeEntryTag; | |
| 238 | + #endif /* __illumos__ */ | ||
| 224 | 239 | #else | |
| 225 | 240 | return next_free_entry_.load(std::memory_order_relaxed) != 0; | |
| 226 | 241 | #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