Changeset 38672 in webkit


Ignore:
Timestamp:
Nov 21, 2008 12:09:40 PM (15 years ago)
Author:
ap@webkit.org
Message:

Reverted fix for bug 22042 (Replace abort() with CRASH()), because it was breaking
FOR_EACH_OPCODE_ID macro somehow, making Safari crash.

Location:
trunk/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r38669 r38672  
     12008-11-21  Alexey Proskuryakov  <ap@webkit.org>
     2
     3        Reverted fix for bug 22042 (Replace abort() with CRASH()), because it was breaking
     4        FOR_EACH_OPCODE_ID macro somehow, making Safari crash.
     5
     6        * runtime/Collector.cpp:
     7        (JSC::Heap::heapAllocate):
     8        (JSC::Heap::collect):
     9        * wtf/Assertions.h:
     10        * wtf/FastMalloc.cpp:
     11        (WTF::fastMalloc):
     12        (WTF::fastCalloc):
     13        (WTF::fastRealloc):
     14        (WTF::InitSizeClasses):
     15        (WTF::PageHeapAllocator::New):
     16        (WTF::TCMallocStats::do_malloc):
     17        * wtf/FastMalloc.h:
     18        * wtf/TCSpinLock.h:
     19        (TCMalloc_SpinLock::Init):
     20        (TCMalloc_SpinLock::Finalize):
     21        (TCMalloc_SpinLock::Lock):
     22        (TCMalloc_SpinLock::Unlock):
     23
    1242008-11-21  Geoffrey Garen  <ggaren@apple.com>
    225
  • trunk/JavaScriptCore/runtime/Collector.cpp

    r38665 r38672  
    284284    ASSERT(heapType == PrimaryHeap || heap.extraCost == 0);
    285285    // FIXME: If another global variable access here doesn't hurt performance
    286     // too much, we could CRASH() in NDEBUG builds, which could help ensure we
     286    // too much, we could abort() in NDEBUG builds, which could help ensure we
    287287    // don't spend any time debugging cases where we allocate inside an object's
    288288    // deallocation code.
     
    975975    ASSERT((primaryHeap.operationInProgress == NoOperation) | (numberHeap.operationInProgress == NoOperation));
    976976    if ((primaryHeap.operationInProgress != NoOperation) | (numberHeap.operationInProgress != NoOperation))
    977         CRASH();
     977        abort();
    978978
    979979    JAVASCRIPTCORE_GC_BEGIN();
  • trunk/JavaScriptCore/wtf/Assertions.h

    r38666 r38672  
    5151#endif
    5252
    53 #include <stdlib.h>
    54 
    5553#ifdef NDEBUG
    5654#define ASSERTIONS_DISABLED_DEFAULT 1
     
    123121
    124122#ifndef CRASH
    125 #ifdef __cplusplus
    126 #define CRASH() do { \
    127     *(int *)(uintptr_t)0xbbadbeef = 0; \
    128     ::abort(); \
    129 } while (false)
    130 #else
    131 #define CRASH() do { \
    132     *(int *)(uintptr_t)0xbbadbeef = 0; \
    133     abort(); \
    134 } while (false)
    135 #endif
     123#define CRASH() *(int *)(uintptr_t)0xbbadbeef = 0
    136124#endif
    137125
  • trunk/JavaScriptCore/wtf/FastMalloc.cpp

    r38665 r38672  
    192192    void* result = malloc(n);
    193193    if (!result)
    194         CRASH();
     194        abort();
    195195    return result;
    196196}
     
    207207    void* result = calloc(n_elements, element_size);
    208208    if (!result)
    209         CRASH();
     209        abort();
    210210    return result;
    211211}
     
    228228    void* result = realloc(p, n);
    229229    if (!result)
    230         CRASH();
     230        abort();
    231231    return result;
    232232}
     
    687687  if (ClassIndex(0) < 0) {
    688688    MESSAGE("Invalid class index %d for size 0\n", ClassIndex(0));
    689     CRASH();
     689    abort();
    690690  }
    691691  if (static_cast<size_t>(ClassIndex(kMaxSize)) >= sizeof(class_array)) {
    692692    MESSAGE("Invalid class index %d for kMaxSize\n", ClassIndex(kMaxSize));
    693     CRASH();
     693    abort();
    694694  }
    695695
     
    743743    MESSAGE("wrong number of size classes: found %" PRIuS " instead of %d\n",
    744744            sc, int(kNumClasses));
    745     CRASH();
     745    abort();
    746746  }
    747747
     
    761761    if (sc == 0) {
    762762      MESSAGE("Bad size class %" PRIuS " for %" PRIuS "\n", sc, size);
    763       CRASH();
     763      abort();
    764764    }
    765765    if (sc > 1 && size <= class_to_size[sc-1]) {
    766766      MESSAGE("Allocating unnecessarily large class %" PRIuS " for %" PRIuS
    767767              "\n", sc, size);
    768       CRASH();
     768      abort();
    769769    }
    770770    if (sc >= kNumClasses) {
    771771      MESSAGE("Bad size class %" PRIuS " for %" PRIuS "\n", sc, size);
    772       CRASH();
     772      abort();
    773773    }
    774774    const size_t s = class_to_size[sc];
    775775    if (size > s) {
    776776     MESSAGE("Bad size %" PRIuS " for %" PRIuS " (sc = %" PRIuS ")\n", s, size, sc);
    777       CRASH();
     777      abort();
    778778    }
    779779    if (s == 0) {
    780780      MESSAGE("Bad size %" PRIuS " for %" PRIuS " (sc = %" PRIuS ")\n", s, size, sc);
    781       CRASH();
     781      abort();
    782782    }
    783783  }
     
    862862        // Need more room
    863863        free_area_ = reinterpret_cast<char*>(MetaDataAlloc(kAllocIncrement));
    864         if (free_area_ == NULL) CRASH();
     864        if (free_area_ == NULL) abort();
    865865        free_avail_ = kAllocIncrement;
    866866      }
     
    30243024
    30253025#ifdef WTF_CHANGES
    3026 template <bool crashOnFailure>
     3026template <bool abortOnFailure>
    30273027#endif
    30283028static ALWAYS_INLINE void* do_malloc(size_t size) {
     
    30573057  if (!ret) {
    30583058#ifdef WTF_CHANGES
    3059     if (crashOnFailure) // This branch should be optimized out by the compiler.
    3060         CRASH();
     3059    if (abortOnFailure) // This branch should be optimized out by the compiler.
     3060        abort();
    30613061#else
    30623062    errno = ENOMEM;
     
    32273227extern "C"
    32283228#else
    3229 #define do_malloc do_malloc<crashOnFailure>
    3230 
    3231 template <bool crashOnFailure>
     3229#define do_malloc do_malloc<abortOnFailure>
     3230
     3231template <bool abortOnFailure>
    32323232void* malloc(size_t);
    32333233
     
    32423242}
    32433243
    3244 template <bool crashOnFailure>
     3244template <bool abortOnFailure>
    32453245ALWAYS_INLINE
    32463246#endif
     
    32663266extern "C"
    32673267#else
    3268 template <bool crashOnFailure>
     3268template <bool abortOnFailure>
    32693269void* calloc(size_t, size_t);
    32703270
     
    32793279}
    32803280
    3281 template <bool crashOnFailure>
     3281template <bool abortOnFailure>
    32823282ALWAYS_INLINE
    32833283#endif
     
    33123312extern "C"
    33133313#else
    3314 template <bool crashOnFailure>
     3314template <bool abortOnFailure>
    33153315void* realloc(void*, size_t);
    33163316
     
    33253325}
    33263326
    3327 template <bool crashOnFailure>
     3327template <bool abortOnFailure>
    33283328ALWAYS_INLINE
    33293329#endif
  • trunk/JavaScriptCore/wtf/FastMalloc.h

    r38665 r38672  
    2828namespace WTF {
    2929
    30     // These functions call CRASH() if an allocation fails.
     30    // These functions call abort() if an allocation fails.
    3131    void* fastMalloc(size_t n);
    3232    void* fastZeroedMalloc(size_t n);
  • trunk/JavaScriptCore/wtf/TCSpinLock.h

    r38665 r38672  
    4747#include <sys/types.h>
    4848#endif
     49#include <stdlib.h>     /* for abort() */
    4950
    5051#if PLATFORM(WIN_OS)
     
    199200
    200201  inline void Init() {
    201     if (pthread_mutex_init(&private_lock_, NULL) != 0) CRASH();
     202    if (pthread_mutex_init(&private_lock_, NULL) != 0) abort();
    202203  }
    203204  inline void Finalize() {
    204     if (pthread_mutex_destroy(&private_lock_) != 0) CRASH();
     205    if (pthread_mutex_destroy(&private_lock_) != 0) abort();
    205206  }
    206207  inline void Lock() {
    207     if (pthread_mutex_lock(&private_lock_) != 0) CRASH();
     208    if (pthread_mutex_lock(&private_lock_) != 0) abort();
    208209  }
    209210  inline void Unlock() {
    210     if (pthread_mutex_unlock(&private_lock_) != 0) CRASH();
     211    if (pthread_mutex_unlock(&private_lock_) != 0) abort();
    211212  }
    212213};
Note: See TracChangeset for help on using the changeset viewer.