Ignore:
Timestamp:
Jul 1, 2008, 11:35:03 PM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

https://bugs.webkit.org/show_bug.cgi?id=19834
Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82

Creating a global object with a custom prototype resets it twice (wasteful!).
So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset
the register array.

  • kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0).
  • kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy constructor and operator= to ensure that no one attempts to copy this object (for whatever reason, I couldn't make Noncopyable work).
  • kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray with new[].
  • kjs/JSVariableObject.cpp: (KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[]. (KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when "changing" the value from 0 to 0.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSGlobalObject.h

    r34919 r34946  
    260260    {
    261261        size_t registerArraySize = d()->registerArraySize;
    262         Register* registerArray = static_cast<Register*>(fastMalloc((registerArraySize + count) * sizeof(Register)));
     262        Register* registerArray = new Register[registerArraySize + count];
    263263        if (d()->registerArray)
    264264            memcpy(registerArray + count, d()->registerArray.get(), registerArraySize * sizeof(Register));
Note: See TracChangeset for help on using the changeset viewer.