Changeset 34946 in webkit for trunk/JavaScriptCore
- Timestamp:
- Jul 1, 2008, 11:35:03 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r34945 r34946 1 2008-07-01 Alexey Proskuryakov <[email protected]> 2 3 Reviewed by Darin. 4 5 https://bugs.webkit.org/show_bug.cgi?id=19834 6 Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82 7 8 Creating a global object with a custom prototype resets it twice (wasteful!). 9 So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset 10 the register array. 11 12 * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0). 13 14 * kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy 15 constructor and operator= to ensure that no one attempts to copy this object (for whatever 16 reason, I couldn't make Noncopyable work). 17 18 * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray 19 with new[]. 20 21 * kjs/JSVariableObject.cpp: 22 (KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[]. 23 (KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when 24 "changing" the value from 0 to 0. 25 1 26 2008-07-01 Geoffrey Garen <[email protected]> 2 27 -
trunk/JavaScriptCore/kjs/JSGlobalObject.cpp
r34907 r34946 175 175 _prop.clear(); 176 176 symbolTable().clear(); 177 setRegisterArray(0, 0); 177 178 178 179 // Prototypes -
trunk/JavaScriptCore/kjs/JSGlobalObject.h
r34919 r34946 260 260 { 261 261 size_t registerArraySize = d()->registerArraySize; 262 Register* registerArray = static_cast<Register*>(fastMalloc((registerArraySize + count) * sizeof(Register)));262 Register* registerArray = new Register[registerArraySize + count]; 263 263 if (d()->registerArray) 264 264 memcpy(registerArray + count, d()->registerArray.get(), registerArraySize * sizeof(Register)); -
trunk/JavaScriptCore/kjs/JSVariableObject.cpp
r34906 r34946 68 68 JSObject::mark(); 69 69 70 if (!d->registerArray)70 if (!d->registerArray) 71 71 return; 72 72 … … 88 88 ASSERT(!d->registerArray); 89 89 90 Register* registerArray = static_cast<Register*>(fastMalloc(count * sizeof(Register)));90 Register* registerArray = new Register[count]; 91 91 memcpy(registerArray, src, count * sizeof(Register)); 92 92 … … 96 96 void JSVariableObject::setRegisterArray(Register* registerArray, size_t count) 97 97 { 98 d->registerArray.set(registerArray); 98 if (registerArray != d->registerArray.get()) 99 d->registerArray.set(registerArray); 99 100 d->registerArraySize = count; 100 101 d->registers = registerArray + count; -
trunk/JavaScriptCore/kjs/JSVariableObject.h
r34906 r34946 34 34 #include "SymbolTable.h" 35 35 #include "UnusedParam.h" 36 #include <wtf/Own Ptr.h>36 #include <wtf/OwnArrayPtr.h> 37 37 #include <wtf/UnusedParam.h> 38 38 … … 70 70 ASSERT(symbolTable_); 71 71 } 72 72 73 73 SymbolTable* symbolTable; // Maps name -> offset from "r" in register file. 74 74 Register* registers; // Pointers to the register past the end of local storage. (Local storage indexes are negative.) 75 Own Ptr<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. 76 76 size_t registerArraySize; 77 78 private: 79 JSVariableObjectData(const JSVariableObjectData&); 80 JSVariableObjectData& operator=(const JSVariableObjectData&); 77 81 }; 78 82
Note:
See TracChangeset
for help on using the changeset viewer.