☠☠ backed out by 5969eb0fe8b5 ☠ ☠ | |
author | Terrence Cole <terrence@mozilla.com> |
Wed, 28 Jan 2015 11:52:01 -0800 | |
changeset 226558 | f6ac06e9143de3a389d972f140fd7c35305d98c8 |
parent 226557 | 741a15659b09a7d2714e0e002d163fffe2c6de1f |
child 226559 | 51ac953371fe498d244c1fa9abcdbb42ac2a9df8 |
push id | 28200 |
push user | kwierso@gmail.com |
push date | Thu, 29 Jan 2015 23:01:46 +0000 |
treeherder | mozilla-central@4380ed39de3a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | billm |
bugs | 1125929 |
milestone | 38.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
configure.in | file | annotate | diff | comparison | revisions | |
js/src/configure.in | file | annotate | diff | comparison | revisions | |
js/src/gc/Statistics.cpp | file | annotate | diff | comparison | revisions | |
js/src/js-config.h.in | file | annotate | diff | comparison | revisions | |
js/src/jsapi.h | file | annotate | diff | comparison | revisions | |
js/src/jscrashformat.h | file | annotate | diff | comparison | revisions | |
js/src/jscrashreport.cpp | file | annotate | diff | comparison | revisions | |
js/src/jscrashreport.h | file | annotate | diff | comparison | revisions | |
js/src/moz.build | file | annotate | diff | comparison | revisions | |
js/xpconnect/src/XPCJSRuntime.cpp | file | annotate | diff | comparison | revisions |
--- a/configure.in +++ b/configure.in @@ -7268,28 +7268,16 @@ if test "$OS_TARGET" = Android; then MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror" fi fi AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS) export MOZ_GLUE_WRAP_LDFLAGS dnl ======================================================== -dnl JS opt-mode assertions and minidump instrumentation -dnl ======================================================== -MOZ_ARG_ENABLE_BOOL(js-diagnostics, -[ --enable-js-diagnostics - Enable JS diagnostic assertions and breakpad data], - JS_CRASH_DIAGNOSTICS=1, - JS_CRASH_DIAGNOSTICS= ) -if test -n "$JS_CRASH_DIAGNOSTICS"; then - AC_DEFINE(JS_CRASH_DIAGNOSTICS) -fi - -dnl ======================================================== dnl = Enable static checking using gcc-dehydra dnl ======================================================== MOZ_ARG_WITH_STRING(static-checking, [ --with-static-checking=path/to/gcc_dehydra.so Enable static checking of code using GCC-dehydra], DEHYDRA_PATH=$withval, DEHYDRA_PATH= )
--- a/js/src/configure.in +++ b/js/src/configure.in @@ -3248,21 +3248,21 @@ MOZ_ARG_ENABLE_BOOL(perf, [ --enable-perf Enable Linux perf integration], JS_ION_PERF=1, JS_ION_PERF= ) if test -n "$JS_ION_PERF"; then AC_DEFINE(JS_ION_PERF) fi dnl ======================================================== -dnl JS opt-mode assertions and minidump instrumentation +dnl JS opt-mode assertions and heap poisoning dnl ======================================================== MOZ_ARG_ENABLE_BOOL(js-diagnostics, [ --enable-js-diagnostics - Enable JS diagnostic assertions and breakpad data], + Enable JS diagnostic assertions heap poisoning], JS_CRASH_DIAGNOSTICS=1, JS_CRASH_DIAGNOSTICS= ) if test -n "$JS_CRASH_DIAGNOSTICS"; then AC_DEFINE(JS_CRASH_DIAGNOSTICS) fi dnl ======================================================== dnl Enable changes that make the shell more deterministic
--- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -9,17 +9,16 @@ #include "mozilla/ArrayUtils.h" #include "mozilla/PodOperations.h" #include "mozilla/UniquePtr.h" #include <ctype.h> #include <stdarg.h> #include <stdio.h> -#include "jscrashreport.h" #include "jsprf.h" #include "jsutil.h" #include "prmjtime.h" #include "gc/Memory.h" #include "vm/HelperThreads.h" #include "vm/Runtime.h" @@ -923,18 +922,16 @@ Statistics::beginGC(JSGCInvocationKind k nonincrementalReason = nullptr; preBytes = runtime->gc.usage.gcBytes(); } void Statistics::endGC() { - crash::SnapshotGCStack(); - for (size_t j = 0; j < MAX_MULTIPARENT_PHASES + 1; j++) for (int i = 0; i < PHASE_LIMIT; i++) phaseTotals[j][i] += phaseTimes[j][i]; int64_t total, longest; gcDuration(&total, &longest); int64_t sccTotal, sccLongest;
--- a/js/src/js-config.h.in +++ b/js/src/js-config.h.in @@ -26,16 +26,19 @@ /* Define to 1 if SpiderMonkey should support the ability to perform entirely too much GC. */ #undef JS_GC_ZEAL /* Define to 1 if SpiderMonkey should use small chunks. */ #undef JS_GC_SMALL_CHUNK_SIZE +/* Define to 1 to perform extra assertions and heap poisoning. */ +#undef JS_CRASH_DIAGNOSTICS + /* Define to 1 if the <endian.h> header is present and useable. See jscpucfg.h. */ #undef JS_HAVE_ENDIAN_H /* Define to 1 if the <machine/endian.h> header is present and useable. See jscpucfg.h. */ #undef JS_HAVE_MACHINE_ENDIAN_H
--- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -1752,26 +1752,16 @@ typedef struct JSCTypesCallbacks JSCType * pointer to static data that exists for the lifetime of 'ctypesObj', but it * may safely be altered after calling this function and without having * to call this function again. */ extern JS_PUBLIC_API(void) JS_SetCTypesCallbacks(JSObject *ctypesObj, const JSCTypesCallbacks *callbacks); #endif -typedef bool -(* JSEnumerateDiagnosticMemoryCallback)(void *ptr, size_t length); - -/* - * Enumerate memory regions that contain diagnostic information - * intended to be included in crash report minidumps. - */ -extern JS_PUBLIC_API(void) -JS_EnumerateDiagnosticMemoryRegions(JSEnumerateDiagnosticMemoryCallback callback); - extern JS_PUBLIC_API(void *) JS_malloc(JSContext *cx, size_t nbytes); extern JS_PUBLIC_API(void *) JS_realloc(JSContext *cx, void *p, size_t oldBytes, size_t newBytes); /* * A wrapper for js_free(p) that may delay js_free(p) invocation as a
deleted file mode 100644 --- a/js/src/jscrashformat.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: set ts=8 sts=4 et sw=4 tw=99: - * 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 jscrashformat_h -#define jscrashformat_h - -namespace js { -namespace crash { - -static const int crash_cookie_len = 16; -static const char crash_cookie[crash_cookie_len] = "*J*S*CRASHDATA*"; - -/* These values are used for CrashHeader::id. */ -enum { - JS_CRASH_STACK_GC = 0x400, - JS_CRASH_STACK_ERROR = 0x401, - JS_CRASH_RING = 0x800 -}; - -/* - * All the data here will be stored directly in the minidump, so we use - * platform-independent types. We also ensure that the size of every field is a - * multiple of 8 bytes, to guarantee that they won't be padded. - */ - -struct CrashHeader -{ - char cookie[crash_cookie_len]; - - /* id of the crash data, chosen from the enum above. */ - uint64_t id; - - explicit CrashHeader(uint64_t id) : id(id) { memcpy(cookie, crash_cookie, crash_cookie_len); } -}; - -struct CrashRegisters -{ - uint64_t ip, sp, bp; -}; - -static const int crash_buffer_size = 32 * 1024; - -struct CrashStack -{ - explicit CrashStack(uint64_t id) : header(id) {} - - CrashHeader header; - uint64_t snaptime; /* Unix time when the stack was snapshotted. */ - CrashRegisters regs; /* Register contents for the snapshot. */ - uint64_t stack_base; /* Base address of stack at the time of snapshot. */ - uint64_t stack_len; /* Extent of the stack. */ - char stack[crash_buffer_size]; /* Contents of the stack. */ -}; - -struct CrashRing -{ - explicit CrashRing(uint64_t id) : header(id), offset(0) { memset(buffer, 0, sizeof(buffer)); } - - CrashHeader header; - uint64_t offset; /* Next byte to be written in the buffer. */ - char buffer[crash_buffer_size]; -}; - -/* These are the tag values for each entry in the CrashRing. */ -enum { - JS_CRASH_TAG_GC = 0x200 -}; - -} /* namespace crash */ -} /* namespace js */ - -#endif /* jscrashformat_h */
deleted file mode 100644 --- a/js/src/jscrashreport.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: set ts=8 sts=4 et sw=4 tw=99: - * 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/. */ - -#include "jscrashreport.h" - -#include <time.h> - -#include "jsapi.h" -#include "jscrashformat.h" -#include "jsutil.h" - -using namespace js; -using namespace js::crash; - -#if defined(XP_WIN) - -static const int stack_snapshot_max_size = 32768; - -#include <windows.h> - -static bool -GetStack(uint64_t *stack, uint64_t *stack_len, CrashRegisters *regs, char *buffer, size_t size) -{ - /* Try to figure out how big the stack is. */ - char dummy; - MEMORY_BASIC_INFORMATION info; - if (VirtualQuery(reinterpret_cast<LPCVOID>(&dummy), &info, sizeof(info)) == 0) - return false; - if (info.State != MEM_COMMIT) - return false; - - /* 256 is a fudge factor to account for the rest of GetStack's frame. */ - uint64_t p = uint64_t(&dummy) - 256; - uint64_t len = stack_snapshot_max_size; - - if (p + len > uint64_t(info.BaseAddress) + info.RegionSize) - len = uint64_t(info.BaseAddress) + info.RegionSize - p; - - if (len > size) - len = size; - - *stack = p; - *stack_len = len; - - /* Get the register state. */ -#if defined(_MSC_VER) && defined(_M_IX86) - /* ASM version for win2k that doesn't support RtlCaptureContext */ - uint32_t vip, vsp, vbp; - __asm { - MyLabel: - mov [vbp], ebp; - mov [vsp], esp; - mov eax, [MyLabel]; - mov [vip], eax; - } - regs->ip = vip; - regs->sp = vsp; - regs->bp = vbp; -#else - CONTEXT context; - RtlCaptureContext(&context); -#if defined(_M_IX86) - regs->ip = context.Eip; - regs->sp = context.Esp; - regs->bp = context.Ebp; -#elif defined(_M_X64) - regs->ip = context.Rip; - regs->sp = context.Rsp; - regs->bp = context.Rbp; -#else -#error unknown cpu architecture -#endif -#endif - - js_memcpy(buffer, (void *)p, len); - - return true; -} - -#elif 0 - -#include <sys/mman.h> -#include <ucontext.h> -#include <unistd.h> - -static bool -GetStack(uint64_t *stack, uint64_t *stack_len, CrashRegisters *regs, char *buffer, size_t size) -{ - /* 256 is a fudge factor to account for the rest of GetStack's frame. */ - char dummy; - uint64_t p = uint64_t(&dummy) - 256; - uint64_t pgsz = getpagesize(); - uint64_t len = stack_snapshot_max_size; - p &= ~(pgsz - 1); - - /* Try to figure out how big the stack is. */ - while (len > 0) { - if (mlock((const void *)p, len) == 0) { - munlock((const void *)p, len); - break; - } - len -= pgsz; - } - - if (len > size) - len = size; - - *stack = p; - *stack_len = len; - - /* Get the register state. */ - ucontext_t context; - if (getcontext(&context) != 0) - return false; - -#if defined(__x86_64__) - regs->sp = (uint64_t)context.uc_mcontext.gregs[REG_RSP]; - regs->bp = (uint64_t)context.uc_mcontext.gregs[REG_RBP]; - regs->ip = (uint64_t)context.uc_mcontext.gregs[REG_RIP]; -#elif defined(__i386__) - regs->sp = (uint64_t)context.uc_mcontext.gregs[REG_ESP]; - regs->bp = (uint64_t)context.uc_mcontext.gregs[REG_EBP]; - regs->ip = (uint64_t)context.uc_mcontext.gregs[REG_EIP]; -#else -#error unknown cpu architecture -#endif - - js_memcpy(buffer, (void *)p, len); - - return true; -} - -#else - -static bool -GetStack(uint64_t *stack, uint64_t *stack_len, CrashRegisters *regs, char *buffer, size_t size) -{ - return false; -} - -#endif - -namespace js { -namespace crash { - -class Stack : private CrashStack -{ -public: - explicit Stack(uint64_t id); - - bool snapshot(); -}; - -Stack::Stack(uint64_t id) - : CrashStack(id) -{ -} - -bool -Stack::snapshot() -{ - snaptime = time(nullptr); - return GetStack(&stack_base, &stack_len, ®s, stack, sizeof(stack)); -} - -class Ring : private CrashRing -{ -public: - explicit Ring(uint64_t id); - - void push(uint64_t tag, void *data, size_t size); - -private: - size_t bufferSize() { return crash_buffer_size; } - void copyBytes(void *data, size_t size); -}; - -Ring::Ring(uint64_t id) - : CrashRing(id) -{ -} - -void -Ring::push(uint64_t tag, void *data, size_t size) -{ - uint64_t t = time(nullptr); - - copyBytes(&tag, sizeof(uint64_t)); - copyBytes(&t, sizeof(uint64_t)); - copyBytes(data, size); - uint64_t mysize = size; - copyBytes(&mysize, sizeof(uint64_t)); -} - -void -Ring::copyBytes(void *data, size_t size) -{ - if (size >= bufferSize()) - size = bufferSize(); - - if (offset + size > bufferSize()) { - size_t first = bufferSize() - offset; - size_t second = size - first; - js_memcpy(&buffer[offset], data, first); - js_memcpy(buffer, (char *)data + first, second); - offset = second; - } else { - js_memcpy(&buffer[offset], data, size); - offset += size; - } -} - -} /* namespace crash */ -} /* namespace js */ - -#ifdef JS_CRASH_DIAGNOSTICS -static bool gInitialized; - -static Stack gGCStack(JS_CRASH_STACK_GC); -static Stack gErrorStack(JS_CRASH_STACK_ERROR); -static Ring gRingBuffer(JS_CRASH_RING); -#endif - -void -js::crash::SnapshotGCStack() -{ -#ifdef JS_CRASH_DIAGNOSTICS - if (gInitialized) - gGCStack.snapshot(); -#endif -} - -void -js::crash::SnapshotErrorStack() -{ -#ifdef JS_CRASH_DIAGNOSTICS - if (gInitialized) - gErrorStack.snapshot(); -#endif -} - -void -js::crash::SaveCrashData(uint64_t tag, void *ptr, size_t size) -{ -#ifdef JS_CRASH_DIAGNOSTICS - if (gInitialized) - gRingBuffer.push(tag, ptr, size); -#endif -} - -JS_PUBLIC_API(void) -JS_EnumerateDiagnosticMemoryRegions(JSEnumerateDiagnosticMemoryCallback callback) -{ -#ifdef JS_CRASH_DIAGNOSTICS - if (!gInitialized) { - gInitialized = true; - (*callback)(&gGCStack, sizeof(gGCStack)); - (*callback)(&gErrorStack, sizeof(gErrorStack)); - (*callback)(&gRingBuffer, sizeof(gRingBuffer)); - } -#endif -} -
deleted file mode 100644 --- a/js/src/jscrashreport.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: set ts=8 sts=4 et sw=4 tw=99: - * 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 jscrashreport_h -#define jscrashreport_h - -#include "mozilla/GuardObjects.h" - -#include <stdint.h> - -namespace js { -namespace crash { - -void -SnapshotGCStack(); - -void -SnapshotErrorStack(); - -void -SaveCrashData(uint64_t tag, void *ptr, size_t size); - -template<size_t size, unsigned char marker> -class StackBuffer -{ - public: - explicit StackBuffer(void *data - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - - buffer[0] = marker; - buffer[1] = '['; - - for (size_t i = 0; i < size; i++) { - if (data) - buffer[i + 2] = static_cast<unsigned char*>(data)[i]; - else - buffer[i + 2] = 0; - } - - buffer[size - 2] = ']'; - buffer[size - 1] = marker; - } - - private: - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER - volatile unsigned char buffer[size + 4]; -}; - -} /* namespace crash */ -} /* namespace js */ - -#endif /* jscrashreport_h */
--- a/js/src/moz.build +++ b/js/src/moz.build @@ -196,17 +196,16 @@ UNIFIED_SOURCES += [ 'jit/TypePolicy.cpp', 'jit/ValueNumbering.cpp', 'jit/VMFunctions.cpp', 'jsalloc.cpp', 'jsapi.cpp', 'jsbool.cpp', 'jscntxt.cpp', 'jscompartment.cpp', - 'jscrashreport.cpp', 'jsdate.cpp', 'jsdtoa.cpp', 'jsexn.cpp', 'jsfriendapi.cpp', 'jsfun.cpp', 'jsgc.cpp', 'jsinfer.cpp', 'jsiter.cpp',
--- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -2984,24 +2984,16 @@ JSSizeOfTab(JSObject *objArg, size_t *js *jsStringsSize = sizes.strings; *jsPrivateSize = sizes.private_; *jsOtherSize = sizes.other; return NS_OK; } } // namespace xpc -#ifdef MOZ_CRASHREPORTER -static bool -DiagnosticMemoryCallback(void *ptr, size_t size) -{ - return CrashReporter::RegisterAppMemory(ptr, size) == NS_OK; -} -#endif - static void AccumulateTelemetryCallback(int id, uint32_t sample, const char *key) { switch (id) { case JS_TELEMETRY_GC_REASON: Telemetry::Accumulate(Telemetry::GC_REASON_2, sample); break; case JS_TELEMETRY_GC_IS_COMPARTMENTAL: @@ -3319,19 +3311,16 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* JS_SetErrorReporter(runtime, xpc::SystemErrorReporter); JS_SetDestroyCompartmentCallback(runtime, CompartmentDestroyedCallback); JS_SetCompartmentNameCallback(runtime, CompartmentNameCallback); mPrevGCSliceCallback = JS::SetGCSliceCallback(runtime, GCSliceCallback); JS_AddFinalizeCallback(runtime, FinalizeCallback, nullptr); JS_AddWeakPointerCallback(runtime, WeakPointerCallback, this); JS_SetWrapObjectCallbacks(runtime, &WrapObjectCallbacks); js::SetPreserveWrapperCallback(runtime, PreserveWrapper); -#ifdef MOZ_CRASHREPORTER - JS_EnumerateDiagnosticMemoryRegions(DiagnosticMemoryCallback); -#endif #ifdef MOZ_ENABLE_PROFILER_SPS if (PseudoStack *stack = mozilla_get_pseudo_stack()) stack->sampleRuntime(runtime); #endif JS_SetAccumulateTelemetryCallback(runtime, AccumulateTelemetryCallback); js::SetDefaultJSContextCallback(runtime, DefaultJSContextCallback); js::SetActivityCallback(runtime, ActivityCallback, this); js::SetCTypesActivityCallback(runtime, CTypesActivityCallback);