Changeset 87346 in webkit
- Timestamp:
- May 25, 2011 6:12:46 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r87345 r87346 1 2011-05-25 Oliver Hunt <oliver@apple.com>2 3 Revert last change, something weird happened when I went to land.4 5 1 2011-05-25 Oliver Hunt <oliver@apple.com> 6 2 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r87345 r87346 138 138 __ZN3JSC12JSGlobalDataD1Ev 139 139 __ZN3JSC12RegExpObject6s_infoE 140 __ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEPNS_9StructureE N3WTF17NonNullPassRefPtrINS_6RegExpEEE140 __ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEPNS_9StructureEPNS_6RegExpE 141 141 __ZN3JSC12SamplingTool5setupEv 142 142 __ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r87345 r87346 19 19 ??0Mutex@WTF@@QAE@XZ 20 20 ??0RefCountedLeakCounter@WTF@@QAE@PBD@Z 21 ??0RegExpObject@JSC@@QAE@PAVJSGlobalObject@1@PAVStructure@1@ V?$NonNullPassRefPtr@VRegExp@JSC@@@WTF@@@Z21 ??0RegExpObject@JSC@@QAE@PAVJSGlobalObject@1@PAVStructure@1@PAVRegExp@1@JSC@@@WTF@@@Z 22 22 ??0SHA1@WTF@@QAE@XZ 23 23 ??0StringObject@JSC@@QAE@PAVExecState@1@PAVStructure@1@ABVUString@1@@Z -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r87345 r87346 1471 1471 visitor.append(&m_globalObject); 1472 1472 visitor.append(&m_ownerExecutable); 1473 if (m_rareData) 1473 if (m_rareData) { 1474 1474 m_rareData->m_evalCodeCache.visitAggregate(visitor); 1475 size_t regExpCount = m_rareData->m_regexps.size(); 1476 WriteBarrier<RegExp>* regexps = m_rareData->m_regexps.data(); 1477 for (size_t i = 0; i < regExpCount; i++) 1478 visitor.append(regexps + i); 1479 } 1475 1480 visitor.appendValues(m_constantRegisters.data(), m_constantRegisters.size()); 1476 1481 for (size_t i = 0; i < m_functionExprs.size(); ++i) -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r87345 r87346 37 37 #include "JumpTable.h" 38 38 #include "Nodes.h" 39 #include "RegExp .h"39 #include "RegExpObject.h" 40 40 #include "UString.h" 41 41 #include <wtf/FastAllocBase.h> … … 452 452 FunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); } 453 453 454 unsigned addRegExp(PassRefPtr<RegExp> r) { createRareDataIfNecessary(); unsigned size = m_rareData->m_regexps.size(); m_rareData->m_regexps.append(r); return size; } 454 unsigned addRegExp(RegExp* r) 455 { 456 createRareDataIfNecessary(); 457 unsigned size = m_rareData->m_regexps.size(); 458 m_rareData->m_regexps.append(WriteBarrier<RegExp>(*m_globalData, ownerExecutable(), r)); 459 return size; 460 } 455 461 RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); } 456 462 … … 556 562 557 563 // Rare Constants 558 Vector< RefPtr<RegExp> > m_regexps;564 Vector<WriteBarrier<RegExp> > m_regexps; 559 565 560 566 // Jump Tables -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r87345 r87346 967 967 } 968 968 969 unsigned BytecodeGenerator::addRegExp( PassRefPtr<RegExp>r)969 unsigned BytecodeGenerator::addRegExp(RegExp* r) 970 970 { 971 971 return m_codeBlock->addRegExp(r); … … 1593 1593 } 1594 1594 1595 RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, PassRefPtr<RegExp>regExp)1595 RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp) 1596 1596 { 1597 1597 emitOpcode(op_new_regexp); -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r87345 r87346 292 292 RegisterID* emitNewFunctionInternal(RegisterID* dst, unsigned index, bool shouldNullCheck); 293 293 RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func); 294 RegisterID* emitNewRegExp(RegisterID* dst, PassRefPtr<RegExp> regExp);294 RegisterID* emitNewRegExp(RegisterID* dst, RegExp*); 295 295 296 296 RegisterID* emitMove(RegisterID* dst, RegisterID* src); … … 476 476 unsigned addConstant(const Identifier&); 477 477 RegisterID* addConstantValue(JSValue); 478 unsigned addRegExp( PassRefPtr<RegExp>);478 unsigned addRegExp(RegExp*); 479 479 480 480 FunctionExecutable* makeFunction(ExecState* exec, FunctionBodyNode* body) -
trunk/Source/JavaScriptCore/runtime/JSCell.h
r87345 r87346 72 72 friend class Structure; 73 73 friend class StructureChain; 74 friend class RegExp; 74 75 enum CreatingEarlyCellTag { CreatingEarlyCell }; 75 76 -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.cpp
r87345 r87346 53 53 #include "Parser.h" 54 54 #include "RegExpCache.h" 55 #include "RegExpObject.h" 55 56 #include "StrictEvalActivation.h" 56 57 #include <wtf/WTFThreadData.h> … … 220 221 functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, jsNull())); 221 222 dummyMarkableCellStructure.set(*this, JSCell::createDummyStructure(*this)); 223 regExpStructure.set(*this, RegExp::createStructure(*this, jsNull())); 222 224 structureChainStructure.set(*this, StructureChain::createStructure(*this, jsNull())); 223 225 … … 280 282 functionExecutableStructure.clear(); 281 283 dummyMarkableCellStructure.clear(); 284 regExpStructure.clear(); 282 285 structureChainStructure.clear(); 283 286 284 287 #if ENABLE(JSC_ZOMBIES) 285 288 zombieStructure.clear(); … … 447 450 448 451 #if ENABLE(REGEXP_TRACING) 449 void JSGlobalData::addRegExpToTrace( PassRefPtr<RegExp>regExp)452 void JSGlobalData::addRegExpToTrace(RegExp* regExp) 450 453 { 451 454 m_rtTraceList->add(regExp); -
trunk/Source/JavaScriptCore/runtime/JSGlobalData.h
r87345 r87346 175 175 Strong<Structure> functionExecutableStructure; 176 176 Strong<Structure> dummyMarkableCellStructure; 177 Strong<Structure> regExpStructure; 177 178 Strong<Structure> structureChainStructure; 178 179 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r87345 r87346 223 223 m_dateStructure.set(exec->globalData(), this, DateInstance::createStructure(exec->globalData(), m_datePrototype.get())); 224 224 225 m_regExpPrototype.set(exec->globalData(), this, new (exec) RegExpPrototype(exec, this, RegExpPrototype::createStructure(exec->globalData(), m_objectPrototype.get()))); 225 RegExp* emptyRegex = RegExp::create(&exec->globalData(), "", NoFlags); 226 227 m_regExpPrototype.set(exec->globalData(), this, new (exec) RegExpPrototype(exec, this, RegExpPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), emptyRegex)); 226 228 m_regExpStructure.set(exec->globalData(), this, RegExpObject::createStructure(exec->globalData(), m_regExpPrototype.get())); 227 229 -
trunk/Source/JavaScriptCore/runtime/RegExp.cpp
r87345 r87346 35 35 namespace JSC { 36 36 37 const ClassInfo RegExp::s_info = { "RegExp", 0, 0, 0 }; 38 37 39 RegExpFlags regExpFlags(const UString& string) 38 40 { … … 74 76 }; 75 77 76 inline RegExp::RegExp(JSGlobalData*, const UString& patternString, RegExpFlags flags) 77 : m_state(NotCompiled) 78 inline RegExp::RegExp(JSGlobalData* globalData, const UString& patternString, RegExpFlags flags) 79 : JSCell(*globalData, globalData->regExpStructure.get()) 80 , m_state(NotCompiled) 78 81 , m_patternString(patternString) 79 82 , m_flags(flags) … … 96 99 } 97 100 98 PassRefPtr<RegExp>RegExp::create(JSGlobalData* globalData, const UString& patternString, RegExpFlags flags)99 { 100 Re fPtr<RegExp> res = adoptRef(new RegExp(globalData, patternString, flags));101 RegExp* RegExp::create(JSGlobalData* globalData, const UString& patternString, RegExpFlags flags) 102 { 103 RegExp* res = new (globalData) RegExp(globalData, patternString, flags); 101 104 #if ENABLE(REGEXP_TRACING) 102 105 globalData->addRegExpToTrace(res); 103 106 #endif 104 return res .release();107 return res; 105 108 } 106 109 … … 195 198 } 196 199 200 void RegExp::invalidateCode() 201 { 202 m_representation.clear(); 203 } 197 204 198 205 #if ENABLE(YARR_JIT_DEBUG) -
trunk/Source/JavaScriptCore/runtime/RegExp.h
r87345 r87346 25 25 #include "UString.h" 26 26 #include "ExecutableAllocator.h" 27 #include "Structure.h" 27 28 #include "RegExpKey.h" 28 29 #include <wtf/Forward.h> … … 36 37 RegExpFlags regExpFlags(const UString&); 37 38 38 class RegExp : public RefCounted<RegExp>{39 class RegExp : public JSCell { 39 40 public: 40 static PassRefPtr<RegExp> create(JSGlobalData* globalData, const UString& pattern, RegExpFlags);41 static RegExp* create(JSGlobalData*, const UString& pattern, RegExpFlags); 41 42 ~RegExp(); 42 43 … … 53 54 unsigned numSubpatterns() const { return m_numSubpatterns; } 54 55 56 void invalidateCode(); 57 55 58 #if ENABLE(REGEXP_TRACING) 56 59 void printTraceData(); 57 60 #endif 58 61 62 static Structure* createStructure(JSGlobalData& globalData, JSValue prototype) 63 { 64 return Structure::create(globalData, prototype, TypeInfo(LeafType, 0), 0, &s_info); 65 } 66 67 static JS_EXPORTDATA const ClassInfo s_info; 68 59 69 private: 60 70 RegExp(JSGlobalData* globalData, const UString& pattern, RegExpFlags); -
trunk/Source/JavaScriptCore/runtime/RegExpCache.cpp
r87345 r87346 29 29 30 30 #include "RegExpCache.h" 31 #include "RegExpObject.h" 31 32 32 33 namespace JSC { 33 34 34 PassRefPtr<RegExp>RegExpCache::lookupOrCreate(const UString& patternString, RegExpFlags flags)35 RegExp* RegExpCache::lookupOrCreate(const UString& patternString, RegExpFlags flags) 35 36 { 36 37 if (patternString.length() < maxCacheablePatternLength) { 37 pair<RegExpCacheMap::iterator, bool> result = m_cacheMap.add(RegExpKey(flags, patternString), 0);38 pair<RegExpCacheMap::iterator, bool> result = m_cacheMap.add(RegExpKey(flags, patternString), Strong<RegExp>()); 38 39 if (!result.second) 39 return result.first->second ;40 return result.first->second.get(); 40 41 else 41 42 return create(patternString, flags, result.first); … … 44 45 } 45 46 46 PassRefPtr<RegExp>RegExpCache::create(const UString& patternString, RegExpFlags flags, RegExpCacheMap::iterator iterator)47 RegExp* RegExpCache::create(const UString& patternString, RegExpFlags flags, RegExpCacheMap::iterator iterator) 47 48 { 48 RefPtr<RegExp> regExp = RegExp::create(m_globalData, patternString, flags); 49 49 RegExp* regExp = RegExp::create(m_globalData, patternString, flags); 50 50 if (patternString.length() >= maxCacheablePatternLength) 51 51 return regExp; … … 53 53 RegExpKey key = RegExpKey(flags, patternString); 54 54 iterator->first = key; 55 iterator->second = regExp;55 iterator->second.set(*m_globalData, regExp); 56 56 57 57 ++m_nextKeyToEvict; -
trunk/Source/JavaScriptCore/runtime/RegExpCache.h
r87345 r87346 28 28 #include "RegExp.h" 29 29 #include "RegExpKey.h" 30 #include "Strong.h" 30 31 #include "UString.h" 31 32 #include <wtf/FixedArray.h> … … 39 40 class RegExpCache { 40 41 41 typedef HashMap<RegExpKey, RefPtr<RegExp> > RegExpCacheMap;42 typedef HashMap<RegExpKey, Strong<RegExp> > RegExpCacheMap; 42 43 43 44 public: 44 PassRefPtr<RegExp>lookupOrCreate(const UString& patternString, RegExpFlags);45 PassRefPtr<RegExp>create(const UString& patternString, RegExpFlags, RegExpCacheMap::iterator);45 RegExp* lookupOrCreate(const UString& patternString, RegExpFlags); 46 RegExp* create(const UString& patternString, RegExpFlags, RegExpCacheMap::iterator); 46 47 RegExpCache(JSGlobalData* globalData); 47 48 -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
r87345 r87346 318 318 } 319 319 320 Re fPtr<RegExp>regExp = exec->globalData().regExpCache()->lookupOrCreate(pattern, flags);320 RegExp* regExp = exec->globalData().regExpCache()->lookupOrCreate(pattern, flags); 321 321 if (!regExp->isValid()) 322 322 return throwError(exec, createSyntaxError(exec, regExp->errorMessage())); 323 return new (exec) RegExpObject(exec->lexicalGlobalObject(), globalObject->regExpStructure(), regExp .release());323 return new (exec) RegExpObject(exec->lexicalGlobalObject(), globalObject->regExpStructure(), regExp); 324 324 } 325 325 -
trunk/Source/JavaScriptCore/runtime/RegExpObject.cpp
r87345 r87346 62 62 */ 63 63 64 RegExpObject::RegExpObject(JSGlobalObject* globalObject, Structure* structure, NonNullPassRefPtr<RegExp>regExp)64 RegExpObject::RegExpObject(JSGlobalObject* globalObject, Structure* structure, RegExp* regExp) 65 65 : JSObjectWithGlobalObject(globalObject, structure) 66 , d(adoptPtr(new RegExpObjectData( regExp)))66 , d(adoptPtr(new RegExpObjectData(globalObject->globalData(), this, regExp))) 67 67 { 68 68 ASSERT(inherits(&s_info)); … … 79 79 ASSERT(structure()->typeInfo().overridesVisitChildren()); 80 80 Base::visitChildren(visitor); 81 if (d->regExp) 82 visitor.append(&d->regExp); 81 83 if (UNLIKELY(!d->lastIndex.get().isInt32())) 82 84 visitor.append(&d->lastIndex); -
trunk/Source/JavaScriptCore/runtime/RegExpObject.h
r87345 r87346 26 26 27 27 namespace JSC { 28 28 29 29 class RegExpObject : public JSObjectWithGlobalObject { 30 30 public: 31 31 typedef JSObjectWithGlobalObject Base; 32 32 33 RegExpObject(JSGlobalObject*, Structure*, NonNullPassRefPtr<RegExp>);33 RegExpObject(JSGlobalObject*, Structure*, RegExp*); 34 34 virtual ~RegExpObject(); 35 35 36 void setRegExp( PassRefPtr<RegExp> r) { d->regExp = r; }36 void setRegExp(JSGlobalData& globalData, RegExp* r) { d->regExp.set(globalData, this, r); } 37 37 RegExp* regExp() const { return d->regExp.get(); } 38 38 … … 75 75 WTF_MAKE_FAST_ALLOCATED; 76 76 public: 77 RegExpObjectData( NonNullPassRefPtr<RegExp>regExp)78 : regExp( regExp)77 RegExpObjectData(JSGlobalData& globalData, RegExpObject* owner, RegExp* regExp) 78 : regExp(globalData, owner, regExp) 79 79 { 80 80 lastIndex.setWithoutWriteBarrier(jsNumber(0)); 81 81 } 82 82 83 RefPtr<RegExp> regExp;83 WriteBarrier<RegExp> regExp; 84 84 WriteBarrier<Unknown> lastIndex; 85 85 }; -
trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
r87345 r87346 63 63 ASSERT_CLASS_FITS_IN_CELL(RegExpPrototype); 64 64 65 RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)66 : RegExpObject(globalObject, structure, RegExp::create(&exec->globalData(), "", NoFlags))65 RegExpPrototype::RegExpPrototype(ExecState*, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp) 66 : RegExpObject(globalObject, structure, regExp) 67 67 { 68 68 } … … 102 102 return throwVMTypeError(exec); 103 103 104 Re fPtr<RegExp>regExp;104 RegExp* regExp; 105 105 JSValue arg0 = exec->argument(0); 106 106 JSValue arg1 = exec->argument(1); … … 129 129 return throwVMError(exec, createSyntaxError(exec, regExp->errorMessage())); 130 130 131 asRegExpObject(thisValue)->setRegExp( regExp.release());131 asRegExpObject(thisValue)->setRegExp(exec->globalData(), regExp); 132 132 asRegExpObject(thisValue)->setLastIndex(0); 133 133 return JSValue::encode(jsUndefined()); -
trunk/Source/JavaScriptCore/runtime/RegExpPrototype.h
r87345 r87346 29 29 class RegExpPrototype : public RegExpObject { 30 30 public: 31 RegExpPrototype(ExecState*, JSGlobalObject*, Structure* );31 RegExpPrototype(ExecState*, JSGlobalObject*, Structure*, RegExp*); 32 32 33 33 static const ClassInfo s_info; -
trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp
r87345 r87346 607 607 JSValue a0 = exec->argument(0); 608 608 609 Re fPtr<RegExp>reg;609 RegExp* reg; 610 610 if (a0.inherits(&RegExpObject::s_info)) 611 611 reg = asRegExpObject(a0)->regExp(); … … 621 621 int pos; 622 622 int matchLength = 0; 623 regExpConstructor->performMatch(*globalData, reg .get(), s, 0, pos, matchLength);623 regExpConstructor->performMatch(*globalData, reg, s, 0, pos, matchLength); 624 624 if (!(reg->global())) { 625 625 // case without 'g' flag is handled like RegExp.prototype.exec … … 634 634 list.append(jsSubstring(exec, s, pos, matchLength)); 635 635 pos += matchLength == 0 ? 1 : matchLength; 636 regExpConstructor->performMatch(*globalData, reg .get(), s, pos, pos, matchLength);636 regExpConstructor->performMatch(*globalData, reg, s, pos, pos, matchLength); 637 637 } 638 638 if (list.isEmpty()) { … … 656 656 JSValue a0 = exec->argument(0); 657 657 658 Re fPtr<RegExp>reg;658 RegExp* reg; 659 659 if (a0.inherits(&RegExpObject::s_info)) 660 660 reg = asRegExpObject(a0)->regExp(); … … 670 670 int pos; 671 671 int matchLength = 0; 672 regExpConstructor->performMatch(*globalData, reg .get(), s, 0, pos, matchLength);672 regExpConstructor->performMatch(*globalData, reg, s, 0, pos, matchLength); 673 673 return JSValue::encode(jsNumber(pos)); 674 674 } -
trunk/Source/WebCore/ChangeLog
r87345 r87346 1 2011-05-25 Oliver Hunt <oliver@apple.com>2 3 Revert last change, something weird happened when I went to land.4 5 * bindings/js/SerializedScriptValue.cpp:6 (WebCore::CloneDeserializer::readTerminal):7 * bridge/qt/qt_runtime.cpp:8 (JSC::Bindings::convertQVariantToValue):9 10 1 2011-05-25 James Robinson <jamesr@chromium.org> 11 2 -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r87345 r87346 1167 1167 RegExpFlags reFlags = regExpFlags(flags->ustring()); 1168 1168 ASSERT(reFlags != InvalidFlags); 1169 Re fPtr<RegExp>regExp = RegExp::create(&m_exec->globalData(), pattern->ustring(), reFlags);1169 RegExp* regExp = RegExp::create(&m_exec->globalData(), pattern->ustring(), reFlags); 1170 1170 return new (m_exec) RegExpObject(m_exec->lexicalGlobalObject(), m_globalObject->regExpStructure(), regExp); 1171 1171 } -
trunk/Source/WebCore/bridge/qt/qt_runtime.cpp
r87345 r87346 862 862 RegExpFlags flags = (re.caseSensitivity() == Qt::CaseInsensitive) ? FlagIgnoreCase : NoFlags; 863 863 864 RefPtr<JSC::RegExp>regExp = JSC::RegExp::create(&exec->globalData(), pattern, flags);864 JSC::RegExp* regExp = JSC::RegExp::create(&exec->globalData(), pattern, flags); 865 865 if (regExp->isValid()) 866 return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp .release());866 return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp); 867 867 return jsNull(); 868 868 }
Note: See TracChangeset
for help on using the changeset viewer.