summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptCore/runtime')
-rw-r--r--JavaScriptCore/runtime/Collector.cpp2
-rw-r--r--JavaScriptCore/runtime/Executable.cpp80
-rw-r--r--JavaScriptCore/runtime/Executable.h8
-rw-r--r--JavaScriptCore/runtime/Identifier.cpp4
-rw-r--r--JavaScriptCore/runtime/JSActivation.cpp10
-rw-r--r--JavaScriptCore/runtime/JSFunction.cpp2
-rw-r--r--JavaScriptCore/runtime/JSGlobalData.cpp1
-rw-r--r--JavaScriptCore/runtime/JSGlobalData.h4
-rw-r--r--JavaScriptCore/runtime/JSGlobalObject.h7
-rw-r--r--JavaScriptCore/runtime/MarkStack.h5
-rw-r--r--JavaScriptCore/runtime/MarkStackNone.cpp49
-rw-r--r--JavaScriptCore/runtime/MarkStackPosix.cpp9
-rw-r--r--JavaScriptCore/runtime/MarkStackSymbian.cpp10
-rw-r--r--JavaScriptCore/runtime/MarkStackWin.cpp11
-rw-r--r--JavaScriptCore/runtime/RegExp.cpp99
-rw-r--r--JavaScriptCore/runtime/Structure.cpp1
-rw-r--r--JavaScriptCore/runtime/UString.h2
17 files changed, 27 insertions, 277 deletions
diff --git a/JavaScriptCore/runtime/Collector.cpp b/JavaScriptCore/runtime/Collector.cpp
index f341646..3fbd278 100644
--- a/JavaScriptCore/runtime/Collector.cpp
+++ b/JavaScriptCore/runtime/Collector.cpp
@@ -1051,8 +1051,6 @@ void Heap::markRoots()
MarkedArgumentBuffer::markLists(markStack, *m_markListSet);
if (m_globalData->exception)
markStack.append(m_globalData->exception);
- if (m_globalData->functionCodeBlockBeingReparsed)
- m_globalData->functionCodeBlockBeingReparsed->markAggregate(markStack);
if (m_globalData->firstStringifierToMark)
JSONObject::markStringifiers(markStack, m_globalData->firstStringifierToMark);
diff --git a/JavaScriptCore/runtime/Executable.cpp b/JavaScriptCore/runtime/Executable.cpp
index 2ad4b2d..f229f96 100644
--- a/JavaScriptCore/runtime/Executable.cpp
+++ b/JavaScriptCore/runtime/Executable.cpp
@@ -108,7 +108,7 @@ JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scope
ASSERT(!m_evalCodeBlock);
m_evalCodeBlock = adoptPtr(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth()));
- OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), globalObject->debugger(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock.get())));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock.get())));
generator->generate();
evalNode->destroyData();
@@ -156,7 +156,7 @@ JSObject* ProgramExecutable::compileInternal(ExecState* exec, ScopeChainNode* sc
JSGlobalObject* globalObject = scopeChain.globalObject();
m_programCodeBlock = adoptPtr(new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider()));
- OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(programNode.get(), globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock.get())));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(programNode.get(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock.get())));
generator->generate();
programNode->destroyData();
@@ -193,7 +193,7 @@ JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, ScopeChain
ASSERT(!m_codeBlockForCall);
m_codeBlockForCall = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), false));
- OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForCall->symbolTable(), m_codeBlockForCall.get())));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), scopeChain, m_codeBlockForCall->symbolTable(), m_codeBlockForCall.get())));
generator->generate();
m_numParametersForCall = m_codeBlockForCall->m_numParameters;
ASSERT(m_numParametersForCall);
@@ -234,7 +234,7 @@ JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, Scope
ASSERT(!m_codeBlockForConstruct);
m_codeBlockForConstruct = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), true));
- OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct.get())));
+ OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), scopeChain, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct.get())));
generator->generate();
m_numParametersForConstruct = m_codeBlockForConstruct->m_numParameters;
ASSERT(m_numParametersForConstruct);
@@ -264,72 +264,6 @@ void FunctionExecutable::markAggregate(MarkStack& markStack)
m_codeBlockForConstruct->markAggregate(markStack);
}
-PassOwnPtr<ExceptionInfo> FunctionExecutable::reparseExceptionInfo(ScopeChainNode* scopeChainNode, CodeBlock* codeBlock)
-{
- JSObject* exception = 0;
- JSGlobalData* globalData = scopeChainNode->globalData;
- RefPtr<FunctionBodyNode> newFunctionBody = globalData->parser->parse<FunctionBodyNode>(scopeChainNode->globalObject, 0, 0, m_source, m_parameters.get(), isStrictMode() ? JSParseStrict : JSParseNormal, &exception);
- if (!newFunctionBody)
- return PassOwnPtr<ExceptionInfo>();
- ASSERT(newFunctionBody->isStrictMode() == isStrictMode());
- if (m_forceUsesArguments)
- newFunctionBody->setUsesArguments();
- newFunctionBody->finishParsing(m_parameters, m_name);
-
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- OwnPtr<CodeBlock> newCodeBlock(adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), codeBlock->m_isConstructor)));
- globalData->functionCodeBlockBeingReparsed = newCodeBlock.get();
-
- OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(newFunctionBody.get(), globalObject->debugger(), scopeChain, newCodeBlock->symbolTable(), newCodeBlock.get())));
- generator->setRegeneratingForExceptionInfo(static_cast<FunctionCodeBlock*>(codeBlock));
- generator->generate();
-
- ASSERT(newCodeBlock->instructionCount() == codeBlock->instructionCount());
-
-#if ENABLE(JIT)
- if (globalData->canUseJIT()) {
- JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get(), 0, codeBlock->m_isConstructor ? generatedJITCodeForConstruct().start() : generatedJITCodeForCall().start());
- ASSERT(codeBlock->m_isConstructor ? newJITCode.size() == generatedJITCodeForConstruct().size() : newJITCode.size() == generatedJITCodeForCall().size());
- }
-#endif
-
- globalData->functionCodeBlockBeingReparsed = 0;
-
- return newCodeBlock->extractExceptionInfo();
-}
-
-PassOwnPtr<ExceptionInfo> EvalExecutable::reparseExceptionInfo(ScopeChainNode* scopeChainNode, CodeBlock* codeBlock)
-{
- JSObject* exception = 0;
- JSGlobalData* globalData = scopeChainNode->globalData;
- RefPtr<EvalNode> newEvalBody = globalData->parser->parse<EvalNode>(scopeChainNode->globalObject, 0, 0, m_source, 0, isStrictMode() ? JSParseStrict : JSParseNormal, &exception);
- ASSERT(newEvalBody->isStrictMode() == isStrictMode());
- if (!newEvalBody)
- return PassOwnPtr<ExceptionInfo>();
-
- ScopeChain scopeChain(scopeChainNode);
- JSGlobalObject* globalObject = scopeChain.globalObject();
-
- OwnPtr<EvalCodeBlock> newCodeBlock(adoptPtr(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth())));
-
- OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(newEvalBody.get(), globalObject->debugger(), scopeChain, newCodeBlock->symbolTable(), newCodeBlock.get())));
- generator->setRegeneratingForExceptionInfo(static_cast<EvalCodeBlock*>(codeBlock));
- generator->generate();
-
- ASSERT(newCodeBlock->instructionCount() == codeBlock->instructionCount());
-
-#if ENABLE(JIT)
- if (globalData->canUseJIT()) {
- JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get(), 0, generatedJITCodeForCall().start());
- ASSERT(newJITCode.size() == generatedJITCodeForCall().size());
- }
-#endif
-
- return newCodeBlock->extractExceptionInfo();
-}
-
void FunctionExecutable::recompile(ExecState*)
{
m_codeBlockForCall.clear();
@@ -376,10 +310,4 @@ UString FunctionExecutable::paramString() const
return builder.toUString();
}
-PassOwnPtr<ExceptionInfo> ProgramExecutable::reparseExceptionInfo(ScopeChainNode*, CodeBlock*)
-{
- // CodeBlocks for program code are transient and therefore do not gain from from throwing out their exception information.
- return PassOwnPtr<ExceptionInfo>();
-}
-
}
diff --git a/JavaScriptCore/runtime/Executable.h b/JavaScriptCore/runtime/Executable.h
index 4c4ca56..14ed927 100644
--- a/JavaScriptCore/runtime/Executable.h
+++ b/JavaScriptCore/runtime/Executable.h
@@ -177,8 +177,6 @@ namespace JSC {
bool needsActivation() const { return m_hasCapturedVariables || m_features & (EvalFeature | WithFeature | CatchFeature); }
bool isStrictMode() const { return m_features & StrictModeFeature; }
- virtual PassOwnPtr<ExceptionInfo> reparseExceptionInfo(ScopeChainNode*, CodeBlock*) = 0;
-
protected:
void recordParse(CodeFeatures features, bool hasCapturedVariables, int firstLine, int lastLine)
{
@@ -229,8 +227,6 @@ namespace JSC {
JSObject* compileInternal(ExecState*, ScopeChainNode*);
- virtual PassOwnPtr<ExceptionInfo> reparseExceptionInfo(ScopeChainNode*, CodeBlock*);
-
OwnPtr<EvalCodeBlock> m_evalCodeBlock;
};
@@ -272,8 +268,6 @@ namespace JSC {
JSObject* compileInternal(ExecState*, ScopeChainNode*);
- virtual PassOwnPtr<ExceptionInfo> reparseExceptionInfo(ScopeChainNode*, CodeBlock*);
-
OwnPtr<ProgramCodeBlock> m_programCodeBlock;
};
@@ -365,8 +359,6 @@ namespace JSC {
JSObject* compileForCallInternal(ExecState*, ScopeChainNode*);
JSObject* compileForConstructInternal(ExecState*, ScopeChainNode*);
- virtual PassOwnPtr<ExceptionInfo> reparseExceptionInfo(ScopeChainNode*, CodeBlock*);
-
unsigned m_numCapturedVariables : 31;
bool m_forceUsesArguments : 1;
diff --git a/JavaScriptCore/runtime/Identifier.cpp b/JavaScriptCore/runtime/Identifier.cpp
index d4069ba..28cfd0a 100644
--- a/JavaScriptCore/runtime/Identifier.cpp
+++ b/JavaScriptCore/runtime/Identifier.cpp
@@ -89,7 +89,7 @@ bool Identifier::equal(const StringImpl* r, const UChar* s, unsigned length)
struct IdentifierCStringTranslator {
static unsigned hash(const char* c)
{
- return StringImpl::computeHash(c);
+ return WTF::StringHasher::createHash<char>(c);
}
static bool equal(StringImpl* r, const char* s)
@@ -149,7 +149,7 @@ struct UCharBuffer {
struct IdentifierUCharBufferTranslator {
static unsigned hash(const UCharBuffer& buf)
{
- return StringImpl::computeHash(buf.s, buf.length);
+ return WTF::StringHasher::createHash<UChar>(buf.s, buf.length);
}
static bool equal(StringImpl* str, const UCharBuffer& buf)
diff --git a/JavaScriptCore/runtime/JSActivation.cpp b/JavaScriptCore/runtime/JSActivation.cpp
index 795ad1f..1147858 100644
--- a/JavaScriptCore/runtime/JSActivation.cpp
+++ b/JavaScriptCore/runtime/JSActivation.cpp
@@ -202,14 +202,14 @@ JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, const Identi
JSActivation* activation = asActivation(slotBase);
CallFrame* callFrame = CallFrame::create(activation->d()->registers);
int argumentsRegister = activation->d()->functionExecutable->generatedBytecode().argumentsRegister();
- if (!callFrame->r(argumentsRegister).jsValue()) {
+ if (!callFrame->uncheckedR(argumentsRegister).jsValue()) {
JSValue arguments = JSValue(new (callFrame) Arguments(callFrame));
- callFrame->r(argumentsRegister) = arguments;
- callFrame->r(unmodifiedArgumentsRegister(argumentsRegister)) = arguments;
+ callFrame->uncheckedR(argumentsRegister) = arguments;
+ callFrame->uncheckedR(unmodifiedArgumentsRegister(argumentsRegister)) = arguments;
}
- ASSERT(callFrame->r(argumentsRegister).jsValue().inherits(&Arguments::info));
- return callFrame->r(argumentsRegister).jsValue();
+ ASSERT(callFrame->uncheckedR(argumentsRegister).jsValue().inherits(&Arguments::info));
+ return callFrame->uncheckedR(argumentsRegister).jsValue();
}
// These two functions serve the purpose of isolating the common case from a
diff --git a/JavaScriptCore/runtime/JSFunction.cpp b/JavaScriptCore/runtime/JSFunction.cpp
index ba89d04..99f8e6f 100644
--- a/JavaScriptCore/runtime/JSFunction.cpp
+++ b/JavaScriptCore/runtime/JSFunction.cpp
@@ -208,7 +208,7 @@ bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyN
if (!location) {
JSObject* prototype = new (exec) JSObject(scope().globalObject()->emptyObjectStructure());
prototype->putDirect(exec->propertyNames().constructor, this, DontEnum);
- putDirect(exec->propertyNames().prototype, prototype, DontDelete);
+ putDirect(exec->propertyNames().prototype, prototype, DontDelete | DontEnum);
location = getDirectLocation(propertyName);
}
diff --git a/JavaScriptCore/runtime/JSGlobalData.cpp b/JavaScriptCore/runtime/JSGlobalData.cpp
index 58b844c..9948877 100644
--- a/JavaScriptCore/runtime/JSGlobalData.cpp
+++ b/JavaScriptCore/runtime/JSGlobalData.cpp
@@ -141,7 +141,6 @@ JSGlobalData::JSGlobalData(GlobalDataType globalDataType, ThreadStackType thread
, heap(this)
, head(0)
, dynamicGlobalObject(0)
- , functionCodeBlockBeingReparsed(0)
, firstStringifierToMark(0)
, markStack(jsArrayVPtr)
, cachedUTCOffset(NaN)
diff --git a/JavaScriptCore/runtime/JSGlobalData.h b/JavaScriptCore/runtime/JSGlobalData.h
index 153a4e5..1819a0c 100644
--- a/JavaScriptCore/runtime/JSGlobalData.h
+++ b/JavaScriptCore/runtime/JSGlobalData.h
@@ -116,6 +116,7 @@ namespace JSC {
};
bool isSharedInstance() { return globalDataType == APIShared; }
+ bool usingAPI() { return globalDataType != Default; }
static bool sharedInstanceExists();
static JSGlobalData& sharedInstance();
@@ -205,7 +206,6 @@ namespace JSC {
HashSet<JSObject*> arrayVisitedElements;
- CodeBlock* functionCodeBlockBeingReparsed;
Stringifier* firstStringifierToMark;
MarkStack markStack;
@@ -220,9 +220,7 @@ namespace JSC {
RegExpCache* m_regExpCache;
-#if ENABLE(YARR)
BumpPointerAllocator m_regexAllocator;
-#endif
#if ENABLE(REGEXP_TRACING)
typedef ListHashSet<RefPtr<RegExp> > RTTraceList;
diff --git a/JavaScriptCore/runtime/JSGlobalObject.h b/JavaScriptCore/runtime/JSGlobalObject.h
index 93a1b88..714999f 100644
--- a/JavaScriptCore/runtime/JSGlobalObject.h
+++ b/JavaScriptCore/runtime/JSGlobalObject.h
@@ -254,9 +254,10 @@ namespace JSC {
Debugger* debugger() const { return d()->debugger; }
void setDebugger(Debugger* debugger) { d()->debugger = debugger; }
-
+
virtual bool supportsProfiling() const { return false; }
-
+ virtual bool supportsRichSourceInfo() const { return true; }
+
ScopeChain& globalScopeChain() { return d()->globalScopeChain; }
virtual bool isGlobalObject() const { return true; }
@@ -276,7 +277,7 @@ namespace JSC {
void resetPrototype(JSValue prototype);
- JSGlobalData& globalData() { return *d()->globalData.get(); }
+ JSGlobalData& globalData() const { return *d()->globalData.get(); }
JSGlobalObjectData* d() const { return static_cast<JSGlobalObjectData*>(JSVariableObject::d); }
static PassRefPtr<Structure> createStructure(JSValue prototype)
diff --git a/JavaScriptCore/runtime/MarkStack.h b/JavaScriptCore/runtime/MarkStack.h
index c551bac..c3efc8f 100644
--- a/JavaScriptCore/runtime/MarkStack.h
+++ b/JavaScriptCore/runtime/MarkStack.h
@@ -28,6 +28,7 @@
#include "JSValue.h"
#include <wtf/Noncopyable.h>
+#include <wtf/OSAllocator.h>
namespace JSC {
@@ -85,8 +86,8 @@ namespace JSC {
MarkSetProperties m_properties;
};
- static void* allocateStack(size_t size);
- static void releaseStack(void* addr, size_t size);
+ static void* allocateStack(size_t size) { return OSAllocator::reserveAndCommit(size); }
+ static void releaseStack(void* addr, size_t size) { OSAllocator::release(addr, size); }
static void initializePagesize();
static size_t pageSize()
diff --git a/JavaScriptCore/runtime/MarkStackNone.cpp b/JavaScriptCore/runtime/MarkStackNone.cpp
deleted file mode 100644
index b1ff48b..0000000
--- a/JavaScriptCore/runtime/MarkStackNone.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2009 Company 100, 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 "MarkStack.h"
-
-#include "FastMalloc.h"
-
-namespace JSC {
-
-void MarkStack::initializePagesize()
-{
- MarkStack::s_pageSize = 4096;
-}
-
-void* MarkStack::allocateStack(size_t size)
-{
- return fastMalloc(size);
-}
-
-void MarkStack::releaseStack(void* addr, size_t)
-{
- return fastFree(addr);
-}
-
-}
diff --git a/JavaScriptCore/runtime/MarkStackPosix.cpp b/JavaScriptCore/runtime/MarkStackPosix.cpp
index c28bc0d..2a5b298 100644
--- a/JavaScriptCore/runtime/MarkStackPosix.cpp
+++ b/JavaScriptCore/runtime/MarkStackPosix.cpp
@@ -38,15 +38,6 @@ void MarkStack::initializePagesize()
MarkStack::s_pageSize = getpagesize();
}
-void* MarkStack::allocateStack(size_t size)
-{
- return mmap(0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
-}
-void MarkStack::releaseStack(void* addr, size_t size)
-{
- munmap(addr, size);
-}
-
}
#endif
diff --git a/JavaScriptCore/runtime/MarkStackSymbian.cpp b/JavaScriptCore/runtime/MarkStackSymbian.cpp
index bda14ac..a3893d7 100644
--- a/JavaScriptCore/runtime/MarkStackSymbian.cpp
+++ b/JavaScriptCore/runtime/MarkStackSymbian.cpp
@@ -33,16 +33,6 @@ void MarkStack::initializePagesize()
MarkStack::s_pageSize = page_size;
}
-void* MarkStack::allocateStack(size_t size)
-{
- return fastMalloc(size);
-}
-
-void MarkStack::releaseStack(void* addr, size_t size)
-{
- return fastFree(addr);
-}
-
}
#endif
diff --git a/JavaScriptCore/runtime/MarkStackWin.cpp b/JavaScriptCore/runtime/MarkStackWin.cpp
index a171c78..2d2a1b3 100644
--- a/JavaScriptCore/runtime/MarkStackWin.cpp
+++ b/JavaScriptCore/runtime/MarkStackWin.cpp
@@ -39,17 +39,6 @@ void MarkStack::initializePagesize()
MarkStack::s_pageSize = system_info.dwPageSize;
}
-void* MarkStack::allocateStack(size_t size)
-{
- return VirtualAlloc(0, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
-}
-void MarkStack::releaseStack(void* addr, size_t)
-{
- // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
- // dwSize must be 0 if dwFreeType is MEM_RELEASE.
- VirtualFree(addr, 0, MEM_RELEASE);
-}
-
}
#endif
diff --git a/JavaScriptCore/runtime/RegExp.cpp b/JavaScriptCore/runtime/RegExp.cpp
index 3ebfe0f..a33fa91 100644
--- a/JavaScriptCore/runtime/RegExp.cpp
+++ b/JavaScriptCore/runtime/RegExp.cpp
@@ -28,9 +28,6 @@
#include <wtf/Assertions.h>
#include <wtf/OwnArrayPtr.h>
-
-#if ENABLE(YARR)
-
#include "yarr/RegexCompiler.h"
#if ENABLE(YARR_JIT)
#include "yarr/RegexJIT.h"
@@ -38,28 +35,13 @@
#include "yarr/RegexInterpreter.h"
#endif
-#else
-
-#include <pcre/pcre.h>
-
-#endif
-
namespace JSC {
struct RegExpRepresentation {
#if ENABLE(YARR_JIT)
Yarr::RegexCodeBlock m_regExpJITCode;
-#elif ENABLE(YARR)
- OwnPtr<Yarr::BytecodePattern> m_regExpBytecode;
#else
- JSRegExp* m_regExp;
-#endif
-
-#if !ENABLE(YARR)
- ~RegExpRepresentation()
- {
- jsRegExpFree(m_regExp);
- }
+ OwnPtr<Yarr::BytecodePattern> m_regExpBytecode;
#endif
};
@@ -100,12 +82,10 @@ PassRefPtr<RegExp> RegExp::create(JSGlobalData* globalData, const UString& patte
return res.release();
}
-#if ENABLE(YARR)
-
void RegExp::compile(JSGlobalData* globalData)
{
#if ENABLE(YARR_JIT)
- Yarr::jitCompileRegex(globalData, m_representation->m_regExpJITCode, m_pattern, m_numSubpatterns, m_constructionError, ignoreCase(), multiline());
+ Yarr::jitCompileRegex(globalData, m_representation->m_regExpJITCode, m_pattern, m_numSubpatterns, m_constructionError, &globalData->m_regexAllocator, ignoreCase(), multiline());
#else
m_representation->m_regExpBytecode = Yarr::byteCompileRegex(m_pattern, m_numSubpatterns, m_constructionError, &globalData->m_regexAllocator, ignoreCase(), multiline());
#endif
@@ -128,7 +108,7 @@ int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
#else
if (m_representation->m_regExpBytecode) {
#endif
- int offsetVectorSize = (m_numSubpatterns + 1) * 3; // FIXME: should be 2 - but adding temporary fallback to pcre.
+ int offsetVectorSize = (m_numSubpatterns + 1) * 2;
int* offsetVector;
Vector<int, 32> nonReturnedOvector;
if (ovector) {
@@ -147,18 +127,12 @@ int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
offsetVector[j] = -1;
#if ENABLE(YARR_JIT)
- int result = Yarr::executeRegex(m_representation->m_regExpJITCode, s.characters(), startOffset, s.length(), offsetVector, offsetVectorSize);
+ int result = Yarr::executeRegex(m_representation->m_regExpJITCode, s.characters(), startOffset, s.length(), offsetVector);
#else
int result = Yarr::interpretRegex(m_representation->m_regExpBytecode.get(), s.characters(), startOffset, s.length(), offsetVector);
#endif
- if (result < 0) {
-#ifndef NDEBUG
- // TODO: define up a symbol, rather than magic -1
- if (result != -1)
- fprintf(stderr, "jsRegExpExecute failed with result %d\n", result);
-#endif
- }
+ ASSERT(result >= -1);;
#if ENABLE(REGEXP_TRACING)
if (result != -1)
@@ -171,69 +145,6 @@ int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
return -1;
}
-#else
-
-void RegExp::compile(JSGlobalData*)
-{
- m_representation->m_regExp = 0;
- JSRegExpIgnoreCaseOption ignoreCaseOption = ignoreCase() ? JSRegExpIgnoreCase : JSRegExpDoNotIgnoreCase;
- JSRegExpMultilineOption multilineOption = multiline() ? JSRegExpMultiline : JSRegExpSingleLine;
- m_representation->m_regExp = jsRegExpCompile(reinterpret_cast<const UChar*>(m_pattern.characters()), m_pattern.length(), ignoreCaseOption, multilineOption, &m_numSubpatterns, &m_constructionError);
-}
-
-int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
-{
-#if ENABLE(REGEXP_TRACING)
- m_rtMatchCallCount++;
-#endif
-
- if (startOffset < 0)
- startOffset = 0;
- if (ovector)
- ovector->clear();
-
- if (static_cast<unsigned>(startOffset) > s.length() || s.isNull())
- return -1;
-
- if (m_representation->m_regExp) {
- // Set up the offset vector for the result.
- // First 2/3 used for result, the last third used by PCRE.
- int* offsetVector;
- int offsetVectorSize;
- int fixedSizeOffsetVector[3];
- if (!ovector) {
- offsetVectorSize = 3;
- offsetVector = fixedSizeOffsetVector;
- } else {
- offsetVectorSize = (m_numSubpatterns + 1) * 3;
- ovector->resize(offsetVectorSize);
- offsetVector = ovector->data();
- }
-
- int numMatches = jsRegExpExecute(m_representation->m_regExp, reinterpret_cast<const UChar*>(s.characters()), s.length(), startOffset, offsetVector, offsetVectorSize);
-
- if (numMatches < 0) {
-#ifndef NDEBUG
- if (numMatches != JSRegExpErrorNoMatch)
- fprintf(stderr, "jsRegExpExecute failed with result %d\n", numMatches);
-#endif
- if (ovector)
- ovector->clear();
- return -1;
- }
-
-#if ENABLE(REGEXP_TRACING)
- m_rtMatchFoundCount++;
-#endif
-
- return offsetVector[0];
- }
-
- return -1;
-}
-
-#endif
-
#if ENABLE(REGEXP_TRACING)
void RegExp::printTraceData()
{
diff --git a/JavaScriptCore/runtime/Structure.cpp b/JavaScriptCore/runtime/Structure.cpp
index d06a239..0179eed 100644
--- a/JavaScriptCore/runtime/Structure.cpp
+++ b/JavaScriptCore/runtime/Structure.cpp
@@ -233,6 +233,7 @@ Structure::Structure(JSValue prototype, const TypeInfo& typeInfo, unsigned anony
, m_dictionaryKind(NoneDictionaryKind)
, m_isPinnedPropertyTable(false)
, m_hasGetterSetterProperties(false)
+ , m_hasNonEnumerableProperties(false)
, m_attributesInPrevious(0)
, m_specificFunctionThrashCount(0)
, m_anonymousSlotCount(anonymousSlotCount)
diff --git a/JavaScriptCore/runtime/UString.h b/JavaScriptCore/runtime/UString.h
index cd73c28..8f6c083 100644
--- a/JavaScriptCore/runtime/UString.h
+++ b/JavaScriptCore/runtime/UString.h
@@ -202,7 +202,7 @@ struct UStringHash {
// FIXME: perhaps we should have a more abstract macro that indicates when
// going 4 bytes at a time is unsafe
-#if CPU(ARM) || CPU(SH4)
+#if CPU(ARM) || CPU(SH4) || CPU(MIPS)
const UChar* aChars = a->characters();
const UChar* bChars = b->characters();
for (unsigned i = 0; i != aLength; ++i) {