Changeset 39083 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Dec 7, 2008, 3:55:04 PM (16 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSGlobalData.h
r38622 r39083 34 34 #include <wtf/RefCounted.h> 35 35 #include "Collector.h" 36 #include "ExecutableAllocator.h" 36 37 #include "SmallStrings.h" 37 38 … … 121 122 Heap heap; 122 123 124 PassRefPtr<ExecutablePool> poolForSize(size_t n) { return m_executableAllocator.poolForSize(n); } 123 125 private: 124 126 JSGlobalData(bool isShared = false); 127 ExecutableAllocator m_executableAllocator; 125 128 126 129 static JSGlobalData*& sharedInstanceInternal(); -
trunk/JavaScriptCore/runtime/RegExp.cpp
r38975 r39083 38 38 #endif 39 39 40 inline RegExp::RegExp( const UString& pattern)40 inline RegExp::RegExp(JSGlobalData* globalData, const UString& pattern) 41 41 : m_pattern(pattern) 42 42 , m_flagBits(0) … … 46 46 { 47 47 #if ENABLE(WREC) 48 m_wrecFunction = Generator::compileRegExp( pattern, &m_numSubpatterns, &m_constructionError);48 m_wrecFunction = Generator::compileRegExp(globalData, pattern, &m_numSubpatterns, &m_constructionError, m_executablePool); 49 49 if (m_wrecFunction) 50 50 return; … … 55 55 } 56 56 57 PassRefPtr<RegExp> RegExp::create( const UString& pattern)57 PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& pattern) 58 58 { 59 return adoptRef(new RegExp( pattern));59 return adoptRef(new RegExp(globalData, pattern)); 60 60 } 61 61 62 inline RegExp::RegExp( const UString& pattern, const UString& flags)62 inline RegExp::RegExp(JSGlobalData* globalData, const UString& pattern, const UString& flags) 63 63 : m_pattern(pattern) 64 64 , m_flags(flags) … … 87 87 88 88 #if ENABLE(WREC) 89 m_wrecFunction = Generator::compileRegExp( pattern, &m_numSubpatterns, &m_constructionError, (m_flagBits & IgnoreCase), (m_flagBits & Multiline));89 m_wrecFunction = Generator::compileRegExp(globalData, pattern, &m_numSubpatterns, &m_constructionError, m_executablePool, (m_flagBits & IgnoreCase), (m_flagBits & Multiline)); 90 90 if (m_wrecFunction) 91 91 return; … … 96 96 } 97 97 98 PassRefPtr<RegExp> RegExp::create( const UString& pattern, const UString& flags)98 PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& pattern, const UString& flags) 99 99 { 100 return adoptRef(new RegExp( pattern, flags));100 return adoptRef(new RegExp(globalData, pattern, flags)); 101 101 } 102 102 … … 104 104 { 105 105 jsRegExpFree(m_regExp); 106 #if ENABLE(WREC)107 if (m_wrecFunction)108 WTF::fastFreeExecutable(reinterpret_cast<void*>(m_wrecFunction));109 #endif110 106 } 111 107 -
trunk/JavaScriptCore/runtime/RegExp.h
r38975 r39083 24 24 #include "UString.h" 25 25 #include "WREC.h" 26 #include "ExecutableAllocator.h" 26 27 #include <wtf/Forward.h> 27 28 #include <wtf/RefCounted.h> … … 35 36 class RegExp : public RefCounted<RegExp> { 36 37 public: 37 static PassRefPtr<RegExp> create( const UString& pattern);38 static PassRefPtr<RegExp> create( const UString& pattern, const UString& flags);38 static PassRefPtr<RegExp> create(JSGlobalData* globalData, const UString& pattern); 39 static PassRefPtr<RegExp> create(JSGlobalData* globalData, const UString& pattern, const UString& flags); 39 40 ~RegExp(); 40 41 … … 53 54 54 55 private: 55 RegExp( const UString& pattern);56 RegExp( const UString& pattern, const UString& flags);56 RegExp(JSGlobalData* globalData, const UString& pattern); 57 RegExp(JSGlobalData* globalData, const UString& pattern, const UString& flags); 57 58 58 59 void compile(); … … 69 70 #if ENABLE(WREC) 70 71 WREC::CompiledRegExp m_wrecFunction; 72 RefPtr<ExecutablePool> m_executablePool; 71 73 #endif 72 74 }; -
trunk/JavaScriptCore/runtime/RegExpConstructor.cpp
r38975 r39083 332 332 UString flags = arg1->isUndefined() ? UString("") : arg1->toString(exec); 333 333 334 RefPtr<RegExp> regExp = RegExp::create( pattern, flags);334 RefPtr<RegExp> regExp = RegExp::create(&exec->globalData(), pattern, flags); 335 335 if (!regExp->isValid()) 336 336 return throwError(exec, SyntaxError, UString("Invalid regular expression: ").append(regExp->errorMessage())); -
trunk/JavaScriptCore/runtime/RegExpPrototype.cpp
r38975 r39083 86 86 UString pattern = args.isEmpty() ? UString("") : arg0->toString(exec); 87 87 UString flags = arg1->isUndefined() ? UString("") : arg1->toString(exec); 88 regExp = RegExp::create( pattern, flags);88 regExp = RegExp::create(&exec->globalData(), pattern, flags); 89 89 } 90 90 -
trunk/JavaScriptCore/runtime/StringPrototype.cpp
r38975 r39083 413 413 * replaced with the result of the expression new RegExp(regexp). 414 414 */ 415 reg = RegExp::create( a0->toString(exec));415 reg = RegExp::create(&exec->globalData(), a0->toString(exec)); 416 416 } 417 417 RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor(); … … 463 463 * replaced with the result of the expression new RegExp(regexp). 464 464 */ 465 reg = RegExp::create( a0->toString(exec));465 reg = RegExp::create(&exec->globalData(), a0->toString(exec)); 466 466 } 467 467 RegExpConstructor* regExpConstructor = exec->lexicalGlobalObject()->regExpConstructor();
Note:
See TracChangeset
for help on using the changeset viewer.