summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-10-14 16:57:01 +0000
committerMatt A. Tobin <email@mattatobin.com>2021-10-14 14:59:59 -0400
commit38228cf5cd66dc06a044e00fa4020076e310c6d7 (patch)
tree327a790a5623ca8c03338f25da7f3acbdc20e0a6 /js
parent60e8b05a510f704758de029bec8c3c6429cc7d3c (diff)
downloadaura-central-38228cf5cd66dc06a044e00fa4020076e310c6d7.tar.gz
Issue %3020 - Part 2: First pass Android defines and remove Android Annotation
processors, some Andoid packaging stuff, Eclipse IDE support et al.
Diffstat (limited to 'js')
-rw-r--r--js/src/ctypes/libffi/src/closures.c2
-rw-r--r--js/src/ds/MemoryProtectionExceptionHandler.cpp6
-rw-r--r--js/src/jit/ExecutableAllocator.h2
-rw-r--r--js/src/jit/arm/Architecture-arm.cpp9
-rw-r--r--js/src/jscntxt.cpp61
-rw-r--r--js/src/jsmath.cpp2
-rw-r--r--js/src/jsnativestack.cpp44
-rw-r--r--js/src/vtune/jitprofiling.c7
-rw-r--r--js/src/wasm/WasmSignalHandlers.cpp106
-rw-r--r--js/xpconnect/loader/mozJSComponentLoader.cpp6
-rw-r--r--js/xpconnect/src/Sandbox.cpp4
-rw-r--r--js/xpconnect/src/XPCJSContext.cpp6
-rw-r--r--js/xpconnect/src/XPCShellImpl.cpp7
13 files changed, 12 insertions, 250 deletions
diff --git a/js/src/ctypes/libffi/src/closures.c b/js/src/ctypes/libffi/src/closures.c
index c7863f3d0..fba4e2a6a 100644
--- a/js/src/ctypes/libffi/src/closures.c
+++ b/js/src/ctypes/libffi/src/closures.c
@@ -34,7 +34,7 @@
#include <ffi_common.h>
#if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
-# if __gnu_linux__ && !defined(__ANDROID__)
+# if __gnu_linux__
/* This macro indicates it may be forbidden to map anonymous memory
with both write and execute permission. Code compiled when this
option is defined will attempt to map such pages once, but if it
diff --git a/js/src/ds/MemoryProtectionExceptionHandler.cpp b/js/src/ds/MemoryProtectionExceptionHandler.cpp
index 77df1f0d9..881a0e63d 100644
--- a/js/src/ds/MemoryProtectionExceptionHandler.cpp
+++ b/js/src/ds/MemoryProtectionExceptionHandler.cpp
@@ -16,10 +16,6 @@
# include <unistd.h>
#endif
-#ifdef ANDROID
-# include <android/log.h>
-#endif
-
#include "ds/SplayTree.h"
#include "threading/LockGuard.h"
@@ -125,8 +121,6 @@ ReportCrashIfDebug(const char* aStr)
BOOL ret = WriteFile(GetStdHandle(STD_ERROR_HANDLE), aStr,
strlen(aStr) + 1, &bytesWritten, nullptr);
::__debugbreak();
-# elif defined(ANDROID)
- int ret = __android_log_write(ANDROID_LOG_FATAL, "MOZ_CRASH", aStr);
# else
ssize_t ret = write(STDERR_FILENO, aStr, strlen(aStr) + 1);
# endif
diff --git a/js/src/jit/ExecutableAllocator.h b/js/src/jit/ExecutableAllocator.h
index 8042ae7a9..c16809c81 100644
--- a/js/src/jit/ExecutableAllocator.h
+++ b/js/src/jit/ExecutableAllocator.h
@@ -251,7 +251,7 @@ class ExecutableAllocator
{
__clear_cache(code, reinterpret_cast<char*>(code) + size);
}
-#elif defined(JS_CODEGEN_ARM) && (defined(__linux__) || defined(ANDROID)) && defined(__GNUC__)
+#elif defined(JS_CODEGEN_ARM) && defined(__linux__) && defined(__GNUC__)
static void cacheFlush(void* code, size_t size)
{
void* end = (void*)(reinterpret_cast<char*>(code) + size);
diff --git a/js/src/jit/arm/Architecture-arm.cpp b/js/src/jit/arm/Architecture-arm.cpp
index 791fa972a..38939eabf 100644
--- a/js/src/jit/arm/Architecture-arm.cpp
+++ b/js/src/jit/arm/Architecture-arm.cpp
@@ -15,9 +15,9 @@
#include "jit/arm/Assembler-arm.h"
#include "jit/RegisterSets.h"
-#if !defined(__linux__) || defined(ANDROID) || defined(JS_SIMULATOR_ARM)
-// The Android NDK and B2G do not include the hwcap.h kernel header, and it is not
-// defined when building the simulator, so inline the header defines we need.
+#if !defined(__linux__) || defined(JS_SIMULATOR_ARM)
+// The hwcap.h kernel header is not defined when building the simulator,
+// so inline the header defines we need.
# define HWCAP_VFP (1 << 6)
# define HWCAP_NEON (1 << 12)
# define HWCAP_VFPv3 (1 << 13)
@@ -209,8 +209,7 @@ InitARMFlags()
| HWCAP_FIXUP_FAULT;
#else
-#if defined(__linux__) || defined(ANDROID)
- // This includes Android and B2G.
+#if defined(__linux__)
bool readAuxv = false;
int fd = open("/proc/self/auxv", O_RDONLY);
if (fd > 0) {
diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp
index baab36183..b81f8ebca 100644
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -17,11 +17,6 @@
#include <ctype.h>
#include <stdarg.h>
#include <string.h>
-#ifdef ANDROID
-# include <android/log.h>
-# include <fstream>
-# include <string>
-#endif // ANDROID
#include "jsatom.h"
#include "jscompartment.h"
@@ -1085,60 +1080,10 @@ JSContext::currentlyRunning() const
static bool
ComputeIsJITBroken()
{
-#if !defined(ANDROID)
+ // This used to hold code to exclude specific (mobile) hardware where jit would be
+ // terribly broken. Effectively a stub but good to keep just in case it's needed
+ // in the future.
return false;
-#else // ANDROID
- if (getenv("JS_IGNORE_JIT_BROKENNESS")) {
- return false;
- }
-
- std::string line;
-
- // Check for the known-bad kernel version (2.6.29).
- std::ifstream osrelease("/proc/sys/kernel/osrelease");
- std::getline(osrelease, line);
- __android_log_print(ANDROID_LOG_INFO, "Gecko", "Detected osrelease `%s'",
- line.c_str());
-
- if (line.npos == line.find("2.6.29")) {
- // We're using something other than 2.6.29, so the JITs should work.
- __android_log_print(ANDROID_LOG_INFO, "Gecko", "JITs are not broken");
- return false;
- }
-
- // We're using 2.6.29, and this causes trouble with the JITs on i9000.
- line = "";
- bool broken = false;
- std::ifstream cpuinfo("/proc/cpuinfo");
- do {
- if (0 == line.find("Hardware")) {
- static const char* const blacklist[] = {
- "SCH-I400", // Samsung Continuum
- "SGH-T959", // Samsung i9000, Vibrant device
- "SGH-I897", // Samsung i9000, Captivate device
- "SCH-I500", // Samsung i9000, Fascinate device
- "SPH-D700", // Samsung i9000, Epic device
- "GT-I9000", // Samsung i9000, UK/Europe device
- nullptr
- };
- for (const char* const* hw = &blacklist[0]; *hw; ++hw) {
- if (line.npos != line.find(*hw)) {
- __android_log_print(ANDROID_LOG_INFO, "Gecko",
- "Blacklisted device `%s'", *hw);
- broken = true;
- break;
- }
- }
- break;
- }
- std::getline(cpuinfo, line);
- } while(!cpuinfo.fail() && !cpuinfo.eof());
-
- __android_log_print(ANDROID_LOG_INFO, "Gecko", "JITs are %sbroken",
- broken ? "" : "not ");
-
- return broken;
-#endif // ifndef ANDROID
}
static bool
diff --git a/js/src/jsmath.cpp b/js/src/jsmath.cpp
index 78760583d..64c2da812 100644
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -49,7 +49,7 @@
# undef SystemFunction036
#endif
-#if defined(ANDROID) || defined(__DragonFly__) || \
+#if defined(__DragonFly__) || \
defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
# include <stdlib.h>
# define HAVE_ARC4RANDOM
diff --git a/js/src/jsnativestack.cpp b/js/src/jsnativestack.cpp
index 99c2f6654..34131f966 100644
--- a/js/src/jsnativestack.cpp
+++ b/js/src/jsnativestack.cpp
@@ -15,12 +15,7 @@
# include <pthread_np.h>
# endif
-# if defined(ANDROID)
-# include <sys/types.h>
-# include <unistd.h>
-# endif
-
-# if defined(XP_LINUX) && !defined(ANDROID) && defined(__GLIBC__)
+# if defined(XP_LINUX) && defined(__GLIBC__)
# include <dlfcn.h>
# include <sys/syscall.h>
# include <sys/types.h>
@@ -80,7 +75,7 @@ js::GetNativeStackBaseImpl()
return static_cast<char*>(st.ss_sp) + st.ss_size;
}
-#elif defined(XP_LINUX) && !defined(ANDROID) && defined(__GLIBC__)
+#elif defined(XP_LINUX) && defined(__GLIBC__)
void*
js::GetNativeStackBaseImpl()
{
@@ -154,41 +149,6 @@ js::GetNativeStackBaseImpl()
rc = pthread_stackseg_np(pthread_self(), &ss);
stackBase = (void*)((size_t) ss.ss_sp - ss.ss_size);
stackSize = ss.ss_size;
-# elif defined(ANDROID)
- if (gettid() == getpid()) {
- // bionic's pthread_attr_getstack doesn't tell the truth for the main
- // thread (see bug 846670). So we scan /proc/self/maps to find the
- // segment which contains the stack.
- rc = -1;
-
- // Put the string on the stack, otherwise there is the danger that it
- // has not been decompressed by the the on-demand linker. Bug 1165460.
- //
- // The volatile keyword should stop the compiler from trying to omit
- // the stack copy in the future (hopefully).
- volatile char path[] = "/proc/self/maps";
- FILE* fs = fopen((const char*)path, "r");
-
- if (fs) {
- char line[100];
- unsigned long stackAddr = (unsigned long)&sattr;
- while (fgets(line, sizeof(line), fs) != nullptr) {
- unsigned long stackStart;
- unsigned long stackEnd;
- if (sscanf(line, "%lx-%lx ", &stackStart, &stackEnd) == 2 &&
- stackAddr >= stackStart && stackAddr < stackEnd) {
- stackBase = (void*)stackStart;
- stackSize = stackEnd - stackStart;
- rc = 0;
- break;
- }
- }
- fclose(fs);
- }
- } else
- // For non main-threads pthread allocates the stack itself so it tells
- // the truth.
- rc = pthread_attr_getstack(&sattr, &stackBase, &stackSize);
# else
// Use the default pthread_attr_getstack() call. Note that this function
// differs between libc implementations and could imply /proc access etc.
diff --git a/js/src/vtune/jitprofiling.c b/js/src/vtune/jitprofiling.c
index 558af0c30..652a2a057 100644
--- a/js/src/vtune/jitprofiling.c
+++ b/js/src/vtune/jitprofiling.c
@@ -89,9 +89,6 @@ HINSTANCE m_libHandle = NULL;
void* m_libHandle = NULL;
#endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
-/* default location of JIT profiling agent on Android */
-#define ANDROID_JIT_AGENT_PATH "/data/intel/libittnotify.so"
-
/* the function pointers */
typedef unsigned int(*TPInitialize)(void);
static TPInitialize FUNC_Initialize=NULL;
@@ -386,10 +383,6 @@ static int loadiJIT_Funcs()
dllName = getenv(NEW_DLL_ENVIRONMENT_VAR);
if (!dllName)
dllName = getenv(DLL_ENVIRONMENT_VAR);
-#ifdef ANDROID
- if (!dllName)
- dllName = ANDROID_JIT_AGENT_PATH;
-#endif
if (dllName)
{
/* Try to load the dll from the PATH... */
diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp
index b45d05ebd..dae590acb 100644
--- a/js/src/wasm/WasmSignalHandlers.cpp
+++ b/js/src/wasm/WasmSignalHandlers.cpp
@@ -34,13 +34,6 @@ using JS::GenericNaN;
using mozilla::DebugOnly;
using mozilla::PodArrayZero;
-#if defined(ANDROID)
-# include <sys/system_properties.h>
-# if defined(MOZ_LINKER)
-extern "C" MFBT_API bool IsSignalHandlingBroken();
-# endif
-#endif
-
// For platforms where the signal/exception handler runs on the same
// thread/stack as the victim (Unix and Windows), we can use TLS to find any
// currently executing wasm code.
@@ -260,86 +253,6 @@ class AutoSetHandlingSegFault
# endif
#endif
-#if defined(ANDROID)
-// Not all versions of the Android NDK define ucontext_t or mcontext_t.
-// Detect this and provide custom but compatible definitions. Note that these
-// follow the GLibc naming convention to access register values from
-// mcontext_t.
-//
-// See: https://chromiumcodereview.appspot.com/10829122/
-// See: http://code.google.com/p/android/issues/detail?id=34784
-# if !defined(__BIONIC_HAVE_UCONTEXT_T)
-# if defined(__arm__)
-
-// GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'.
-// Old versions of the C library <signal.h> didn't define the type.
-# if !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT)
-# include <asm/sigcontext.h>
-# endif
-
-typedef struct sigcontext mcontext_t;
-
-typedef struct ucontext {
- uint32_t uc_flags;
- struct ucontext* uc_link;
- stack_t uc_stack;
- mcontext_t uc_mcontext;
- // Other fields are not used so don't define them here.
-} ucontext_t;
-
-# elif defined(__mips__)
-
-typedef struct {
- uint32_t regmask;
- uint32_t status;
- uint64_t pc;
- uint64_t gregs[32];
- uint64_t fpregs[32];
- uint32_t acx;
- uint32_t fpc_csr;
- uint32_t fpc_eir;
- uint32_t used_math;
- uint32_t dsp;
- uint64_t mdhi;
- uint64_t mdlo;
- uint32_t hi1;
- uint32_t lo1;
- uint32_t hi2;
- uint32_t lo2;
- uint32_t hi3;
- uint32_t lo3;
-} mcontext_t;
-
-typedef struct ucontext {
- uint32_t uc_flags;
- struct ucontext* uc_link;
- stack_t uc_stack;
- mcontext_t uc_mcontext;
- // Other fields are not used so don't define them here.
-} ucontext_t;
-
-# elif defined(__i386__)
-// x86 version for Android.
-typedef struct {
- uint32_t gregs[19];
- void* fpregs;
- uint32_t oldmask;
- uint32_t cr2;
-} mcontext_t;
-
-typedef uint32_t kernel_sigset_t[2]; // x86 kernel uses 64-bit signal masks
-typedef struct ucontext {
- uint32_t uc_flags;
- struct ucontext* uc_link;
- stack_t uc_stack;
- mcontext_t uc_mcontext;
- // Other fields are not used by V8, don't define them here.
-} ucontext_t;
-enum { REG_EIP = 14 };
-# endif // defined(__i386__)
-# endif // !defined(__BIONIC_HAVE_UCONTEXT_T)
-#endif // defined(ANDROID)
-
#if !defined(XP_WIN)
# define CONTEXT ucontext_t
#endif
@@ -977,25 +890,6 @@ ProcessHasSignalHandlers()
if (getenv("JS_DISABLE_SLOW_SCRIPT_SIGNALS") || getenv("JS_NO_SIGNALS"))
return false;
-#if defined(ANDROID)
- // Before Android 4.4 (SDK version 19), there is a bug
- // https://android-review.googlesource.com/#/c/52333
- // in Bionic's pthread_join which causes pthread_join to return early when
- // pthread_kill is used (on any thread). Nobody expects the pthread_cond_wait
- // EINTRquisition.
- char version_string[PROP_VALUE_MAX];
- PodArrayZero(version_string);
- if (__system_property_get("ro.build.version.sdk", version_string) > 0) {
- if (atol(version_string) < 19)
- return false;
- }
-# if defined(MOZ_LINKER)
- // Signal handling is broken on some android systems.
- if (IsSignalHandlingBroken())
- return false;
-# endif
-#endif
-
// The interrupt handler allows the main thread to be paused from another
// thread (see InterruptRunningJitCode).
#if defined(XP_WIN)
diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp
index 5b9e09a0a..f4f329746 100644
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -9,9 +9,6 @@
#include <cstdarg>
#include "mozilla/Logging.h"
-#ifdef ANDROID
-#include <android/log.h>
-#endif
#ifdef XP_WIN
#include <windows.h>
#endif
@@ -101,9 +98,6 @@ Dump(JSContext* cx, unsigned argc, Value* vp)
if (!utf8str.encodeUtf8(cx, str))
return false;
-#ifdef ANDROID
- __android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", utf8str.ptr());
-#endif
#ifdef XP_WIN
if (IsDebuggerPresent()) {
nsAutoJSString wstr;
diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp
index ba40e120e..569da5d56 100644
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -127,10 +127,6 @@ SandboxDump(JSContext* cx, unsigned argc, Value* vp)
if (!cstr)
return false;
-#ifdef ANDROID
- __android_log_write(ANDROID_LOG_INFO, "GeckoDump", cstr);
-#endif
-
fputs(cstr, stdout);
fflush(stdout);
args.rval().setBoolean(true);
diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp
index a9f779b89..48a3aa26a 100644
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -3226,12 +3226,6 @@ XPCJSContext::Initialize()
: 120 * 1024; //win32
// The following two configurations are linux-only. Given the numbers above,
// we use 50k and 100k trusted buffers on 32-bit and 64-bit respectively.
-#elif defined(ANDROID)
- // Android appears to have 1MB stacks. Allow the use of 3/4 of that size
- // (768KB on 32-bit), since otherwise we can crash with a stack overflow
- // when nearing the 1MB limit.
- const size_t kStackQuota = kDefaultStackQuota + kDefaultStackQuota / 2;
- const size_t kTrustedScriptBuffer = sizeof(size_t) * 12800;
#elif defined(DEBUG)
// Bug 803182: account for the 4x difference in the size of js::Interpret
// between optimized and debug builds.
diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp
index c0e9532a9..e4e0db96f 100644
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -36,10 +36,6 @@
#include "base/histogram.h"
-#ifdef ANDROID
-#include <android/log.h>
-#endif
-
#ifdef XP_WIN
#include "mozilla/widget/AudioSession.h"
#include <windows.h>
@@ -309,9 +305,6 @@ Dump(JSContext* cx, unsigned argc, Value* vp)
if (!utf8str.encodeUtf8(cx, str))
return false;
-#ifdef ANDROID
- __android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", utf8str.ptr());
-#endif
#ifdef XP_WIN
if (IsDebuggerPresent()) {
nsAutoJSString wstr;