Changeset 10222 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Aug 16, 2005, 6:00:00 PM (20 years ago)
Author:
darin
Message:

Reviewed by Geoff.

  • fixed crash in one of the JavaScript tests (introduced by my throwError change)
  • kjs/nodes.cpp: (Node::setExceptionDetailsIfNeeded): Check if the exception is an object before setting the file and line number properties on it. Something to think about in the future -- do we really want to do this on any object that's thrown? How about limiting it to error objects that were created by the JavaScript engine?
  • changed kjs_fast_malloc so we don't have two conflicting versions of the same function
  • kjs/fast_malloc.h: Took out all the ifdefs from this header.
  • kjs/fast_malloc.cpp: Added non-NDEBUG versions of the functions that just call the system malloc, and put the NDEBUG versions in an #else.
Location:
trunk/JavaScriptCore/kjs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/fast_malloc.cpp

    r9009 r10222  
    225225*/
    226226
     227#include "fast_malloc.h"
     228
    227229namespace KJS {
     230
     231#ifndef NDEBUG
     232
     233// In debugging builds, use the system malloc for its debugging features.
     234
     235void *kjs_fast_malloc(size_t n)
     236{
     237    return malloc(n);
     238}
     239
     240void *kjs_fast_calloc(size_t n_elements, size_t element_size)
     241{
     242    return calloc(n_elements, element_size);
     243}
     244
     245void kjs_fast_free(void* p)
     246{
     247    free(p);
     248}
     249
     250void *kjs_fast_realloc(void* p, size_t n)
     251{
     252    return realloc(p, n);
     253}
     254
     255#else
    228256
    229257/*
     
    54145442#endif /* WIN32 */
    54155443
    5416 };  /* end of namespace KJS */
     5444#endif
     5445
     5446}  /* end of namespace KJS */
    54175447
    54185448/* ------------------------------------------------------------
  • trunk/JavaScriptCore/kjs/fast_malloc.h

    r9009 r10222  
    1 // -*- c-basic-offset: 2 -*-
    21/*
    32 *  This file is part of the KDE libraries
     
    2120 */
    2221
    23 
    24 #ifndef _FAST_MALLOC_H_
    25 #define _FAST_MALLOC_H_
     22#ifndef KJS_FAST_MALLOC_H
     23#define KJS_FAST_MALLOC_H
    2624
    2725// This is a copy of dlmalloc, a fast single-threaded malloc implementation.
     
    3129// executing or GC is taking place).
    3230
    33 
    34 #ifndef NDEBUG
    35 
    36 #define kjs_fast_malloc malloc
    37 #define kjs_fast_calloc calloc
    38 #define kjs_fast_free free
    39 #define kjs_fast_realloc realloc
    40 
    41 #define KJS_FAST_ALLOCATED
    42 
    43 #else
     31#include <stdlib.h>
    4432
    4533namespace KJS {
     
    5038void *kjs_fast_realloc(void* p, size_t n);
    5139
    52 };
     40}
    5341
    5442#define KJS_FAST_ALLOCATED \
     
    5644void operator delete(void* p) { KJS::kjs_fast_free(p); }
    5745
    58 #endif
    59 
    60 #endif /* _FAST_MALLOC_H_ */
     46#endif /* KJS_FAST_MALLOC_H */
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r10207 r10222  
    190190void Node::setExceptionDetailsIfNeeded(ExecState *exec)
    191191{
    192     if (exec->hadException()) {
    193         ObjectImp *exception = static_cast<ObjectImp *>(exec->exception());
     192    ValueImp *exceptionValue = exec->exception();
     193    if (exceptionValue->isObject()) {
     194        ObjectImp *exception = static_cast<ObjectImp *>(exceptionValue);
    194195        if (!exception->hasProperty(exec, "line") && !exception->hasProperty(exec, "sourceURL")) {
    195196            exception->put(exec, "line", Number(line));
Note: See TracChangeset for help on using the changeset viewer.