Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2023-03-20 12:34:16 +08:00
commit b03f6dd26e
5 changed files with 30 additions and 13 deletions

View file

@ -84,8 +84,9 @@ DataAtOffset(DataSourceSurface* aSurface,
MOZ_ASSERT(Factory::CheckSurfaceSize(aSurface->GetSize()),
"surface size overflows - this should have been prevented when the surface was created");
uint8_t* data = aMap->mData + aPoint.y * aMap->mStride +
aPoint.x * BytesPerPixel(aSurface->GetFormat());
uint8_t* data = aMap->mData +
size_t(aPoint.y) * size_t(aMap->mStride) +
size_t(aPoint.x) * size_t(BytesPerPixel(aSurface->GetFormat()));
if (data < aMap->mData) {
MOZ_CRASH("GFX: out-of-range data access");
@ -124,22 +125,29 @@ void
CopySurfaceDataToPackedArray(uint8_t* aSrc, uint8_t* aDst, IntSize aSrcSize,
int32_t aSrcStride, int32_t aBytesPerPixel)
{
MOZ_ASSERT(aBytesPerPixel > 0,
"Negative stride for aDst not currently supported");
MOZ_ASSERT(BufferSizeFromStrideAndHeight(aSrcStride, aSrcSize.height) > 0,
"How did we end up with a surface with such a big buffer?");
CheckedInt<size_t> packedStride(aBytesPerPixel);
packedStride *= aSrcSize.width;
if (!packedStride.isValid()) {
MOZ_ASSERT(false, "Invalid stride");
return;
}
int packedStride = aSrcSize.width * aBytesPerPixel;
CheckedInt<size_t> totalSize(aSrcStride);
totalSize *= aSrcSize.height;
if (!totalSize.isValid()) {
MOZ_ASSERT(false, "Invalid surface size");
return;
}
if (aSrcStride == packedStride) {
if (size_t(aSrcStride) == packedStride.value()) {
// aSrc is already packed, so we can copy with a single memcpy.
memcpy(aDst, aSrc, packedStride * aSrcSize.height);
memcpy(aDst, aSrc, totalSize.value());
} else {
// memcpy one row at a time.
for (int row = 0; row < aSrcSize.height; ++row) {
memcpy(aDst, aSrc, packedStride);
memcpy(aDst, aSrc, packedStride.value());
aSrc += aSrcStride;
aDst += packedStride;
aDst += packedStride.value();
}
}
}

View file

@ -3757,6 +3757,7 @@ CodeGenerator::visitCallNative(LCallNative* call)
if (jitInfo && jitInfo->type() == JSJitInfo::IgnoresReturnValueNative)
native = jitInfo->ignoresReturnValueMethod;
}
ensureOsiSpace();
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, native));
emitTracelogStopEvent(TraceLogger_Call);
@ -3881,6 +3882,7 @@ CodeGenerator::visitCallDOMNative(LCallDOMNative* call)
masm.passABIArg(argObj);
masm.passABIArg(argPrivate);
masm.passABIArg(argArgs);
ensureOsiSpace();
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, target->jitInfo()->method));
if (target->jitInfo()->isInfallible) {
@ -4006,6 +4008,7 @@ CodeGenerator::visitCallGeneric(LCallGeneric* call)
// Finally call the function in objreg.
masm.bind(&makeCall);
ensureOsiSpace();
uint32_t callOffset = masm.callJit(objreg);
markSafepointAt(callOffset, call);
@ -4104,6 +4107,7 @@ CodeGenerator::visitCallKnown(LCallKnown* call)
masm.Push(Imm32(descriptor));
// Finally call the function in objreg.
ensureOsiSpace();
uint32_t callOffset = masm.callJit(objreg);
markSafepointAt(callOffset, call);
@ -4436,6 +4440,7 @@ CodeGenerator::emitApplyGeneric(T* apply)
masm.bind(&rejoin);
// Finally call the function in objreg, as assigned by one of the paths above.
ensureOsiSpace();
uint32_t callOffset = masm.callJit(objreg);
markSafepointAt(callOffset, apply);
@ -11244,6 +11249,7 @@ CodeGenerator::visitGetDOMProperty(LGetDOMProperty* ins)
masm.passABIArg(ObjectReg);
masm.passABIArg(PrivateReg);
masm.passABIArg(ValueReg);
ensureOsiSpace();
masm.callWithABI(JS_FUNC_TO_DATA_PTR(void*, ins->mir()->fun()));
if (ins->mir()->isInfallible()) {

View file

@ -1112,7 +1112,6 @@ CodeGeneratorShared::ensureOsiSpace()
}
MOZ_ASSERT_IF(!masm.oom(),
masm.currentOffset() - lastOsiPointOffset_ >= Assembler::PatchWrite_NearCallSize());
lastOsiPointOffset_ = masm.currentOffset();
}
uint32_t
@ -1124,6 +1123,7 @@ CodeGeneratorShared::markOsiPoint(LOsiPoint* ins)
uint32_t offset = masm.currentOffset();
SnapshotOffset so = ins->snapshot()->snapshotOffset();
masm.propagateOOM(osiIndices_.append(OsiIndex(offset, so)));
lastOsiPointOffset_ = offset;
return offset;
}

View file

@ -15,7 +15,6 @@ ifeq (,$(filter SunOS Linux WINNT,$(OS_ARCH)))
else
$(MAKE) stage-package make-buildinfo-file
@echo 'Compressing...'
cd $(DIST)/$(MOZ_PKG_DIR); $(CREATE_PRECOMPLETE_CMD)
ifeq (WINNT,$(OS_ARCH))
cd $(DIST); $(CYGWIN_WRAPPER) 7z a -t7z -m0=lzma2 -mx=9 -aoa -bb3 $(PKG_BASENAME).7z $(MOZ_PKG_DIR)
else

View file

@ -55,6 +55,10 @@ stage-package: $(MOZ_PKG_MANIFEST) $(MOZ_PKG_MANIFEST_DEPS)
$(MOZ_PKG_MANIFEST) '$(DIST)' '$(DIST)'/$(STAGEPATH)$(MOZ_PKG_DIR)$(if $(MOZ_PKG_MANIFEST),,$(_BINPATH)) \
$(if $(filter omni,$(MOZ_PACKAGER_FORMAT)),$(if $(NON_OMNIJAR_FILES),--non-resource $(NON_OMNIJAR_FILES)))
$(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/find-dupes.py $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)
ifneq (Darwin, $(OS_ARCH))
# We don't want to do this on Mac as it will end up in the package root which is not how Mac packages things
cd $(DIST)/$(MOZ_PKG_DIR) && $(CREATE_PRECOMPLETE_CMD)
endif
ifdef MOZ_PACKAGE_JSSHELL
# Package JavaScript Shell
@echo 'Packaging JavaScript Shell...'