mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1533890: Add simulator support for IgnoresReturnValue version of native functions r=mgaudet
Native calls in the simulator have to be redirected to a special swi instruction. In the old implementation, this redirection did not support calling the IgnoresReturnValue version of a native function. This patch fixes that problem in the new implementation. Differential Revision: https://phabricator.services.mozilla.com/D22775 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
777a20a753
commit
97c1196748
@ -1125,18 +1125,28 @@ class MOZ_RAII CacheIRWriter : public JS::CustomAutoRooter {
|
||||
bool isCrossRealm = cx_->realm() != calleeFunc->realm();
|
||||
buffer_.writeByte(uint32_t(isCrossRealm));
|
||||
|
||||
// Some native functions can be implemented faster if we know that
|
||||
// the return value is ignored.
|
||||
bool ignoresReturnValue =
|
||||
op == JSOP_CALL_IGNORES_RV && calleeFunc->hasJitInfo() &&
|
||||
calleeFunc->jitInfo()->type() == JSJitInfo::IgnoresReturnValueNative;
|
||||
|
||||
#ifdef JS_SIMULATOR
|
||||
// The simulator requires VM calls to be redirected to a special
|
||||
// swi instruction to handle them, so we store the redirected
|
||||
// pointer in the stub and use that instead of the original one.
|
||||
// If we are calling the ignoresReturnValue version of a native
|
||||
// function, we bake it into the redirected pointer.
|
||||
// (See BaselineCacheIRCompiler::emitCallNativeFunction.)
|
||||
void* target = JS_FUNC_TO_DATA_PTR(void*, calleeFunc->native());
|
||||
void* redirected = Simulator::RedirectNativeFunction(target, Args_General3);
|
||||
JSNative target = ignoresReturnValue
|
||||
? calleeFunc->jitInfo()->ignoresReturnValueMethod
|
||||
: calleeFunc->native();
|
||||
void* rawPtr = JS_FUNC_TO_DATA_PTR(void*, target);
|
||||
void* redirected = Simulator::RedirectNativeFunction(rawPtr, Args_General3);
|
||||
addStubField(uintptr_t(redirected), StubField::Type::RawWord);
|
||||
#else
|
||||
bool ignoresReturnValue =
|
||||
op == JSOP_CALL_IGNORES_RV && calleeFunc->hasJitInfo() &&
|
||||
calleeFunc->jitInfo()->type() == JSJitInfo::IgnoresReturnValueNative;
|
||||
// If we are not running in the simulator, we generate different jitcode
|
||||
// to find the ignoresReturnValue version of a native function.
|
||||
buffer_.writeByte(ignoresReturnValue);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user