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