WebKit Bugzilla
Attachment 360231 Details for
Bug 193801
: [JSC] RegExpConstructor should not have own IsoSubspace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193801-20190126011045.patch (text/plain), 25.40 KB, created by
Yusuke Suzuki
on 2019-01-26 01:10:46 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2019-01-26 01:10:46 PST
Size:
25.40 KB
patch
obsolete
>Subversion Revision: 240542 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 253b1ea60b41a9166c8fddbc86ef10964ca94165..a5dc8f9bc10f4d629e43a972d1f0d976bb1b4ca7 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,60 @@ >+2019-01-26 Yusuke Suzuki <ysuzuki@apple.com> >+ >+ [JSC] RegExpConstructor should not have own IsoSubspace >+ https://bugs.webkit.org/show_bug.cgi?id=193801 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * runtime/RegExpCache.cpp: >+ (JSC::RegExpCache::RegExpCache): >+ (JSC::RegExpCache::deleteAllCode): >+ * runtime/RegExpCache.h: >+ (JSC::RegExpCache::emptyRegExp const): >+ * runtime/RegExpCachedResult.cpp: >+ (JSC::RegExpCachedResult::visitAggregate): >+ (JSC::RegExpCachedResult::visitChildren): Deleted. >+ * runtime/RegExpCachedResult.h: >+ * runtime/RegExpConstructor.cpp: >+ (JSC::RegExpConstructor::RegExpConstructor): >+ (JSC::regExpConstructorDollar): >+ (JSC::regExpConstructorInput): >+ (JSC::regExpConstructorMultiline): >+ (JSC::regExpConstructorLastMatch): >+ (JSC::regExpConstructorLastParen): >+ (JSC::regExpConstructorLeftContext): >+ (JSC::regExpConstructorRightContext): >+ (JSC::setRegExpConstructorInput): >+ (JSC::setRegExpConstructorMultiline): >+ (JSC::RegExpConstructor::destroy): Deleted. >+ (JSC::RegExpConstructor::visitChildren): Deleted. >+ (JSC::RegExpConstructor::getBackref): Deleted. >+ (JSC::RegExpConstructor::getLastParen): Deleted. >+ (JSC::RegExpConstructor::getLeftContext): Deleted. >+ (JSC::RegExpConstructor::getRightContext): Deleted. >+ * runtime/RegExpConstructor.h: >+ (JSC::RegExpConstructor::performMatch): >+ * runtime/RegExpGlobalData.cpp: Added. >+ (JSC::RegExpGlobalData::RegExpGlobalData): >+ (JSC::RegExpGlobalData::visitAggregate): >+ (JSC::RegExpGlobalData::getBackref): >+ (JSC::RegExpGlobalData::getLastParen): >+ (JSC::RegExpGlobalData::getLeftContext): >+ (JSC::RegExpGlobalData::getRightContext): >+ * runtime/RegExpGlobalData.h: Copied from Source/JavaScriptCore/runtime/RegExpCache.h. >+ (JSC::RegExpGlobalData::cachedResult): >+ (JSC::RegExpGlobalData::setMultiline): >+ (JSC::RegExpGlobalData::multiline const): >+ (JSC::RegExpGlobalData::setInput): >+ (JSC::RegExpGlobalData::input): >+ (JSC::RegExpGlobalData::offsetOfCachedResult): >+ * runtime/RegExpPrototype.cpp: >+ (JSC::RegExpPrototype::finishCreation): >+ (JSC::RegExpPrototype::visitChildren): Deleted. >+ * runtime/RegExpPrototype.h: >+ * runtime/VM.cpp: >+ (JSC::VM::VM): >+ * runtime/VM.h: >+ > 2019-01-25 Devin Rousso <drousso@apple.com> > > Web Inspector: provide a way to edit page settings on a remote target >diff --git a/Source/JavaScriptCore/runtime/RegExpCache.cpp b/Source/JavaScriptCore/runtime/RegExpCache.cpp >index 8f4660a78b423b153196a1d11fd7c0dfa894161e..402c937c9aa40fc6e9d3664808783e9e13f4cc6e 100644 >--- a/Source/JavaScriptCore/runtime/RegExpCache.cpp >+++ b/Source/JavaScriptCore/runtime/RegExpCache.cpp >@@ -52,6 +52,7 @@ RegExp* RegExpCache::lookupOrCreate(const String& patternString, RegExpFlags fla > > RegExpCache::RegExpCache(VM* vm) > : m_nextEntryInStrongCache(0) >+ , m_emptyRegExp(vm, RegExp::create(vm, "", NoFlags)) > , m_vm(vm) > { > } >@@ -78,6 +79,7 @@ void RegExpCache::deleteAllCode() > for (int i = 0; i < maxStrongCacheableEntries; i++) > m_strongCache[i].clear(); > m_nextEntryInStrongCache = 0; >+ m_emptyRegExp->deleteCode(); > > RegExpCacheMap::iterator end = m_weakCache.end(); > for (RegExpCacheMap::iterator it = m_weakCache.begin(); it != end; ++it) { >diff --git a/Source/JavaScriptCore/runtime/RegExpCache.h b/Source/JavaScriptCore/runtime/RegExpCache.h >index 4ae95f0c2f35f56838664fc5aecaa1de91b22d6b..f1a3ecca9153bb49cec3397db9658f627c1aeb4c 100644 >--- a/Source/JavaScriptCore/runtime/RegExpCache.h >+++ b/Source/JavaScriptCore/runtime/RegExpCache.h >@@ -46,6 +46,8 @@ class RegExpCache : private WeakHandleOwner { > RegExpCache(VM* vm); > void deleteAllCode(); > >+ RegExp* emptyRegExp() const { return m_emptyRegExp.get(); } >+ > private: > > static const unsigned maxStrongCacheablePatternLength = 256; >@@ -59,6 +61,7 @@ class RegExpCache : private WeakHandleOwner { > RegExpCacheMap m_weakCache; // Holds all regular expressions currently live. > int m_nextEntryInStrongCache; > std::array<Strong<RegExp>, maxStrongCacheableEntries> m_strongCache; // Holds a select few regular expressions that have compiled and executed >+ Strong<RegExp> m_emptyRegExp; > VM* m_vm; > }; > >diff --git a/Source/JavaScriptCore/runtime/RegExpCachedResult.cpp b/Source/JavaScriptCore/runtime/RegExpCachedResult.cpp >index 5b45ee309280c6904efe8f66d6a15b6d8a4ae950..c6a6b032dfa228ba583007387d676d79e8093bb1 100644 >--- a/Source/JavaScriptCore/runtime/RegExpCachedResult.cpp >+++ b/Source/JavaScriptCore/runtime/RegExpCachedResult.cpp >@@ -31,7 +31,7 @@ > > namespace JSC { > >-void RegExpCachedResult::visitChildren(SlotVisitor& visitor) >+void RegExpCachedResult::visitAggregate(SlotVisitor& visitor) > { > visitor.append(m_lastInput); > visitor.append(m_lastRegExp); >diff --git a/Source/JavaScriptCore/runtime/RegExpCachedResult.h b/Source/JavaScriptCore/runtime/RegExpCachedResult.h >index 40cc064f853c1b4c1ad3de40653fd088e65518ee..612a27fb76e599d9b9cacfdac8673b5f97645a8c 100644 >--- a/Source/JavaScriptCore/runtime/RegExpCachedResult.h >+++ b/Source/JavaScriptCore/runtime/RegExpCachedResult.h >@@ -71,7 +71,7 @@ class RegExpCachedResult { > return m_reified ? m_reifiedInput.get() : m_lastInput.get(); > } > >- void visitChildren(SlotVisitor&); >+ void visitAggregate(SlotVisitor&); > > static ptrdiff_t offsetOfLastRegExp() { return OBJECT_OFFSETOF(RegExpCachedResult, m_lastRegExp); } > static ptrdiff_t offsetOfLastInput() { return OBJECT_OFFSETOF(RegExpCachedResult, m_lastInput); } >diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp >index 3467924654e5e3cf26e377305385f5e9d3fb2cf3..9ae6b5e542cc8a8f791250042db806b6e995ef0d 100644 >--- a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp >+++ b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp >@@ -82,8 +82,6 @@ static EncodedJSValue JSC_HOST_CALL constructWithRegExpConstructor(ExecState*); > > RegExpConstructor::RegExpConstructor(VM& vm, Structure* structure, RegExpPrototype* regExpPrototype) > : InternalFunction(vm, structure, callRegExpConstructor, constructWithRegExpConstructor) >- , m_cachedResult(vm, this, regExpPrototype->emptyRegExp()) >- , m_multiline(false) > { > } > >@@ -98,95 +96,62 @@ void RegExpConstructor::finishCreation(VM& vm, RegExpPrototype* regExpPrototype, > putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, PropertyAttribute::Accessor | PropertyAttribute::ReadOnly | PropertyAttribute::DontEnum); > } > >-void RegExpConstructor::destroy(JSCell* cell) >-{ >- static_cast<RegExpConstructor*>(cell)->RegExpConstructor::~RegExpConstructor(); >-} >- >-void RegExpConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor) >-{ >- RegExpConstructor* thisObject = jsCast<RegExpConstructor*>(cell); >- ASSERT_GC_OBJECT_INHERITS(thisObject, info()); >- Base::visitChildren(thisObject, visitor); >- thisObject->m_cachedResult.visitChildren(visitor); >-} >- >-JSValue RegExpConstructor::getBackref(ExecState* exec, unsigned i) >-{ >- JSArray* array = m_cachedResult.lastResult(exec, this); >- >- if (i < array->length()) { >- JSValue result = JSValue(array).get(exec, i); >- ASSERT(result.isString() || result.isUndefined()); >- if (!result.isUndefined()) >- return result; >- } >- return jsEmptyString(exec); >-} >- >-JSValue RegExpConstructor::getLastParen(ExecState* exec) >-{ >- JSArray* array = m_cachedResult.lastResult(exec, this); >- unsigned length = array->length(); >- if (length > 1) { >- JSValue result = JSValue(array).get(exec, length - 1); >- ASSERT(result.isString() || result.isUndefined()); >- if (!result.isUndefined()) >- return result; >- } >- return jsEmptyString(exec); >-} >- >-JSValue RegExpConstructor::getLeftContext(ExecState* exec) >-{ >- return m_cachedResult.leftContext(exec, this); >-} >- >-JSValue RegExpConstructor::getRightContext(ExecState* exec) >-{ >- return m_cachedResult.rightContext(exec, this); >-} >- > template<int N> > EncodedJSValue regExpConstructorDollar(ExecState* exec, EncodedJSValue thisValue, PropertyName) > { >- return JSValue::encode(jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->getBackref(exec, N)); >+ VM& vm = exec->vm(); >+ JSGlobalObject* globalObject = jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->globalObject(vm); >+ return JSValue::encode(globalObject->regExpGlobalData().getBackref(exec, globalObject, N)); > } > >-EncodedJSValue regExpConstructorInput(ExecState*, EncodedJSValue thisValue, PropertyName) >+EncodedJSValue regExpConstructorInput(ExecState* exec, EncodedJSValue thisValue, PropertyName) > { >- return JSValue::encode(jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->input()); >+ VM& vm = exec->vm(); >+ JSGlobalObject* globalObject = jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->globalObject(vm); >+ return JSValue::encode(globalObject->regExpGlobalData().input()); > } > >-EncodedJSValue regExpConstructorMultiline(ExecState*, EncodedJSValue thisValue, PropertyName) >+EncodedJSValue regExpConstructorMultiline(ExecState* exec, EncodedJSValue thisValue, PropertyName) > { >- return JSValue::encode(jsBoolean(jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->multiline())); >+ VM& vm = exec->vm(); >+ JSGlobalObject* globalObject = jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->globalObject(vm); >+ return JSValue::encode(jsBoolean(globalObject->regExpGlobalData().multiline())); > } > > EncodedJSValue regExpConstructorLastMatch(ExecState* exec, EncodedJSValue thisValue, PropertyName) > { >- return JSValue::encode(jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->getBackref(exec, 0)); >+ VM& vm = exec->vm(); >+ JSGlobalObject* globalObject = jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->globalObject(vm); >+ return JSValue::encode(globalObject->regExpGlobalData().getBackref(exec, globalObject, 0)); > } > > EncodedJSValue regExpConstructorLastParen(ExecState* exec, EncodedJSValue thisValue, PropertyName) > { >- return JSValue::encode(jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->getLastParen(exec)); >+ VM& vm = exec->vm(); >+ JSGlobalObject* globalObject = jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->globalObject(vm); >+ return JSValue::encode(globalObject->regExpGlobalData().getLastParen(exec, globalObject)); > } > > EncodedJSValue regExpConstructorLeftContext(ExecState* exec, EncodedJSValue thisValue, PropertyName) > { >- return JSValue::encode(jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->getLeftContext(exec)); >+ VM& vm = exec->vm(); >+ JSGlobalObject* globalObject = jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->globalObject(vm); >+ return JSValue::encode(globalObject->regExpGlobalData().getLeftContext(exec, globalObject)); > } > > EncodedJSValue regExpConstructorRightContext(ExecState* exec, EncodedJSValue thisValue, PropertyName) > { >- return JSValue::encode(jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->getRightContext(exec)); >+ VM& vm = exec->vm(); >+ JSGlobalObject* globalObject = jsCast<RegExpConstructor*>(JSValue::decode(thisValue))->globalObject(vm); >+ return JSValue::encode(globalObject->regExpGlobalData().getRightContext(exec, globalObject)); > } > > bool setRegExpConstructorInput(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue value) > { >- if (auto constructor = jsDynamicCast<RegExpConstructor*>(exec->vm(), JSValue::decode(thisValue))) { >- constructor->setInput(exec, JSValue::decode(value).toString(exec)); >+ VM& vm = exec->vm(); >+ if (auto constructor = jsDynamicCast<RegExpConstructor*>(vm, JSValue::decode(thisValue))) { >+ JSGlobalObject* globalObject = constructor->globalObject(vm); >+ globalObject->regExpGlobalData().setInput(exec, globalObject, JSValue::decode(value).toString(exec)); > return true; > } > return false; >@@ -194,8 +159,10 @@ bool setRegExpConstructorInput(ExecState* exec, EncodedJSValue thisValue, Encode > > bool setRegExpConstructorMultiline(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue value) > { >- if (auto constructor = jsDynamicCast<RegExpConstructor*>(exec->vm(), JSValue::decode(thisValue))) { >- constructor->setMultiline(JSValue::decode(value).toBoolean(exec)); >+ VM& vm = exec->vm(); >+ if (auto constructor = jsDynamicCast<RegExpConstructor*>(vm, JSValue::decode(thisValue))) { >+ JSGlobalObject* globalObject = constructor->globalObject(vm); >+ globalObject->regExpGlobalData().setMultiline(JSValue::decode(value).toBoolean(exec)); > return true; > } > return false; >diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.h b/Source/JavaScriptCore/runtime/RegExpConstructor.h >index a7a0de800e9e0a7ede6eb3a77c18229f1035f582..2a82f1eb5e0926571ab1741fd32ad1108afc1053 100644 >--- a/Source/JavaScriptCore/runtime/RegExpConstructor.h >+++ b/Source/JavaScriptCore/runtime/RegExpConstructor.h >@@ -35,12 +35,6 @@ class RegExpConstructor final : public InternalFunction { > typedef InternalFunction Base; > static const unsigned StructureFlags = Base::StructureFlags | HasStaticPropertyTable; > >- template<typename CellType> >- static IsoSubspace* subspaceFor(VM& vm) >- { >- return &vm.regExpConstructorSpace; >- } >- > static RegExpConstructor* create(VM& vm, Structure* structure, RegExpPrototype* regExpPrototype, GetterSetter* species) > { > RegExpConstructor* constructor = new (NotNull, allocateCell<RegExpConstructor>(vm.heap)) RegExpConstructor(vm, structure, regExpPrototype); >@@ -59,31 +53,11 @@ class RegExpConstructor final : public InternalFunction { > MatchResult performMatch(VM&, RegExp*, JSString*, const String&, int startOffset); > void recordMatch(VM&, RegExp*, JSString*, const MatchResult&); > >- void setMultiline(bool multiline) { m_multiline = multiline; } >- bool multiline() const { return m_multiline; } >- >- JSValue getBackref(ExecState*, unsigned); >- JSValue getLastParen(ExecState*); >- JSValue getLeftContext(ExecState*); >- JSValue getRightContext(ExecState*); >- >- void setInput(ExecState* exec, JSString* string) { m_cachedResult.setInput(exec, this, string); } >- JSString* input() { return m_cachedResult.input(); } >- >- static void visitChildren(JSCell*, SlotVisitor&); >- >- static ptrdiff_t offsetOfCachedResult() { return OBJECT_OFFSETOF(RegExpConstructor, m_cachedResult); } >- > protected: > void finishCreation(VM&, RegExpPrototype*, GetterSetter* species); > > private: > RegExpConstructor(VM&, Structure*, RegExpPrototype*); >- static void destroy(JSCell*); >- >- RegExpCachedResult m_cachedResult; >- bool m_multiline; >- Vector<int> m_ovector; > }; > > JSObject* constructRegExp(ExecState*, JSGlobalObject*, const ArgList&, JSObject* callee = nullptr, JSValue newTarget = jsUndefined()); >@@ -95,6 +69,7 @@ JSObject* constructRegExp(ExecState*, JSGlobalObject*, const ArgList&, JSObject* > */ > ALWAYS_INLINE MatchResult RegExpConstructor::performMatch(VM& vm, RegExp* regExp, JSString* string, const String& input, int startOffset, int** ovector) > { >+ RegExpGlobalData& globalData > int position = regExp->match(vm, input, startOffset, m_ovector); > > if (ovector) >diff --git a/Source/JavaScriptCore/runtime/RegExpGlobalData.cpp b/Source/JavaScriptCore/runtime/RegExpGlobalData.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..287d4b21613c24c96903743404de1f76e91d15a1 >--- /dev/null >+++ b/Source/JavaScriptCore/runtime/RegExpGlobalData.cpp >@@ -0,0 +1,77 @@ >+/* >+ * Copyright (C) 2019 Apple Inc. All Rights Reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "RegExpGlobalData.h" >+ >+namespace JSC { >+ >+RegExpGlobalData::RegExpGlobalData(VM& vm, JSGlobalObject* globalObject) >+ : m_cachedResult(vm, globalObject, vm.regExpCache()->emptyRegExp()) >+{ >+} >+ >+void RegExpGlobalData::visitAggregate(SlotVisitor& visitor) >+{ >+ m_cachedResult.visitAggregate(visitor); >+} >+ >+JSValue RegExpGlobalData::getBackref(ExecState* exec, JSGlobalObject* owner, unsigned i) >+{ >+ JSArray* array = m_cachedResult.lastResult(exec, owner); >+ >+ if (i < array->length()) { >+ JSValue result = JSValue(array).get(exec, i); >+ ASSERT(result.isString() || result.isUndefined()); >+ if (!result.isUndefined()) >+ return result; >+ } >+ return jsEmptyString(exec); >+} >+ >+JSValue RegExpGlobalData::getLastParen(ExecState* exec, JSGlobalObject* owner) >+{ >+ JSArray* array = m_cachedResult.lastResult(exec, owner); >+ unsigned length = array->length(); >+ if (length > 1) { >+ JSValue result = JSValue(array).get(exec, length - 1); >+ ASSERT(result.isString() || result.isUndefined()); >+ if (!result.isUndefined()) >+ return result; >+ } >+ return jsEmptyString(exec); >+} >+ >+JSValue RegExpGlobalData::getLeftContext(ExecState* exec, JSGlobalObject* owner) >+{ >+ return m_cachedResult.leftContext(exec, owner); >+} >+ >+JSValue RegExpGlobalData::getRightContext(ExecState* exec, JSGlobalObject* owner) >+{ >+ return m_cachedResult.rightContext(exec, owner); >+} >+ >+} // namespace JSC >diff --git a/Source/JavaScriptCore/runtime/RegExpGlobalData.h b/Source/JavaScriptCore/runtime/RegExpGlobalData.h >new file mode 100644 >index 0000000000000000000000000000000000000000..42fc0eff876c728e7efa2710dc2c67060c19eec3 >--- /dev/null >+++ b/Source/JavaScriptCore/runtime/RegExpGlobalData.h >@@ -0,0 +1,60 @@ >+/* >+ * Copyright (C) 2019 Apple Inc. All Rights Reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include "RegExpCachedResult.h" >+ >+namespace JSC { >+ >+class RegExpGlobalData { >+public: >+ RegExpGlobalData(VM&, JSGlobalObject*); >+ >+ RegExpCachedResult& cachedResult() { return m_cachedResult; } >+ >+ void setMultiline(bool multiline) { m_multiline = multiline; } >+ bool multiline() const { return m_multiline; } >+ >+ void setInput(ExecState* exec, JSGlobalObject* owner, JSString* string) { m_cachedResult.setInput(exec, owner, string); } >+ JSString* input() { return m_cachedResult.input(); } >+ >+ >+ void visitAggregate(SlotVisitor&); >+ >+ JSValue getBackref(ExecState*, JSGlobalObject* owner, unsigned); >+ JSValue getLastParen(ExecState*, JSGlobalObject* owner); >+ JSValue getLeftContext(ExecState*, JSGlobalObject* owner); >+ JSValue getRightContext(ExecState*, JSGlobalObject* owner); >+ >+ static ptrdiff_t offsetOfCachedResult() { return OBJECT_OFFSETOF(RegExpGlobalData, m_cachedResult); } >+ >+private: >+ RegExpCachedResult m_cachedResult; >+ bool m_multiline { false }; >+ Vector<int> m_ovector; >+}; >+ >+} >diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp >index 7831679638d3e4b37b5f2bdc599d536604e38bc2..ec16bc8b357538c983fc201827a1691fe0cbda13 100644 >--- a/Source/JavaScriptCore/runtime/RegExpPrototype.cpp >+++ b/Source/JavaScriptCore/runtime/RegExpPrototype.cpp >@@ -83,17 +83,6 @@ void RegExpPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject) > JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->searchSymbol, regExpPrototypeSearchCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); > JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->splitSymbol, regExpPrototypeSplitCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); > JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->test, regExpPrototypeTestCodeGenerator, static_cast<unsigned>(PropertyAttribute::DontEnum)); >- >- m_emptyRegExp.set(vm, this, RegExp::create(vm, "", NoFlags)); >-} >- >-void RegExpPrototype::visitChildren(JSCell* cell, SlotVisitor& visitor) >-{ >- RegExpPrototype* thisObject = jsCast<RegExpPrototype*>(cell); >- ASSERT_GC_OBJECT_INHERITS(thisObject, info()); >- Base::visitChildren(thisObject, visitor); >- >- visitor.append(thisObject->m_emptyRegExp); > } > > // ------------------------------ Functions --------------------------- >diff --git a/Source/JavaScriptCore/runtime/RegExpPrototype.h b/Source/JavaScriptCore/runtime/RegExpPrototype.h >index 5cc84902fb978c2666dbdac691da1a409d6ac99b..7754860f4668e6befdef9a9ae5ae1507edf1f3a7 100644 >--- a/Source/JavaScriptCore/runtime/RegExpPrototype.h >+++ b/Source/JavaScriptCore/runtime/RegExpPrototype.h >@@ -44,17 +44,11 @@ class RegExpPrototype final : public JSNonFinalObject { > return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); > } > >- JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&); >- >- RegExp* emptyRegExp() const { return m_emptyRegExp.get(); } >- > protected: > RegExpPrototype(VM&, Structure*); > > private: > void finishCreation(VM&, JSGlobalObject*); >- >- WriteBarrier<RegExp> m_emptyRegExp; > }; > > EncodedJSValue JSC_HOST_CALL regExpProtoFuncMatchFast(ExecState*); >diff --git a/Source/JavaScriptCore/runtime/VM.cpp b/Source/JavaScriptCore/runtime/VM.cpp >index cb2dc47cddd6429ecfd01e932ef8d9885ff10779..bdd78c978a21d92dab665d58acdb9178f5a4d40a 100644 >--- a/Source/JavaScriptCore/runtime/VM.cpp >+++ b/Source/JavaScriptCore/runtime/VM.cpp >@@ -124,7 +124,6 @@ > #include "PropertyMapHashTable.h" > #include "ProxyRevoke.h" > #include "RegExpCache.h" >-#include "RegExpConstructor.h" > #include "RegExpObject.h" > #include "RegisterAtOffsetList.h" > #include "RuntimeType.h" >@@ -310,7 +309,6 @@ VM::VM(VMType vmType, HeapType heapType) > #endif > , propertyTableSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), PropertyTable) > , proxyRevokeSpace ISO_SUBSPACE_INIT(heap, destructibleObjectHeapCellType.get(), ProxyRevoke) >- , regExpConstructorSpace ISO_SUBSPACE_INIT(heap, destructibleObjectHeapCellType.get(), RegExpConstructor) > , structureRareDataSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), StructureRareData) > , structureSpace ISO_SUBSPACE_INIT(heap, destructibleCellHeapCellType.get(), Structure) > , weakSetSpace ISO_SUBSPACE_INIT(heap, destructibleObjectHeapCellType.get(), JSWeakSet) >diff --git a/Source/JavaScriptCore/runtime/VM.h b/Source/JavaScriptCore/runtime/VM.h >index 3f4accf358bf8cae99aaecdf6d9da105c1c4cd33..621a37b10df51576e16d36bcccc01efbaff7aa9f 100644 >--- a/Source/JavaScriptCore/runtime/VM.h >+++ b/Source/JavaScriptCore/runtime/VM.h >@@ -129,6 +129,7 @@ class JSWebAssemblyInstance; > class LLIntOffsetsExtractor; > class NativeExecutable; > class PromiseDeferredTimer; >+class RegExp; > class RegExpCache; > class Register; > class RegisterAtOffsetList; >@@ -385,7 +386,6 @@ class VM : public ThreadSafeRefCounted<VM>, public DoublyLinkedListNode<VM> { > #endif > IsoSubspace propertyTableSpace; > IsoSubspace proxyRevokeSpace; >- IsoSubspace regExpConstructorSpace; > IsoSubspace structureRareDataSpace; > IsoSubspace structureSpace; > IsoSubspace weakSetSpace;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193801
:
360231
|
360280
|
360282
|
360283
|
360295
|
360299
|
360301