summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/runtime/RegExpConstructor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/runtime/RegExpConstructor.cpp')
-rw-r--r--JavaScriptCore/runtime/RegExpConstructor.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/JavaScriptCore/runtime/RegExpConstructor.cpp b/JavaScriptCore/runtime/RegExpConstructor.cpp
index 24476d6..166a021 100644
--- a/JavaScriptCore/runtime/RegExpConstructor.cpp
+++ b/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -34,6 +34,7 @@
#include "RegExpObject.h"
#include "RegExpPrototype.h"
#include "RegExp.h"
+#include "RegExpCache.h"
namespace JSC {
@@ -302,7 +303,7 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args)
UString pattern = arg0.isUndefined() ? UString("") : arg0.toString(exec);
UString flags = arg1.isUndefined() ? UString("") : arg1.toString(exec);
- RefPtr<RegExp> regExp = RegExp::create(&exec->globalData(), pattern, flags);
+ RefPtr<RegExp> regExp = exec->globalData().regExpCache()->lookupOrCreate(pattern, flags);
if (!regExp->isValid())
return throwError(exec, createSyntaxError(exec, makeString("Invalid regular expression: ", regExp->errorMessage())));
return new (exec) RegExpObject(exec->lexicalGlobalObject(), exec->lexicalGlobalObject()->regExpStructure(), regExp.release());