Changeset 27001 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


Ignore:
Timestamp:
Oct 24, 2007, 2:31:27 PM (18 years ago)
Author:
eseidel
Message:

2007-10-24 Eric Seidel <[email protected]>

Reviewed by Maciej.


Stop checking isOutOfMemory after every allocation, instead let the collector
notify all ExecStates if we ever hit this rare condition.


SunSpider claims this was a 2.2% speedup.

  • kjs/collector.cpp: (KJS::Collector::collect): (KJS::Collector::reportOutOfMemoryToAllInterpreters):
  • kjs/collector.h:
  • kjs/nodes.cpp: (KJS::TryNode::execute):
File:
1 edited

Legend:

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

    r26961 r27001  
    4545#define KJS_CHECKEXCEPTION \
    4646  if (exec->hadException()) \
    47     return rethrowException(exec); \
    48   if (Collector::isOutOfMemory()) \
    49     return createOutOfMemoryCompletion(exec);
     47    return rethrowException(exec);
    5048
    5149#define KJS_CHECKEXCEPTIONVALUE \
     
    5351    handleException(exec); \
    5452    return jsUndefined(); \
    55   } \
    56   if (Collector::isOutOfMemory()) \
    57     return jsUndefined(); // will be picked up by KJS_CHECKEXCEPTION
     53  }
    5854
    5955#define KJS_CHECKEXCEPTIONLIST \
     
    6157    handleException(exec); \
    6258    return List(); \
    63   } \
    64   if (Collector::isOutOfMemory()) \
    65     return List(); // will be picked up by KJS_CHECKEXCEPTION
    66 
    67 static Completion createOutOfMemoryCompletion(ExecState* exec)
    68 {
    69     return Completion(Throw, Error::create(exec, GeneralError, "Out of memory"));
    70 }
     59  }
    7160
    7261// ------------------------------ Node -----------------------------------------
     
    25632552  Completion c = tryBlock->execute(exec);
    25642553
     2554  if (Collector::isOutOfMemory())
     2555      return c; // don't try to catch an out of memory exception thrown by the collector
     2556 
    25652557  if (catchBlock && c.complType() == Throw) {
    25662558    JSObject *obj = new JSObject;
Note: See TracChangeset for help on using the changeset viewer.