Repository navigation
perf: use v8::Local<v8::Object> as the key in ObjectCache - #43519
Conversation
MarshallOfSound
left a comment
There was a problem hiding this comment.
I think I thought about this when writing ctx bridge originally, the theory was that concurrent marking / GC could do strange thing if we keyed off of pointer instead of the underlying object hash as the object could move within the heap during a single ctx bridge evaluation.
|
@MarshallOfSound you're right; this PR will break in IndirectHandleBase if the internal::Address pointer changes. Using a Local ptr or slot as a map key is fundamentally unsafe |
|
Updated to use Note, we don't need to provide a custom |
6b26c8e to
1e9ba49
Compare
b3303ed to
dbb06fa
Compare
|
No Release Notes |
|
I was unable to backport this PR to "31-x-y" cleanly; |
|
I was unable to backport this PR to "32-x-y" cleanly; |
|
I have automatically backported this PR to "33-x-y", please check out #43568 |
|
@codebytere has manually backported this PR to "32-x-y", please check out #43662 |
Description of Change
Followup to #27639
This cache is a
v8::Object-to-v8::Local<v8::Value>lookup.We're currently using
v8::Local<v8::Object>as the key in a two-step process: first we hash the object as astd::unordered_mapkey. Second, we walk through a linked list of previously-cachedv8::Local<v8::Object>s looking for one that matches our key. Handles check for equality viav8::HandleHelper::EqualHandles(), so this is basically just testing pointers for equality (a.ptr() == b.ptr()).This PR skips the middle steps and just uses a
v8::Object*v8::Local<v8::Object>as the keyChecklist
npm testpassesRelease Notes
Notes: none.