[webkit-changes] cvs commit: JavaScriptCore/kjs nodes.cpp fast_malloc.h fast_malloc.cpp

Darin darin at opensource.apple.com
Tue Aug 16 18:00:01 PDT 2005


darin       05/08/16 18:00:01

  Modified:    .        ChangeLog
               kjs      nodes.cpp fast_malloc.h fast_malloc.cpp
  Log:
          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.
  
  Revision  Changes    Path
  1.802     +17 -0     JavaScriptCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
  retrieving revision 1.801
  retrieving revision 1.802
  diff -u -r1.801 -r1.802
  --- ChangeLog	16 Aug 2005 22:01:27 -0000	1.801
  +++ ChangeLog	17 Aug 2005 00:59:59 -0000	1.802
  @@ -2,6 +2,23 @@
   
           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.
  +
  +2005-08-16  Darin Adler  <darin at apple.com>
  +
  +        Reviewed by Geoff.
  +
           - clean up exported symbols that are not in a "KJS" namespace
   
           * bindings/NP_jsobject.cpp: (identiferFromNPIdentifier): Marked this function static
  
  
  
  1.75      +3 -2      JavaScriptCore/kjs/nodes.cpp
  
  Index: nodes.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/nodes.cpp,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- nodes.cpp	16 Aug 2005 00:47:25 -0000	1.74
  +++ nodes.cpp	17 Aug 2005 01:00:00 -0000	1.75
  @@ -189,8 +189,9 @@
   
   void Node::setExceptionDetailsIfNeeded(ExecState *exec)
   {
  -    if (exec->hadException()) {
  -        ObjectImp *exception = static_cast<ObjectImp *>(exec->exception());
  +    ValueImp *exceptionValue = exec->exception();
  +    if (exceptionValue->isObject()) {
  +        ObjectImp *exception = static_cast<ObjectImp *>(exceptionValue);
           if (!exception->hasProperty(exec, "line") && !exception->hasProperty(exec, "sourceURL")) {
               exception->put(exec, "line", Number(line));
               exception->put(exec, "sourceURL", String(sourceURL));
  
  
  
  1.2       +5 -19     JavaScriptCore/kjs/fast_malloc.h
  
  Index: fast_malloc.h
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/fast_malloc.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- fast_malloc.h	15 Apr 2005 01:26:26 -0000	1.1
  +++ fast_malloc.h	17 Aug 2005 01:00:00 -0000	1.2
  @@ -1,4 +1,3 @@
  -// -*- c-basic-offset: 2 -*-
   /*
    *  This file is part of the KDE libraries
    *  Copyright (C) 2005 Apple Computer, Inc.
  @@ -20,9 +19,8 @@
    *
    */
   
  -
  -#ifndef _FAST_MALLOC_H_
  -#define _FAST_MALLOC_H_
  +#ifndef KJS_FAST_MALLOC_H
  +#define KJS_FAST_MALLOC_H
   
   // This is a copy of dlmalloc, a fast single-threaded malloc implementation.
   // JavaScriptCore is multi-threaded, but certain actions can only take place under
  @@ -30,17 +28,7 @@
   // while holding the collector lock (this is true whenenever the interpreter is
   // executing or GC is taking place).
   
  -
  -#ifndef NDEBUG
  -
  -#define kjs_fast_malloc malloc
  -#define kjs_fast_calloc calloc
  -#define kjs_fast_free free
  -#define kjs_fast_realloc realloc
  -
  -#define KJS_FAST_ALLOCATED
  -
  -#else
  +#include <stdlib.h>
   
   namespace KJS {
   
  @@ -49,12 +37,10 @@
   void kjs_fast_free(void* p);
   void *kjs_fast_realloc(void* p, size_t n);
   
  -};
  +}
   
   #define KJS_FAST_ALLOCATED \
   void* operator new(size_t s) { return KJS::kjs_fast_malloc(s); } \
   void operator delete(void* p) { KJS::kjs_fast_free(p); }
   
  -#endif
  -
  -#endif /* _FAST_MALLOC_H_ */
  +#endif /* KJS_FAST_MALLOC_H */
  
  
  
  1.2       +31 -1     JavaScriptCore/kjs/fast_malloc.cpp
  
  Index: fast_malloc.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/fast_malloc.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- fast_malloc.cpp	15 Apr 2005 01:26:26 -0000	1.1
  +++ fast_malloc.cpp	17 Aug 2005 01:00:00 -0000	1.2
  @@ -224,8 +224,36 @@
       probably don't want to touch unless you are extending or adapting malloc.
   */
   
  +#include "fast_malloc.h"
  +
   namespace KJS {
   
  +#ifndef NDEBUG
  +
  +// In debugging builds, use the system malloc for its debugging features.
  +
  +void *kjs_fast_malloc(size_t n)
  +{
  +    return malloc(n);
  +}
  +
  +void *kjs_fast_calloc(size_t n_elements, size_t element_size)
  +{
  +    return calloc(n_elements, element_size);
  +}
  +
  +void kjs_fast_free(void* p)
  +{
  +    free(p);
  +}
  +
  +void *kjs_fast_realloc(void* p, size_t n)
  +{
  +    return realloc(p, n);
  +}
  +
  +#else
  +
   /*
     WIN32 sets up defaults for MS environment and compilers.
     Otherwise defaults are for unix.
  @@ -5413,7 +5441,9 @@
   
   #endif /* WIN32 */
   
  -};  /* end of namespace KJS */
  +#endif
  +
  +}  /* end of namespace KJS */
   
   /* ------------------------------------------------------------
   History:
  
  
  



More information about the webkit-changes mailing list