New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(android): use C++14 when building native modules #12481
Conversation
Tests:
|
We still have a V8 backward compatibility issue in 10.0.0 with previously built modules. We currently fail the I'm seeing the following get logged when a method with multiple arguments gets called.
Also, 10.0.0 built modules will have their min API Level set to 21 (matching Titanium 10.0.0's min API Level), which is a problem if you want to use that module in 9.x.x built apps. It will cause an app build failure. This has nothing to do with our V8 change, but we should probably work-around it anyways. Simple solution is to hard-code the module's "build.gradle" |
I've isolated the issue. As of V8 version 8.8, Google has made a breaking-change where method arguments are now stored in reverse order. If you look in the "v8.h" file, look for the In version 8.8, it looks like this... template<typename T>
Local<Value> FunctionCallbackInfo<T>::operator[](int i) const {
// values_ points to the first argument (not the receiver).
if (i < 0 || length_ <= i) return Local<Value>(*Undefined(GetIsolate()));
return Local<Value>(reinterpret_cast<Value*>(values_ + i));
} In version 8.7, it looks like the below. And we're not defining the template<typename T>
Local<Value> FunctionCallbackInfo<T>::operator[](int i) const {
// values_ points to the first argument (not the receiver).
if (i < 0 || length_ <= i) return Local<Value>(*Undefined(GetIsolate()));
#ifdef V8_REVERSE_JSARGS
return Local<Value>(reinterpret_cast<Value*>(values_ + i));
#else
return Local<Value>(reinterpret_cast<Value*>(values_ - i));
#endif
} Unfortunately, this method call is inlined. This explains why the method's 2nd argument returns the "this" object for older modules running in Titanium 10.0.0. And I would expect 10.0.0 built modules to have the reverse problem when running in a Titanium 9.x.x app. I can't think of any work-around to maintain backward compatibility other than to revert V8 back to version 8.7. |
I made a patch to disable I'll try to revert their commit v8/v8@50ddb12 |
I literally just read about this the other day: https://v8.dev/blog/v8-release-89. They reverse the arguments to optimize for when the number of arguments mismatches the function signature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR/FR: Pass
I ran the following tests:
- Exercised all JS types with 9.2.0 built module from PR test: module backward compatibility #12311 with 10.0.0 built app.
- Built "ti.imagefactory" module with 10.0.0 and ran its example app.
- Used 10.0.0 built "ti.imagefactory" module in 10.0.0 built app on x86, x86_64, ARM32, ARM64.
- Used 10.0.0 built "ti.imagefactory" module in 9.0.0 built app on x86, x86_64, ARM32, ARM64.
- Built kitchensink-v2 with 10.0.0 and ran on x86_64 and ARM64. (Verified maps worked.)
c++14
when building native modules8.8.278.17
that includes compatibility patch to revert v8/v8@50ddb12NOTE: We should check modules built with TiSDK 10.0 work on TiSDK 9.3.X