Merge pull request #455 from rmottola/master

Intel fixes from rmottola
This commit is contained in:
Cameron Kaiser 2017-12-19 18:43:32 -08:00 committed by GitHub
commit c7ce866bf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 30 additions and 14 deletions

View File

@ -257,7 +257,8 @@ PluginInstanceChild::DoNPP_New()
Initialize(); Initialize();
#if defined(XP_MACOSX) && defined(__i386__) #if 0
//#if defined(XP_MACOSX) && defined(__i386__)
// If an i386 Mac OS X plugin has selected the Carbon event model then // If an i386 Mac OS X plugin has selected the Carbon event model then
// we have to fail. We do not support putting Carbon event model plugins // we have to fail. We do not support putting Carbon event model plugins
// out of process. Note that Carbon is the default model so out of process // out of process. Note that Carbon is the default model so out of process

View File

@ -218,6 +218,12 @@ struct writeBuf
int offset; int offset;
}; };
#ifdef __ppc__
#define TAG_CFF 0x43464620
#else
#define TAG_CFF 0x20464643
#endif
bool bool
ScaledFontMac::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton) ScaledFontMac::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton)
{ {
@ -233,7 +239,7 @@ ScaledFontMac::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton)
bool CFF = false; bool CFF = false;
for (CFIndex i = 0; i<count; i++) { for (CFIndex i = 0; i<count; i++) {
uint32_t tag = (uint32_t)(uintptr_t)CFArrayGetValueAtIndex(tags, i); uint32_t tag = (uint32_t)(uintptr_t)CFArrayGetValueAtIndex(tags, i);
if (tag == 0x43464620) // 'CFF ' if (tag == TAG_CFF) // 'CFF '
CFF = true; CFF = true;
CFDataRef data = CGFontCopyTableForTag(mFont, tag); CFDataRef data = CGFontCopyTableForTag(mFont, tag);
records[i].tag = tag; records[i].tag = tag;
@ -283,11 +289,8 @@ ScaledFontMac::GetFontFileData(FontFileDataOutput aDataCallback, void *aBaton)
uint32_t *wtable = (reinterpret_cast<uint32_t *>(table.Elements())); uint32_t *wtable = (reinterpret_cast<uint32_t *>(table.Elements()));
TableRecord *records = new TableRecord[count]; TableRecord *records = new TableRecord[count];
for (uint32_t i=3; i<(sizer/4); i+=4) { // Skip header for (uint32_t i=3; i<(sizer/4); i+=4) { // Skip header
#ifndef __ppc__
#error need little-endian version
#endif
uint32_t tag = wtable[i]; uint32_t tag = wtable[i];
if (tag == 0x43464620) // 'CFF ' if (tag == TAG_CFF)
CFF = true; CFF = true;
// We know the length from the directory, so we can simply import // We know the length from the directory, so we can simply import
// the data. We assume the table exists, and OMG if it doesn't. // the data. We assume the table exists, and OMG if it doesn't.

View File

@ -488,7 +488,7 @@ MacOSFontEntry::GetFontTable(uint32_t aTag)
if (MOZ_LIKELY(mFontTableDirSize > 0)) { if (MOZ_LIKELY(mFontTableDirSize > 0)) {
// XXX: This assumes big endian (warning Intel) // XXX: This assumes big endian (warning Intel)
#ifndef __ppc__ #ifndef __ppc__
#error needs GetFontTable fast path needs little endian version #warning needs GetFontTable fast path needs little endian version
#endif #endif
#ifdef DEBUG_X #ifdef DEBUG_X

View File

@ -72,8 +72,10 @@ inline int Log2Floor(uint32 n) {
#endif /* endianness */ #endif /* endianness */
#endif /* CPU whitelist */ #endif /* CPU whitelist */
#if !defined(__i386) && !defined(__x86_64__)
#ifndef WOFF_BIG_ENDIAN #ifndef WOFF_BIG_ENDIAN
#error unexpected endianness #error unexpected endianness
#endif #endif
#endif /* !defined(__i386) && !defined(__x86_64__) */
#endif // WOFF2_PORT_H_ #endif // WOFF2_PORT_H_

View File

@ -37,6 +37,14 @@
#include <ucontext.h> #include <ucontext.h>
#endif #endif
#ifdef XP_MACOSX
#ifndef __ppc__
#include <sys/ucontext.h>
#include <mach/mach_types.h>
#include <mach/thread_status.h>
#endif
#endif
static char _progname[1024] = "huh?"; static char _progname[1024] = "huh?";
// Note: some tests manipulate this value. // Note: some tests manipulate this value.
@ -160,14 +168,14 @@ static void fpehandler(int signum, siginfo_t *si, void *context)
ucontext_t *uc = (ucontext_t *)context; ucontext_t *uc = (ucontext_t *)context;
#if defined(__i386__) || defined(__amd64__) #if defined(__i386__) || defined(__amd64__)
_STRUCT_FP_CONTROL *ctrl = &uc->uc_mcontext->__fs.__fpu_fcw; fp_control *ctrl = &uc->uc_mcontext->fs.fpu_fcw;
ctrl->__invalid = ctrl->__denorm = ctrl->__zdiv = ctrl->__ovrfl = ctrl->__undfl = ctrl->__precis = 1; ctrl->invalid = ctrl->denorm = ctrl->zdiv = ctrl->ovrfl = ctrl->undfl = ctrl->precis = 1;
_STRUCT_FP_STATUS *status = &uc->uc_mcontext->__fs.__fpu_fsw; fp_status *status = &uc->uc_mcontext->fs.fpu_fsw;
status->__invalid = status->__denorm = status->__zdiv = status->__ovrfl = status->__undfl = status->invalid = status->denorm = status->zdiv = status->ovrfl = status->undfl =
status->__precis = status->__stkflt = status->__errsumm = 0; status->precis = status->stkflt = status->errsumm = 0;
uint32_t *mxcsr = &uc->uc_mcontext->__fs.__fpu_mxcsr; uint32_t *mxcsr = &uc->uc_mcontext->fs.fpu_mxcsr;
*mxcsr |= SSE_EXCEPTION_MASK; /* disable all SSE exceptions */ *mxcsr |= SSE_EXCEPTION_MASK; /* disable all SSE exceptions */
*mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */ *mxcsr &= ~SSE_STATUS_FLAGS; /* clear all pending SSE exceptions */
#endif #endif

View File

@ -12,7 +12,8 @@
#include "nscore.h" #include "nscore.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#if MOZILLA_MAY_SUPPORT_SSE2
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#include "mozilla/SSE.h" #include "mozilla/SSE.h"
#endif #endif

View File

@ -48,6 +48,7 @@ using namespace mozilla;
#ifdef XP_MACOSX #ifdef XP_MACOSX
typedef int cpu_type_t; // we don't have cpu_type* on 10.4. typedef int cpu_type_t; // we don't have cpu_type* on 10.4.
#define CPU_TYPE_ANY ((cpu_type_t) -1) #define CPU_TYPE_ANY ((cpu_type_t) -1)
#define CPU_TYPE_X86 ((cpu_type_t) 7)
#define CPU_TYPE_POWERPC ((cpu_type_t) 18) #define CPU_TYPE_POWERPC ((cpu_type_t) 18)
cpu_type_t pref_cpu_types[2] = { cpu_type_t pref_cpu_types[2] = {