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/JSVariableObject.h

    r34906 r34946  
    3434#include "SymbolTable.h"
    3535#include "UnusedParam.h"
    36 #include <wtf/OwnPtr.h>
     36#include <wtf/OwnArrayPtr.h>
    3737#include <wtf/UnusedParam.h>
    3838
     
    7070                ASSERT(symbolTable_);
    7171            }
    72            
     72
    7373            SymbolTable* symbolTable; // Maps name -> offset from "r" in register file.
    7474            Register* registers; // Pointers to the register past the end of local storage. (Local storage indexes are negative.)
    75             OwnPtr<Register> registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file.
     75            OwnArrayPtr<Register> registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file.
    7676            size_t registerArraySize;
     77
     78        private:
     79            JSVariableObjectData(const JSVariableObjectData&);
     80            JSVariableObjectData& operator=(const JSVariableObjectData&);
    7781        };
    7882
Note: See TracChangeset for help on using the changeset viewer.