Hi There,
I'm working on embedding V8 (v9.0.257) in a C++ project and found SharedFunctionInfo::IsUserJavaScript() coredump on native function.
Symptom
Get a native function (e.g. Array.push) as x, then call x.shared().IsUserJavaScript(), a coredump will occur on v9.0.257.
I did the same on v8.4, it returned false.
Possible Root Cause
In v9.0.257: SharedFunctionInfo::IsUserJavaScript() => SharedFunctionInfo::script() => script_or_debug_info(kAcquireLoad), but in v8.4 script_or_debug_info() is called.
I suspect the acquire and release feature introduced in v9.0 is not well taken care of by native function.
Workaround
Currently, my workaround is as following.
auto v8InternalShared = v8InternalFunction.shared();
if (v8InternalShared.native()) {
// native
}
else if (v8InternalShared.IsApiFunction()) {
// api
}
else if (v8InternalShared.IsUserJavaScript()) {
// user
}
My expectation is I don't need to call the first 2 API to prevent coredump, but call IsUserJavaScript() directly.
Summary
I just browsed the master branch and found the related code was identical to v9.0.257. I'm quite new to this group, please forgive me for not being professional here. May I know if someone will check this out?
Thank you,
Sam