Commit 5652af77 authored by oliver@apple.com's avatar oliver@apple.com

2011-05-25 Oliver Hunt <oliver@apple.com>

        Reviewed by Geoffrey Garen.

        Make RegExp GC allocated
        https://bugs.webkit.org/show_bug.cgi?id=61490

        Make RegExp GC allocated.  Basically mechanical change to replace
        most use of [Pass]RefPtr<RegExp> with RegExp* or WriteBarrier<RegExp>
        where actual ownership happens.

        Made the RegExpCache use Strong<> references currently to avoid any
        changes in behaviour.

        * JavaScriptCore.exp:
        * bytecode/CodeBlock.cpp:
        (JSC::CodeBlock::visitAggregate):
        * bytecode/CodeBlock.h:
        (JSC::CodeBlock::addRegExp):
        * bytecompiler/BytecodeGenerator.cpp:
        (JSC::BytecodeGenerator::addRegExp):
        (JSC::BytecodeGenerator::emitNewRegExp):
        * bytecompiler/BytecodeGenerator.h:
        * runtime/JSCell.h:
        * runtime/JSGlobalData.cpp:
        (JSC::JSGlobalData::JSGlobalData):
        (JSC::JSGlobalData::clearBuiltinStructures):
        (JSC::JSGlobalData::addRegExpToTrace):
        * runtime/JSGlobalData.h:
        * runtime/JSGlobalObject.cpp:
        (JSC::JSGlobalObject::reset):
        * runtime/RegExp.cpp:
        (JSC::RegExp::RegExp):
        (JSC::RegExp::create):
        (JSC::RegExp::invalidateCode):
        * runtime/RegExp.h:
        (JSC::RegExp::createStructure):
        * runtime/RegExpCache.cpp:
        (JSC::RegExpCache::lookupOrCreate):
        (JSC::RegExpCache::create):
        * runtime/RegExpCache.h:
        * runtime/RegExpConstructor.cpp:
        (JSC::constructRegExp):
        * runtime/RegExpObject.cpp:
        (JSC::RegExpObject::RegExpObject):
        (JSC::RegExpObject::visitChildren):
        * runtime/RegExpObject.h:
        (JSC::RegExpObject::setRegExp):
        (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
        * runtime/RegExpPrototype.cpp:
        (JSC::RegExpPrototype::RegExpPrototype):
        (JSC::regExpProtoFuncCompile):
        * runtime/RegExpPrototype.h:
        * runtime/StringPrototype.cpp:
        (JSC::stringProtoFuncMatch):
        (JSC::stringProtoFuncSearch):
2011-05-25  James Robinson  <jamesr@chromium.org>

        Reviewed by Geoffrey Garen

        CachedResource overhead size calculation ignores the actual size of the URL
        https://bugs.webkit.org/show_bug.cgi?id=61481

        CachedResource::overheadSize is used to determine the size of an entry in the memory cache to know when to evict
        it.  When the resource is a large data: URL, for example representing image or audio data, the URL size itself
        can be significant.

        This patch uses an estimate of actual number of bytes used by the URL that is valid for ASCII urls and close for
        other types of strings instead of a fixed number.

        * loader/cache/CachedResource.cpp:
        (WebCore::CachedResource::overheadSize):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@87346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6e00d03d
2011-05-25 Oliver Hunt <oliver@apple.com>
Revert last change, something weird happened when I went to land.
2011-05-25 Oliver Hunt <oliver@apple.com>
Reviewed by Geoffrey Garen.
......
......@@ -137,7 +137,7 @@ __ZN3JSC12JSGlobalData22clearBuiltinStructuresEv
__ZN3JSC12JSGlobalData6createENS_15ThreadStackTypeE
__ZN3JSC12JSGlobalDataD1Ev
__ZN3JSC12RegExpObject6s_infoE
__ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEPNS_9StructureEN3WTF17NonNullPassRefPtrINS_6RegExpEEE
__ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEPNS_9StructureEPNS_6RegExpE
__ZN3JSC12SamplingTool5setupEv
__ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE
__ZN3JSC12SmallStrings27createSingleCharacterStringEPNS_12JSGlobalDataEh
......
......@@ -18,7 +18,7 @@ EXPORTS
??0MD5@WTF@@QAE@XZ
??0Mutex@WTF@@QAE@XZ
??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
??0RegExpObject@JSC@@QAE@PAVJSGlobalObject@1@PAVStructure@1@V?$NonNullPassRefPtr@VRegExp@JSC@@@WTF@@@Z
??0RegExpObject@JSC@@QAE@PAVJSGlobalObject@1@PAVStructure@1@PAVRegExp@1@JSC@@@WTF@@@Z
??0SHA1@WTF@@QAE@XZ
??0StringObject@JSC@@QAE@PAVExecState@1@PAVStructure@1@ABVUString@1@@Z
??0Structure@JSC@@AAE@AAVJSGlobalData@1@VJSValue@1@ABVTypeInfo@1@IPBUClassInfo@1@@Z
......
......@@ -1470,8 +1470,13 @@ void CodeBlock::visitAggregate(SlotVisitor& visitor)
{
visitor.append(&m_globalObject);
visitor.append(&m_ownerExecutable);
if (m_rareData)
if (m_rareData) {
m_rareData->m_evalCodeCache.visitAggregate(visitor);
size_t regExpCount = m_rareData->m_regexps.size();
WriteBarrier<RegExp>* regexps = m_rareData->m_regexps.data();
for (size_t i = 0; i < regExpCount; i++)
visitor.append(regexps + i);
}
visitor.appendValues(m_constantRegisters.data(), m_constantRegisters.size());
for (size_t i = 0; i < m_functionExprs.size(); ++i)
visitor.append(&m_functionExprs[i]);
......
......@@ -36,7 +36,7 @@
#include "JSGlobalObject.h"
#include "JumpTable.h"
#include "Nodes.h"
#include "RegExp.h"
#include "RegExpObject.h"
#include "UString.h"
#include <wtf/FastAllocBase.h>
#include <wtf/PassOwnPtr.h>
......@@ -451,7 +451,13 @@ namespace JSC {
}
FunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); }
unsigned addRegExp(PassRefPtr<RegExp> r) { createRareDataIfNecessary(); unsigned size = m_rareData->m_regexps.size(); m_rareData->m_regexps.append(r); return size; }
unsigned addRegExp(RegExp* r)
{
createRareDataIfNecessary();
unsigned size = m_rareData->m_regexps.size();
m_rareData->m_regexps.append(WriteBarrier<RegExp>(*m_globalData, ownerExecutable(), r));
return size;
}
RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); }
JSGlobalObject* globalObject() { return m_globalObject.get(); }
......@@ -555,7 +561,7 @@ namespace JSC {
Vector<HandlerInfo> m_exceptionHandlers;
// Rare Constants
Vector<RefPtr<RegExp> > m_regexps;
Vector<WriteBarrier<RegExp> > m_regexps;
// Jump Tables
Vector<SimpleJumpTable> m_immediateSwitchJumpTables;
......
......@@ -966,7 +966,7 @@ RegisterID* BytecodeGenerator::addConstantValue(JSValue v)
return &m_constantPoolRegisters[index];
}
unsigned BytecodeGenerator::addRegExp(PassRefPtr<RegExp> r)
unsigned BytecodeGenerator::addRegExp(RegExp* r)
{
return m_codeBlock->addRegExp(r);
}
......@@ -1592,7 +1592,7 @@ RegisterID* BytecodeGenerator::emitNewFunctionInternal(RegisterID* dst, unsigned
return dst;
}
RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, PassRefPtr<RegExp> regExp)
RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp)
{
emitOpcode(op_new_regexp);
instructions().append(dst->index());
......
......@@ -291,7 +291,7 @@ namespace JSC {
RegisterID* emitLazyNewFunction(RegisterID* dst, FunctionBodyNode* body);
RegisterID* emitNewFunctionInternal(RegisterID* dst, unsigned index, bool shouldNullCheck);
RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func);
RegisterID* emitNewRegExp(RegisterID* dst, PassRefPtr<RegExp> regExp);
RegisterID* emitNewRegExp(RegisterID* dst, RegExp*);
RegisterID* emitMove(RegisterID* dst, RegisterID* src);
......@@ -475,7 +475,7 @@ namespace JSC {
unsigned addConstant(const Identifier&);
RegisterID* addConstantValue(JSValue);
unsigned addRegExp(PassRefPtr<RegExp>);
unsigned addRegExp(RegExp*);
FunctionExecutable* makeFunction(ExecState* exec, FunctionBodyNode* body)
{
......
......@@ -71,6 +71,7 @@ namespace JSC {
friend class ScopeChainNode;
friend class Structure;
friend class StructureChain;
friend class RegExp;
enum CreatingEarlyCellTag { CreatingEarlyCell };
protected:
......
......@@ -52,6 +52,7 @@
#include "Nodes.h"
#include "Parser.h"
#include "RegExpCache.h"
#include "RegExpObject.h"
#include "StrictEvalActivation.h"
#include <wtf/WTFThreadData.h>
#if ENABLE(REGEXP_TRACING)
......@@ -219,6 +220,7 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread
programExecutableStructure.set(*this, ProgramExecutable::createStructure(*this, jsNull()));
functionExecutableStructure.set(*this, FunctionExecutable::createStructure(*this, jsNull()));
dummyMarkableCellStructure.set(*this, JSCell::createDummyStructure(*this));
regExpStructure.set(*this, RegExp::createStructure(*this, jsNull()));
structureChainStructure.set(*this, StructureChain::createStructure(*this, jsNull()));
#if ENABLE(JSC_ZOMBIES)
......@@ -279,8 +281,9 @@ void JSGlobalData::clearBuiltinStructures()
programExecutableStructure.clear();
functionExecutableStructure.clear();
dummyMarkableCellStructure.clear();
regExpStructure.clear();
structureChainStructure.clear();
#if ENABLE(JSC_ZOMBIES)
zombieStructure.clear();
#endif
......@@ -446,7 +449,7 @@ void JSGlobalData::recompileAllJSFunctions()
}
#if ENABLE(REGEXP_TRACING)
void JSGlobalData::addRegExpToTrace(PassRefPtr<RegExp> regExp)
void JSGlobalData::addRegExpToTrace(RegExp* regExp)
{
m_rtTraceList->add(regExp);
}
......
......@@ -174,6 +174,7 @@ namespace JSC {
Strong<Structure> programExecutableStructure;
Strong<Structure> functionExecutableStructure;
Strong<Structure> dummyMarkableCellStructure;
Strong<Structure> regExpStructure;
Strong<Structure> structureChainStructure;
#if ENABLE(JSC_ZOMBIES)
......
......@@ -222,7 +222,9 @@ void JSGlobalObject::reset(JSValue prototype)
m_datePrototype.set(exec->globalData(), this, new (exec) DatePrototype(exec, this, DatePrototype::createStructure(exec->globalData(), m_objectPrototype.get())));
m_dateStructure.set(exec->globalData(), this, DateInstance::createStructure(exec->globalData(), m_datePrototype.get()));
m_regExpPrototype.set(exec->globalData(), this, new (exec) RegExpPrototype(exec, this, RegExpPrototype::createStructure(exec->globalData(), m_objectPrototype.get())));
RegExp* emptyRegex = RegExp::create(&exec->globalData(), "", NoFlags);
m_regExpPrototype.set(exec->globalData(), this, new (exec) RegExpPrototype(exec, this, RegExpPrototype::createStructure(exec->globalData(), m_objectPrototype.get()), emptyRegex));
m_regExpStructure.set(exec->globalData(), this, RegExpObject::createStructure(exec->globalData(), m_regExpPrototype.get()));
m_methodCallDummy.set(exec->globalData(), this, constructEmptyObject(exec));
......
......@@ -34,6 +34,8 @@
namespace JSC {
const ClassInfo RegExp::s_info = { "RegExp", 0, 0, 0 };
RegExpFlags regExpFlags(const UString& string)
{
RegExpFlags flags = NoFlags;
......@@ -73,8 +75,9 @@ struct RegExpRepresentation {
OwnPtr<Yarr::BytecodePattern> m_regExpBytecode;
};
inline RegExp::RegExp(JSGlobalData*, const UString& patternString, RegExpFlags flags)
: m_state(NotCompiled)
inline RegExp::RegExp(JSGlobalData* globalData, const UString& patternString, RegExpFlags flags)
: JSCell(*globalData, globalData->regExpStructure.get())
, m_state(NotCompiled)
, m_patternString(patternString)
, m_flags(flags)
, m_constructionError(0)
......@@ -95,13 +98,13 @@ RegExp::~RegExp()
{
}
PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& patternString, RegExpFlags flags)
RegExp* RegExp::create(JSGlobalData* globalData, const UString& patternString, RegExpFlags flags)
{
RefPtr<RegExp> res = adoptRef(new RegExp(globalData, patternString, flags));
RegExp* res = new (globalData) RegExp(globalData, patternString, flags);
#if ENABLE(REGEXP_TRACING)
globalData->addRegExpToTrace(res);
#endif
return res.release();
return res;
}
void RegExp::compile(JSGlobalData* globalData)
......@@ -194,6 +197,10 @@ int RegExp::match(JSGlobalData& globalData, const UString& s, int startOffset, V
return -1;
}
void RegExp::invalidateCode()
{
m_representation.clear();
}
#if ENABLE(YARR_JIT_DEBUG)
void RegExp::matchCompareWithInterpreter(const UString& s, int startOffset, int* offsetVector, int jitResult)
......
......@@ -24,6 +24,7 @@
#include "UString.h"
#include "ExecutableAllocator.h"
#include "Structure.h"
#include "RegExpKey.h"
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
......@@ -35,9 +36,9 @@ namespace JSC {
RegExpFlags regExpFlags(const UString&);
class RegExp : public RefCounted<RegExp> {
class RegExp : public JSCell {
public:
static PassRefPtr<RegExp> create(JSGlobalData* globalData, const UString& pattern, RegExpFlags);
static RegExp* create(JSGlobalData*, const UString& pattern, RegExpFlags);
~RegExp();
bool global() const { return m_flags & FlagGlobal; }
......@@ -52,10 +53,19 @@ namespace JSC {
int match(JSGlobalData&, const UString&, int startOffset, Vector<int, 32>* ovector = 0);
unsigned numSubpatterns() const { return m_numSubpatterns; }
void invalidateCode();
#if ENABLE(REGEXP_TRACING)
void printTraceData();
#endif
static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(globalData, prototype, TypeInfo(LeafType, 0), 0, &s_info);
}
static JS_EXPORTDATA const ClassInfo s_info;
private:
RegExp(JSGlobalData* globalData, const UString& pattern, RegExpFlags);
......
......@@ -28,31 +28,31 @@
#include "config.h"
#include "RegExpCache.h"
#include "RegExpObject.h"
namespace JSC {
PassRefPtr<RegExp> RegExpCache::lookupOrCreate(const UString& patternString, RegExpFlags flags)
RegExp* RegExpCache::lookupOrCreate(const UString& patternString, RegExpFlags flags)
{
if (patternString.length() < maxCacheablePatternLength) {
pair<RegExpCacheMap::iterator, bool> result = m_cacheMap.add(RegExpKey(flags, patternString), 0);
pair<RegExpCacheMap::iterator, bool> result = m_cacheMap.add(RegExpKey(flags, patternString), Strong<RegExp>());
if (!result.second)
return result.first->second;
return result.first->second.get();
else
return create(patternString, flags, result.first);
}
return create(patternString, flags, m_cacheMap.end());
}
PassRefPtr<RegExp> RegExpCache::create(const UString& patternString, RegExpFlags flags, RegExpCacheMap::iterator iterator)
RegExp* RegExpCache::create(const UString& patternString, RegExpFlags flags, RegExpCacheMap::iterator iterator)
{
RefPtr<RegExp> regExp = RegExp::create(m_globalData, patternString, flags);
RegExp* regExp = RegExp::create(m_globalData, patternString, flags);
if (patternString.length() >= maxCacheablePatternLength)
return regExp;
RegExpKey key = RegExpKey(flags, patternString);
iterator->first = key;
iterator->second = regExp;
iterator->second.set(*m_globalData, regExp);
++m_nextKeyToEvict;
if (m_nextKeyToEvict == maxCacheableEntries) {
......
......@@ -27,6 +27,7 @@
#include "RegExp.h"
#include "RegExpKey.h"
#include "Strong.h"
#include "UString.h"
#include <wtf/FixedArray.h>
#include <wtf/HashMap.h>
......@@ -38,11 +39,11 @@ namespace JSC {
class RegExpCache {
typedef HashMap<RegExpKey, RefPtr<RegExp> > RegExpCacheMap;
typedef HashMap<RegExpKey, Strong<RegExp> > RegExpCacheMap;
public:
PassRefPtr<RegExp> lookupOrCreate(const UString& patternString, RegExpFlags);
PassRefPtr<RegExp> create(const UString& patternString, RegExpFlags, RegExpCacheMap::iterator);
RegExp* lookupOrCreate(const UString& patternString, RegExpFlags);
RegExp* create(const UString& patternString, RegExpFlags, RegExpCacheMap::iterator);
RegExpCache(JSGlobalData* globalData);
private:
......
......@@ -317,10 +317,10 @@ JSObject* constructRegExp(ExecState* exec, JSGlobalObject* globalObject, const A
return throwError(exec, createSyntaxError(exec, "Invalid flags supplied to RegExp constructor."));
}
RefPtr<RegExp> regExp = exec->globalData().regExpCache()->lookupOrCreate(pattern, flags);
RegExp* regExp = exec->globalData().regExpCache()->lookupOrCreate(pattern, flags);
if (!regExp->isValid())
return throwError(exec, createSyntaxError(exec, regExp->errorMessage()));
return new (exec) RegExpObject(exec->lexicalGlobalObject(), globalObject->regExpStructure(), regExp.release());
return new (exec) RegExpObject(exec->lexicalGlobalObject(), globalObject->regExpStructure(), regExp);
}
static EncodedJSValue JSC_HOST_CALL constructWithRegExpConstructor(ExecState* exec)
......
......@@ -61,9 +61,9 @@ const ClassInfo RegExpObject::s_info = { "RegExp", &JSObjectWithGlobalObject::s_
@end
*/
RegExpObject::RegExpObject(JSGlobalObject* globalObject, Structure* structure, NonNullPassRefPtr<RegExp> regExp)
RegExpObject::RegExpObject(JSGlobalObject* globalObject, Structure* structure, RegExp* regExp)
: JSObjectWithGlobalObject(globalObject, structure)
, d(adoptPtr(new RegExpObjectData(regExp)))
, d(adoptPtr(new RegExpObjectData(globalObject->globalData(), this, regExp)))
{
ASSERT(inherits(&s_info));
}
......@@ -78,6 +78,8 @@ void RegExpObject::visitChildren(SlotVisitor& visitor)
COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
ASSERT(structure()->typeInfo().overridesVisitChildren());
Base::visitChildren(visitor);
if (d->regExp)
visitor.append(&d->regExp);
if (UNLIKELY(!d->lastIndex.get().isInt32()))
visitor.append(&d->lastIndex);
}
......
......@@ -25,15 +25,15 @@
#include "RegExp.h"
namespace JSC {
class RegExpObject : public JSObjectWithGlobalObject {
public:
typedef JSObjectWithGlobalObject Base;
RegExpObject(JSGlobalObject*, Structure*, NonNullPassRefPtr<RegExp>);
RegExpObject(JSGlobalObject*, Structure*, RegExp*);
virtual ~RegExpObject();
void setRegExp(PassRefPtr<RegExp> r) { d->regExp = r; }
void setRegExp(JSGlobalData& globalData, RegExp* r) { d->regExp.set(globalData, this, r); }
RegExp* regExp() const { return d->regExp.get(); }
void setLastIndex(size_t lastIndex)
......@@ -74,13 +74,13 @@ namespace JSC {
struct RegExpObjectData {
WTF_MAKE_FAST_ALLOCATED;
public:
RegExpObjectData(NonNullPassRefPtr<RegExp> regExp)
: regExp(regExp)
RegExpObjectData(JSGlobalData& globalData, RegExpObject* owner, RegExp* regExp)
: regExp(globalData, owner, regExp)
{
lastIndex.setWithoutWriteBarrier(jsNumber(0));
}
RefPtr<RegExp> regExp;
WriteBarrier<RegExp> regExp;
WriteBarrier<Unknown> lastIndex;
};
#if COMPILER(MSVC)
......
......@@ -62,8 +62,8 @@ const ClassInfo RegExpPrototype::s_info = { "RegExp", &RegExpObject::s_info, 0,
ASSERT_CLASS_FITS_IN_CELL(RegExpPrototype);
RegExpPrototype::RegExpPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
: RegExpObject(globalObject, structure, RegExp::create(&exec->globalData(), "", NoFlags))
RegExpPrototype::RegExpPrototype(ExecState*, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp)
: RegExpObject(globalObject, structure, regExp)
{
}
......@@ -101,7 +101,7 @@ EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec)
if (!thisValue.inherits(&RegExpObject::s_info))
return throwVMTypeError(exec);
RefPtr<RegExp> regExp;
RegExp* regExp;
JSValue arg0 = exec->argument(0);
JSValue arg1 = exec->argument(1);
......@@ -128,7 +128,7 @@ EncodedJSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec)
if (!regExp->isValid())
return throwVMError(exec, createSyntaxError(exec, regExp->errorMessage()));
asRegExpObject(thisValue)->setRegExp(regExp.release());
asRegExpObject(thisValue)->setRegExp(exec->globalData(), regExp);
asRegExpObject(thisValue)->setLastIndex(0);
return JSValue::encode(jsUndefined());
}
......
......@@ -28,7 +28,7 @@ namespace JSC {
class RegExpPrototype : public RegExpObject {
public:
RegExpPrototype(ExecState*, JSGlobalObject*, Structure*);
RegExpPrototype(ExecState*, JSGlobalObject*, Structure*, RegExp*);
static const ClassInfo s_info;
......
......@@ -606,7 +606,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec)
JSValue a0 = exec->argument(0);
RefPtr<RegExp> reg;
RegExp* reg;
if (a0.inherits(&RegExpObject::s_info))
reg = asRegExpObject(a0)->regExp();
else {
......@@ -620,7 +620,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec)
RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
int pos;
int matchLength = 0;
regExpConstructor->performMatch(*globalData, reg.get(), s, 0, pos, matchLength);
regExpConstructor->performMatch(*globalData, reg, s, 0, pos, matchLength);
if (!(reg->global())) {
// case without 'g' flag is handled like RegExp.prototype.exec
if (pos < 0)
......@@ -633,7 +633,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec)
while (pos >= 0) {
list.append(jsSubstring(exec, s, pos, matchLength));
pos += matchLength == 0 ? 1 : matchLength;
regExpConstructor->performMatch(*globalData, reg.get(), s, pos, pos, matchLength);
regExpConstructor->performMatch(*globalData, reg, s, pos, pos, matchLength);
}
if (list.isEmpty()) {
// if there are no matches at all, it's important to return
......@@ -655,7 +655,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec)
JSValue a0 = exec->argument(0);
RefPtr<RegExp> reg;
RegExp* reg;
if (a0.inherits(&RegExpObject::s_info))
reg = asRegExpObject(a0)->regExp();
else {
......@@ -669,7 +669,7 @@ EncodedJSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec)
RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
int pos;
int matchLength = 0;
regExpConstructor->performMatch(*globalData, reg.get(), s, 0, pos, matchLength);
regExpConstructor->performMatch(*globalData, reg, s, 0, pos, matchLength);
return JSValue::encode(jsNumber(pos));
}
......
2011-05-25 Oliver Hunt <oliver@apple.com>
Revert last change, something weird happened when I went to land.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal):
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::convertQVariantToValue):
2011-05-25 James Robinson <jamesr@chromium.org>
Reviewed by Geoffrey Garen
......@@ -1166,7 +1166,7 @@ private:
return JSValue();
RegExpFlags reFlags = regExpFlags(flags->ustring());
ASSERT(reFlags != InvalidFlags);
RefPtr<RegExp> regExp = RegExp::create(&m_exec->globalData(), pattern->ustring(), reFlags);
RegExp* regExp = RegExp::create(&m_exec->globalData(), pattern->ustring(), reFlags);
return new (m_exec) RegExpObject(m_exec->lexicalGlobalObject(), m_globalObject->regExpStructure(), regExp);
}
case ObjectReferenceTag: {
......
......@@ -861,9 +861,9 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con
UString pattern((UChar*)re.pattern().utf16(), re.pattern().length());
RegExpFlags flags = (re.caseSensitivity() == Qt::CaseInsensitive) ? FlagIgnoreCase : NoFlags;
RefPtr<JSC::RegExp> regExp = JSC::RegExp::create(&exec->globalData(), pattern, flags);
JSC::RegExp* regExp = JSC::RegExp::create(&exec->globalData(), pattern, flags);
if (regExp->isValid())
return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp.release());
return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp);
return jsNull();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment