summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-28 18:00:45 -0500
committerMatt A. Tobin <email@mattatobin.com>2020-02-28 18:00:45 -0500
commit65b37410ca38005bd6f4c9470c93a49cd12ad368 (patch)
treec65f22f3ed2fda8b9b3ff36c029020bd1500d946
parent6a3d5769d01ec1a8dd56ea79aec2df91b801ce02 (diff)
downloadUXP-65b37410ca38005bd6f4c9470c93a49cd12ad368.tar
UXP-65b37410ca38005bd6f4c9470c93a49cd12ad368.tar.gz
UXP-65b37410ca38005bd6f4c9470c93a49cd12ad368.tar.lz
UXP-65b37410ca38005bd6f4c9470c93a49cd12ad368.tar.xz
UXP-65b37410ca38005bd6f4c9470c93a49cd12ad368.zip
Revert "Issue #190 - Part 1: Remove XP_IOS conditional code"
This reverts commit 6a3d5769d01ec1a8dd56ea79aec2df91b801ce02.
-rw-r--r--build/moz.configure/init.configure7
-rw-r--r--config/gcc-stl-wrapper.template.h2
-rw-r--r--gfx/2d/MacIOSurface.h6
-rw-r--r--ipc/glue/SharedMemoryBasic_mach.mm11
-rw-r--r--js/src/irregexp/NativeRegExpMacroAssembler.cpp13
-rw-r--r--js/src/jit/ExecutableAllocator.h7
-rw-r--r--js/src/jit/arm/Architecture-arm.h11
-rw-r--r--toolkit/xre/UIKitDirProvider.h13
-rw-r--r--toolkit/xre/nsXREDirProvider.cpp11
-rw-r--r--xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp4
10 files changed, 79 insertions, 6 deletions
diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
index 3ee8acfcb..713b2ce61 100644
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -551,6 +551,13 @@ def target_is_darwin(target):
set_define('XP_DARWIN', target_is_darwin)
@depends(target)
+def target_is_ios(target):
+ if target.kernel == 'Darwin' and target.os == 'iOS':
+ return True
+
+set_define('XP_IOS', target_is_ios)
+
+@depends(target)
def target_is_osx(target):
if target.kernel == 'Darwin' and target.os == 'OSX':
return True
diff --git a/config/gcc-stl-wrapper.template.h b/config/gcc-stl-wrapper.template.h
index 44fa8397d..9b4a61d24 100644
--- a/config/gcc-stl-wrapper.template.h
+++ b/config/gcc-stl-wrapper.template.h
@@ -10,7 +10,7 @@
// For some reason, Apple's GCC refuses to honor -fno-exceptions when
// compiling ObjC.
-#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__)
+#if defined(__EXCEPTIONS) && __EXCEPTIONS && !(__OBJC__ && __GNUC__ && XP_IOS)
# error "STL code can only be used with -fno-exceptions"
#endif
diff --git a/gfx/2d/MacIOSurface.h b/gfx/2d/MacIOSurface.h
index 7dcefeb5d..0d4f79a15 100644
--- a/gfx/2d/MacIOSurface.h
+++ b/gfx/2d/MacIOSurface.h
@@ -17,6 +17,12 @@ typedef _CGLContextObject* CGLContextObj;
typedef struct CGContext* CGContextRef;
typedef struct CGImage* CGImageRef;
typedef uint32_t IOSurfaceID;
+
+#ifdef XP_IOS
+typedef kern_return_t IOReturn;
+typedef int CGLError;
+#endif
+
typedef CFTypeRef IOSurfacePtr;
typedef IOSurfacePtr (*IOSurfaceCreateFunc) (CFDictionaryRef properties);
typedef IOSurfacePtr (*IOSurfaceLookupFunc) (uint32_t io_surface_id);
diff --git a/ipc/glue/SharedMemoryBasic_mach.mm b/ipc/glue/SharedMemoryBasic_mach.mm
index 68aabecc6..88753ee2e 100644
--- a/ipc/glue/SharedMemoryBasic_mach.mm
+++ b/ipc/glue/SharedMemoryBasic_mach.mm
@@ -9,7 +9,18 @@
#include <mach/vm_map.h>
#include <mach/mach_port.h>
+#if defined(XP_IOS)
+#include <mach/vm_map.h>
+#define mach_vm_address_t vm_address_t
+#define mach_vm_allocate vm_allocate
+#define mach_vm_deallocate vm_deallocate
+#define mach_vm_map vm_map
+#define mach_vm_read vm_read
+#define mach_vm_region_recurse vm_region_recurse_64
+#define mach_vm_size_t vm_size_t
+#else
#include <mach/mach_vm.h>
+#endif
#include <pthread.h>
#include <unistd.h>
#include "SharedMemoryBasic.h"
diff --git a/js/src/irregexp/NativeRegExpMacroAssembler.cpp b/js/src/irregexp/NativeRegExpMacroAssembler.cpp
index f452de6ba..0fb507297 100644
--- a/js/src/irregexp/NativeRegExpMacroAssembler.cpp
+++ b/js/src/irregexp/NativeRegExpMacroAssembler.cpp
@@ -132,6 +132,14 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext* cx, bool match_only)
pushedNonVolatileRegisters++;
}
+#if defined(XP_IOS) && defined(JS_CODEGEN_ARM)
+ // The stack is 4-byte aligned on iOS, force 8-byte alignment.
+ masm.movePtr(StackPointer, temp0);
+ masm.andPtr(Imm32(~7), StackPointer);
+ masm.push(temp0);
+ masm.push(temp0);
+#endif
+
#ifndef JS_CODEGEN_X86
// The InputOutputData* is stored as an argument, save it on the stack
// above the frame.
@@ -398,6 +406,11 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext* cx, bool match_only)
masm.freeStack(frameSize);
#endif
+#if defined(XP_IOS) && defined(JS_CODEGEN_ARM)
+ masm.pop(temp0);
+ masm.movePtr(temp0, StackPointer);
+#endif
+
// Restore non-volatile registers which were saved on entry.
for (GeneralRegisterBackwardIterator iter(savedNonVolatileRegisters); iter.more(); ++iter)
masm.Pop(*iter);
diff --git a/js/src/jit/ExecutableAllocator.h b/js/src/jit/ExecutableAllocator.h
index 20f11f14f..30eccd12e 100644
--- a/js/src/jit/ExecutableAllocator.h
+++ b/js/src/jit/ExecutableAllocator.h
@@ -69,7 +69,7 @@ extern "C" void sync_instruction_memory(caddr_t v, u_int len);
#include <sys/cachectl.h>
#endif
-#ifdef JS_CODEGEN_ARM
+#if defined(JS_CODEGEN_ARM) && defined(XP_IOS)
#include <libkern/OSCacheControl.h>
#endif
@@ -256,6 +256,11 @@ class ExecutableAllocator
{
__clear_cache(code, reinterpret_cast<char*>(code) + size);
}
+#elif (defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64)) && defined(XP_IOS)
+ static void cacheFlush(void* code, size_t size)
+ {
+ sys_icache_invalidate(code, size);
+ }
#elif defined(JS_CODEGEN_ARM) && (defined(__linux__) || defined(ANDROID)) && defined(__GNUC__)
static void cacheFlush(void* code, size_t size)
{
diff --git a/js/src/jit/arm/Architecture-arm.h b/js/src/jit/arm/Architecture-arm.h
index 0c47c0250..5e3db5ae2 100644
--- a/js/src/jit/arm/Architecture-arm.h
+++ b/js/src/jit/arm/Architecture-arm.h
@@ -17,7 +17,7 @@
// GCC versions 4.6 and above define __ARM_PCS_VFP to denote a hard-float
// ABI target. The iOS toolchain doesn't define anything specific here,
// but iOS always supports VFP.
-#ifdef__ARM_PCS_VFP
+#if defined(__ARM_PCS_VFP) || defined(XP_IOS)
#define JS_CODEGEN_ARM_HARDFP
#endif
@@ -114,7 +114,12 @@ class Registers
(1 << r0) |
(1 << r1) |
(1 << Registers::r2) |
- (1 << Registers::r3);
+ (1 << Registers::r3)
+#if defined(XP_IOS)
+ // per https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html#//apple_ref/doc/uid/TP40009021-SW4
+ | (1 << Registers::r9)
+#endif
+ ;
static const SetType NonVolatileMask =
(1 << Registers::r4) |
@@ -122,7 +127,9 @@ class Registers
(1 << Registers::r6) |
(1 << Registers::r7) |
(1 << Registers::r8) |
+#if !defined(XP_IOS)
(1 << Registers::r9) |
+#endif
(1 << Registers::r10) |
(1 << Registers::r11) |
(1 << Registers::r12) |
diff --git a/toolkit/xre/UIKitDirProvider.h b/toolkit/xre/UIKitDirProvider.h
new file mode 100644
index 000000000..c74596125
--- /dev/null
+++ b/toolkit/xre/UIKitDirProvider.h
@@ -0,0 +1,13 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef TOOLKIT_XRE_UIKITDIRPROVIDER_H_
+#define TOOLKIT_XRE_UIKITDIRPROVIDER_H_
+
+#include "nsString.h"
+
+bool GetUIKitDirectory(bool aLocal, nsACString& aUserDir);
+
+#endif // TOOLKIT_XRE_UIKITDIRPROVIDER_H_
diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
index 158fe541b..151eb34e5 100644
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -58,6 +58,9 @@
#ifdef XP_UNIX
#include <ctype.h>
#endif
+#ifdef XP_IOS
+#include "UIKitDirProvider.h"
+#endif
#if defined(XP_MACOSX)
#define APP_REGISTRY_NAME "Application Registry"
@@ -1307,6 +1310,14 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal)
NS_ENSURE_SUCCESS(rv, rv);
localDir = do_QueryInterface(dirFileMac, &rv);
+#elif defined(XP_IOS)
+ nsAutoCString userDir;
+ if (GetUIKitDirectory(aLocal, userDir)) {
+ rv = NS_NewNativeLocalFile(userDir, true, getter_AddRefs(localDir));
+ } else {
+ rv = NS_ERROR_FAILURE;
+ }
+ NS_ENSURE_SUCCESS(rv, rv);
#elif defined(XP_WIN)
nsString path;
if (aLocal) {
diff --git a/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp b/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp
index 7c16d0146..ef725e5e3 100644
--- a/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp
+++ b/xpcom/reflect/xptcall/md/unix/xptcinvoke_arm.cpp
@@ -9,8 +9,8 @@
#include "mozilla/Compiler.h"
-#if !defined(__arm__) && !defined(LINUX)
-#error "This code is for Linux ARM only. Check that it works on your system, too.\nBeware that this code is highly compiler dependent."
+#if !defined(__arm__) && !(defined(LINUX) || defined(XP_IOS))
+#error "This code is for Linux/iOS ARM only. Check that it works on your system, too.\nBeware that this code is highly compiler dependent."
#endif
#if MOZ_IS_GCC