Commit d8085775 authored by darin@apple.com's avatar darin@apple.com

JavaScriptCore:

2009-05-13  Darin Adler  <darin@apple.com>

        Revert the parser arena change. It was a slowdown, not a speedup.
        Better luck next time (I'll break it up into pieces).

WebCore:

2009-05-13  Darin Adler  <darin@apple.com>

        Revert the parser arena change. It was a slowdown, not a speedup.
        Better luck next time (I'll break it up into pieces).

WebKit/mac:

2009-05-13  Darin Adler  <darin@apple.com>

        Revert the parser arena change. It was a slowdown, not a speedup.
        Better luck next time (I'll break it up into pieces).



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43661 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a71ec66e
2009-05-13 Darin Adler <darin@apple.com>
Revert the parser arena change. It was a slowdown, not a speedup.
Better luck next time (I'll break it up into pieces).
2009-05-13 Darin Adler <darin@apple.com>
Tiger build fix.
......@@ -149,6 +149,7 @@ __ZN3JSC15JSWrapperObject4markEv
__ZN3JSC15toInt32SlowCaseEdRb
__ZN3JSC16FunctionBodyNode13finishParsingEPNS_10IdentifierEm
__ZN3JSC16FunctionBodyNode14copyParametersEv
__ZN3JSC16FunctionBodyNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm0EEEPNS6_IPNS_12FuncDeclNodeELm0EEERKNS_10SourceCodeEji
__ZN3JSC16InternalFunction4infoE
__ZN3JSC16InternalFunction4nameEPNS_12JSGlobalDataE
__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEN3WTF10PassRefPtrINS_9StructureEEERKNS_10IdentifierE
......@@ -227,7 +228,6 @@ __ZN3JSC7UString6appendERKS0_
__ZN3JSC7UStringC1EPKc
__ZN3JSC7UStringC1EPKti
__ZN3JSC7UStringaSEPKc
__ZN3JSC8Debugger23recompileAllJSFunctionsEPNS_12JSGlobalDataEb
__ZN3JSC8Debugger6attachEPNS_14JSGlobalObjectE
__ZN3JSC8Debugger6detachEPNS_14JSGlobalObjectE
__ZN3JSC8DebuggerC2Ev
......@@ -302,7 +302,6 @@ __ZN3WTF21RefCountedLeakCounter9incrementEv
__ZN3WTF21RefCountedLeakCounterC1EPKc
__ZN3WTF21RefCountedLeakCounterD1Ev
__ZN3WTF23waitForThreadCompletionENS_16ThreadIdentifierEPPv
__ZN3WTF23waitForThreadCompletionEjPPv
__ZN3WTF27releaseFastMallocFreeMemoryEv
__ZN3WTF28setMainThreadCallbacksPausedEb
__ZN3WTF36lockAtomicallyInitializedStaticMutexEv
......@@ -363,9 +362,9 @@ __ZNK3JSC8JSObject9classNameEv
__ZNK3JSC8JSObject9toBooleanEPNS_9ExecStateE
__ZNK3JSC9HashTable11createTableEPNS_12JSGlobalDataE
__ZNK3JSC9HashTable11deleteTableEv
__ZNK3WTF8Collator7collateEPKtmS2_m
__ZNK3WTF16ThreadIdentifiereqERKS0_
__ZNK3WTF16ThreadIdentifierneERKS0_
__ZNK3WTF8Collator7collateEPKtmS2_m
__ZTVN3JSC12StringObjectE
__ZTVN3JSC14JSGlobalObjectE
__ZTVN3JSC15JSWrapperObjectE
......@@ -375,3 +374,4 @@ __ZTVN3JSC8JSObjectE
__ZTVN3JSC8JSStringE
_jscore_fastmalloc_introspection
_kJSClassDefinitionEmpty
__ZN3WTF23waitForThreadCompletionEjPPv
......@@ -67,6 +67,7 @@ EXPORTS
?convertUTF16ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPB_WPB_WPAPADPAD_N@Z
?copyParameters@FunctionBodyNode@JSC@@QAEPAVIdentifier@2@XZ
?create@ByteArray@WTF@@SA?AV?$PassRefPtr@VByteArray@WTF@@@2@I@Z
?create@FunctionBodyNode@JSC@@SA?AV?$PassRefPtr@VFunctionBodyNode@JSC@@@WTF@@PAVJSGlobalData@2@PAVSourceElements@2@PAV?$Vector@U?$pair@VIdentifier@JSC@@I@std@@$0A@@4@PAV?$Vector@PAVFuncDeclNode@JSC@@$0A@@4@ABVSourceCode@2@IH@Z
?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@_N@Z
?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z
?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z
......@@ -192,7 +193,6 @@ EXPORTS
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@IVJSValue@2@I@Z
?randomNumber@WTF@@YANXZ
?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@_N@Z
?recordExtraCost@Heap@JSC@@AAEXI@Z
?reset@ParserArena@JSC@@QAEXXZ
?reset@TimeoutChecker@JSC@@QAEXXZ
......
......@@ -67,6 +67,7 @@ EXPORTS
?convertUTF16ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPB_WPB_WPAPADPAD_N@Z
?copyParameters@FunctionBodyNode@JSC@@QAEPAVIdentifier@2@XZ
?create@ByteArray@WTF@@SA?AV?$PassRefPtr@VByteArray@WTF@@@2@I@Z
?create@FunctionBodyNode@JSC@@SA?AV?$PassRefPtr@VFunctionBodyNode@JSC@@@WTF@@PAVJSGlobalData@2@PAVSourceElements@2@PAV?$Vector@U?$pair@VIdentifier@JSC@@I@std@@$0A@@4@PAV?$Vector@PAVFuncDeclNode@JSC@@$0A@@4@ABVSourceCode@2@IH@Z
?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@_N@Z
?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z
?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z
......@@ -192,7 +193,6 @@ EXPORTS
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I@Z
?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@IVJSValue@2@I@Z
?randomNumber@WTF@@YANXZ
?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@_N@Z
?recordExtraCost@Heap@JSC@@AAEXI@Z
?reset@ParserArena@JSC@@QAEXXZ
?reset@TimeoutChecker@JSC@@QAEXXZ
......
......@@ -72,10 +72,6 @@
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icudt40.dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40.dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\CoreFoundation.resources&quot; xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CoreFoundation.resources&quot; &quot;$(WebKitOutputDir)\bin\CoreFoundation.resources&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\objc$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\objc$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
......@@ -135,10 +131,6 @@
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icudt40.dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40.dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\CoreFoundation.resources&quot; xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CoreFoundation.resources&quot; &quot;$(WebKitOutputDir)\bin\CoreFoundation.resources&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\objc$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\objc$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Debug_Internal|Win32"
......@@ -197,10 +189,6 @@
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="if exist &quot;$(WebKitOutputDir)\buildfailed&quot; del &quot;$(WebKitOutputDir)\buildfailed&quot;&#x0D;&#x0A;&#x0D;&#x0A;mkdir 2&gt;NUL &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icudt40.dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40.dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icudt40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuin40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\icuuc40$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\CoreFoundation.resources&quot; xcopy /y /d /e /i &quot;$(WebKitLibrariesDir)\bin\CoreFoundation.resources&quot; &quot;$(WebKitOutputDir)\bin\CoreFoundation.resources&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;if exist &quot;$(WebKitLibrariesDir)\bin\objc$(LibraryConfigSuffix).dll&quot; xcopy /y /d &quot;$(WebKitLibrariesDir)\bin\objc$(LibraryConfigSuffix).dll&quot; &quot;$(WebKitOutputDir)\bin&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
......
......@@ -269,8 +269,8 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d
Vector<RegisterID*, 32> newVars;
for (size_t i = 0; i < varStack.size(); ++i)
if (!globalObject->hasProperty(exec, *varStack[i].first))
newVars.append(addGlobalVar(*varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant));
if (!globalObject->hasProperty(exec, varStack[i].first))
newVars.append(addGlobalVar(varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant));
allocateConstants(programNode->neededConstants());
......@@ -282,12 +282,12 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d
globalObject->putWithAttributes(exec, funcDecl->m_ident, funcDecl->makeFunction(exec, scopeChain.node()), DontDelete);
}
for (size_t i = 0; i < varStack.size(); ++i) {
if (globalObject->hasProperty(exec, *varStack[i].first))
if (globalObject->hasProperty(exec, varStack[i].first))
continue;
int attributes = DontDelete;
if (varStack[i].second & DeclarationStacks::IsConstant)
attributes |= ReadOnly;
globalObject->putWithAttributes(exec, *varStack[i].first, jsUndefined(), attributes);
globalObject->putWithAttributes(exec, varStack[i].first, jsUndefined(), attributes);
}
allocateConstants(programNode->neededConstants());
......@@ -345,7 +345,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug
const DeclarationStacks::VarStack& varStack = functionBody->varStack();
for (size_t i = 0; i < varStack.size(); ++i)
addVar(*varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant);
addVar(varStack[i].first, varStack[i].second & DeclarationStacks::IsConstant);
const Identifier* parameters = functionBody->parameters();
size_t parameterCount = functionBody->parameterCount();
......@@ -1837,7 +1837,7 @@ void BytecodeGenerator::emitSubroutineReturn(RegisterID* retAddrSrc)
instructions().append(retAddrSrc->index());
}
void BytecodeGenerator::emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value)
void BytecodeGenerator::emitPushNewScope(RegisterID* dst, Identifier& property, RegisterID* value)
{
ControlFlowContext context;
context.isFinallyBlock = false;
......
......@@ -319,7 +319,7 @@ namespace JSC {
RegisterID* emitCatch(RegisterID*, Label* start, Label* end);
void emitThrow(RegisterID* exc) { emitUnaryNoDstOp(op_throw, exc); }
RegisterID* emitNewError(RegisterID* dst, ErrorType type, JSValue message);
void emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value);
void emitPushNewScope(RegisterID* dst, Identifier& property, RegisterID* value);
RegisterID* emitPushScope(RegisterID* scope);
void emitPopScope();
......
......@@ -50,7 +50,6 @@ namespace JSC {
}
size_t size() const { return m_size; }
bool isEmpty() const { return !size(); }
T& at(size_t index)
{
......
......@@ -22,10 +22,8 @@
#include "config.h"
#include "Debugger.h"
#include "CollectorHeapIterator.h"
#include "Interpreter.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "Interpreter.h"
#include "Parser.h"
namespace JSC {
......@@ -55,63 +53,6 @@ void Debugger::detach(JSGlobalObject* globalObject)
globalObject->setDebugger(0);
}
void Debugger::recompileAllJSFunctions(JSGlobalData* globalData, bool callSourceParsed)
{
// If JavaScript is running, it's not safe to recompile, since we'll end
// up throwing away code that is live on the stack.
ASSERT(!globalData->dynamicGlobalObject);
if (globalData->dynamicGlobalObject)
return;
Vector<ProtectedPtr<JSFunction> > functions;
Heap::iterator heapEnd = globalData->heap.primaryHeapEnd();
for (Heap::iterator it = globalData->heap.primaryHeapBegin(); it != heapEnd; ++it) {
if ((*it)->isObject(&JSFunction::info)) {
JSFunction* function = static_cast<JSFunction*>(*it);
FunctionBodyNode* body = function->body();
if (body && !body->isHostFunction())
functions.append(function);
}
}
typedef HashMap<RefPtr<FunctionBodyNode>, RefPtr<FunctionBodyNode> > FunctionBodyMap;
typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap;
FunctionBodyMap functionBodies;
SourceProviderMap sourceProviders;
size_t size = functions.size();
for (size_t i = 0; i < size; ++i) {
JSFunction* function = functions[i];
FunctionBodyNode* oldBody = function->body();
pair<FunctionBodyMap::iterator, bool> result = functionBodies.add(oldBody, 0);
if (!result.second) {
function->setBody(result.first->second.get());
continue;
}
ExecState* exec = function->scope().globalObject()->JSGlobalObject::globalExec();
const SourceCode& sourceCode = oldBody->source();
RefPtr<FunctionBodyNode> newBody = globalData->parser->parse<FunctionBodyNode>(exec, 0, sourceCode);
ASSERT(newBody);
newBody->finishParsing(oldBody->copyParameters(), oldBody->parameterCount());
result.first->second = newBody;
function->setBody(newBody.release());
if (callSourceParsed && function->scope().globalObject()->debugger() == this)
sourceProviders.add(sourceCode.provider(), exec);
}
// Call sourceParsed() after reparsing all functions because it will execute
// JavaScript in the inspector.
SourceProviderMap::const_iterator end = sourceProviders.end();
for (SourceProviderMap::const_iterator iter = sourceProviders.begin(); iter != end; ++iter)
sourceParsed((*iter).second, SourceCode((*iter).first), -1, 0);
}
JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject)
{
CallFrame* globalCallFrame = globalObject->globalExec();
......
......@@ -50,8 +50,6 @@ namespace JSC {
virtual void didExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
virtual void didReachBreakpoint(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0;
void recompileAllJSFunctions(JSGlobalData*, bool callSourceParsed);
private:
HashSet<JSGlobalObject*> m_globalObjects;
};
......
......@@ -826,7 +826,7 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject*
const DeclarationStacks::VarStack& varStack = codeBlock->ownerNode()->varStack();
DeclarationStacks::VarStack::const_iterator varStackEnd = varStack.end();
for (DeclarationStacks::VarStack::const_iterator it = varStack.begin(); it != varStackEnd; ++it) {
const Identifier& ident = *it->first;
const Identifier& ident = (*it).first;
if (!variableObject->hasProperty(callFrame, ident)) {
PutPropertySlot slot;
variableObject->put(callFrame, ident, jsUndefined(), slot);
......
......@@ -1046,13 +1046,12 @@ void* JITStubs::cti_vm_lazyLinkCall(STUB_ARGS_DECLARATION)
STUB_INIT_STACK_FRAME(stackFrame);
JSFunction* callee = asFunction(stackFrame.args[0].jsValue());
FunctionBodyNode* calleeBody = callee->body();
JITCode jitCode = calleeBody->generatedJITCode();
JITCode jitCode = callee->body()->generatedJITCode();
ASSERT(jitCode);
CodeBlock* codeBlock = 0;
if (!calleeBody->isHostFunction())
codeBlock = &calleeBody->bytecode(callee->scope().node());
if (!callee->isHostFunction())
codeBlock = &callee->body()->bytecode(callee->scope().node());
CallLinkInfo* callLinkInfo = &stackFrame.callFrame->callerFrame()->codeBlock()->getCallLinkInfo(stackFrame.args[1].returnAddress());
JIT::linkCall(callee, codeBlock, jitCode, callLinkInfo, stackFrame.args[2].int32());
......@@ -1218,8 +1217,7 @@ JSObject* JITStubs::cti_op_construct_JSConstruct(STUB_ARGS_DECLARATION)
STUB_INIT_STACK_FRAME(stackFrame);
JSFunction* constructor = asFunction(stackFrame.args[0].jsValue());
FunctionBodyNode* constructorBody = constructor->body();
if (UNLIKELY(constructorBody && constructorBody->isHostFunction())) {
if (constructor->isHostFunction()) {
CallFrame* callFrame = stackFrame.callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS);
......
This diff is collapsed.
......@@ -141,10 +141,8 @@ ALWAYS_INLINE void Lexer::shift4()
m_code += 4;
}
void Lexer::setCode(const SourceCode& source, ParserArena& arena)
void Lexer::setCode(const SourceCode& source)
{
m_arena = &arena.identifierArena();
m_lineNumber = source.firstLine();
m_delimited = false;
m_lastToken = -1;
......@@ -206,9 +204,10 @@ void Lexer::shiftLineTerminator()
++m_lineNumber;
}
ALWAYS_INLINE const Identifier* Lexer::makeIdentifier(const UChar* characters, size_t length)
ALWAYS_INLINE Identifier* Lexer::makeIdentifier(const UChar* characters, size_t length)
{
return &JSC::makeIdentifier(*m_arena, m_globalData, characters, length);
m_identifiers.append(Identifier(m_globalData, characters, length));
return &m_identifiers.last();
}
inline bool Lexer::lastTokenWasRestrKeyword() const
......@@ -909,21 +908,16 @@ returnError:
return -1;
}
bool Lexer::scanRegExp(const Identifier*& pattern, const Identifier*& flags, UChar prefix)
bool Lexer::scanRegExp()
{
ASSERT(m_buffer16.isEmpty());
bool lastWasEscape = false;
bool inBrackets = false;
if (prefix)
record16(prefix);
while (true) {
if (isLineTerminator(m_current) || m_current == -1) {
m_buffer16.resize(0);
if (isLineTerminator(m_current) || m_current == -1)
return false;
}
if (m_current != '/' || lastWasEscape || inBrackets) {
// keep track of '[' and ']'
if (!lastWasEscape) {
......@@ -935,7 +929,7 @@ bool Lexer::scanRegExp(const Identifier*& pattern, const Identifier*& flags, UCh
record16(m_current);
lastWasEscape = !lastWasEscape && m_current == '\\';
} else { // end of regexp
pattern = makeIdentifier(m_buffer16.data(), m_buffer16.size());
m_pattern = UString(m_buffer16);
m_buffer16.resize(0);
shift1();
break;
......@@ -947,45 +941,15 @@ bool Lexer::scanRegExp(const Identifier*& pattern, const Identifier*& flags, UCh
record16(m_current);
shift1();
}
flags = makeIdentifier(m_buffer16.data(), m_buffer16.size());
m_flags = UString(m_buffer16);
m_buffer16.resize(0);
return true;
}
bool Lexer::skipRegExp()
{
bool lastWasEscape = false;
bool inBrackets = false;
while (true) {
if (isLineTerminator(m_current) || m_current == -1)
return false;
if (m_current != '/' || lastWasEscape || inBrackets) {
// keep track of '[' and ']'
if (!lastWasEscape) {
if (m_current == '[' && !inBrackets)
inBrackets = true;
if (m_current == ']' && inBrackets)
inBrackets = false;
}
lastWasEscape = !lastWasEscape && m_current == '\\';
} else { // end of regexp
shift1();
break;
}
shift1();
}
while (isIdentPart(m_current))
shift1();
return true;
}
void Lexer::clear()
{
m_arena = 0;
m_identifiers.clear();
m_codeWithoutBOMs.clear();
Vector<char> newBuffer8;
......@@ -997,6 +961,9 @@ void Lexer::clear()
m_buffer16.swap(newBuffer16);
m_isReparsing = false;
m_pattern = UString();
m_flags = UString();
}
SourceCode Lexer::sourceCode(int openBrace, int closeBrace, int firstLine)
......
......@@ -23,7 +23,7 @@
#define Lexer_h
#include "Lookup.h"
#include "ParserArena.h"
#include "SegmentedVector.h"
#include "SourceCode.h"
#include <wtf/ASCIICType.h>
#include <wtf/Vector.h>
......@@ -42,7 +42,7 @@ namespace JSC {
static UChar convertUnicode(int c1, int c2, int c3, int c4);
// Functions to set up parsing.
void setCode(const SourceCode&, ParserArena&);
void setCode(const SourceCode&);
void setIsReparsing() { m_isReparsing = true; }
// Functions for the parser itself.
......@@ -50,8 +50,9 @@ namespace JSC {
int lineNumber() const { return m_lineNumber; }
bool prevTerminator() const { return m_terminator; }
SourceCode sourceCode(int openBrace, int closeBrace, int firstLine);
bool scanRegExp(const Identifier*& pattern, const Identifier*& flags, UChar prefix = 0);
bool skipRegExp();
bool scanRegExp();
const UString& pattern() const { return m_pattern; }
const UString& flags() const { return m_flags; }
// Functions for use after parsing.
bool sawError() const { return m_error; }
......@@ -78,11 +79,12 @@ namespace JSC {
int currentOffset() const;
const UChar* currentCharacter() const;
const Identifier* makeIdentifier(const UChar* characters, size_t length);
JSC::Identifier* makeIdentifier(const UChar* buffer, size_t length);
bool lastTokenWasRestrKeyword() const;
static const size_t initialReadBufferCapacity = 32;
static const size_t initialIdentifierTableCapacity = 64;
int m_lineNumber;
......@@ -106,10 +108,13 @@ namespace JSC {
int m_next2;
int m_next3;
IdentifierArena* m_arena;
SegmentedVector<JSC::Identifier, initialIdentifierTableCapacity> m_identifiers;
JSGlobalData* m_globalData;
UString m_pattern;
UString m_flags;
const HashTable m_keywordTable;
Vector<UChar> m_codeWithoutBOMs;
......
......@@ -27,14 +27,16 @@
namespace JSC {
inline void* ParserArenaFreeable::operator new(size_t size, JSGlobalData* globalData)
inline void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData)
{
return globalData->parser->arena().allocateFreeable(size);
ParserArenaDeletable* deletable = static_cast<ParserArenaDeletable*>(fastMalloc(size));
globalData->parser->arena().deleteWithArena(deletable);
return deletable;
}
inline void* ParserArenaDeletable::operator new(size_t size, JSGlobalData* globalData)
inline void* ParserArenaDeletable::operator new(size_t size)
{
return globalData->parser->arena().allocateDeletable(size);
return fastMalloc(size);
}
inline ParserArenaRefCounted::ParserArenaRefCounted(JSGlobalData* globalData)
......@@ -76,13 +78,13 @@ namespace JSC {
{
}
inline StringNode::StringNode(JSGlobalData* globalData, const Identifier& value)
inline StringNode::StringNode(JSGlobalData* globalData, const Identifier& v)
: ExpressionNode(globalData, ResultType::stringType())
, m_value(value)
, m_value(v)
{
}
inline RegExpNode::RegExpNode(JSGlobalData* globalData, const Identifier& pattern, const Identifier& flags)
inline RegExpNode::RegExpNode(JSGlobalData* globalData, const UString& pattern, const UString& flags)
: ExpressionNode(globalData)
, m_pattern(pattern)
, m_flags(flags)
......@@ -147,13 +149,6 @@ namespace JSC {
{
}
inline PropertyNode::PropertyNode(JSGlobalData* globalData, double name, ExpressionNode* assign, Type type)
: m_name(globalData->parser->arena().makeNumericIdentifier(globalData, name))
, m_assign(assign)
, m_type(type)
{
}
inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node)
: Node(globalData)
, m_node(node)
......@@ -741,7 +736,6 @@ namespace JSC {
inline ContinueNode::ContinueNode(JSGlobalData* globalData)
: StatementNode(globalData)
, m_ident(globalData->propertyNames->nullIdentifier)
{
}
......@@ -753,7 +747,6 @@ namespace JSC {
inline BreakNode::BreakNode(JSGlobalData* globalData)
: StatementNode(globalData)
, m_ident(globalData->propertyNames->nullIdentifier)
{
}
......@@ -832,10 +825,16 @@ namespace JSC {
m_body->finishParsing(source, parameter);
}
inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr, SourceElements* statements)
inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr)
: m_expr(expr)
{
}
inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr, SourceElements* children)
: m_expr(expr)
, m_statements(statements)
{
if (children)
children->releaseContentsIntoVector(m_children);
}
inline ClauseListNode::ClauseListNode(JSGlobalData*, CaseClauseNode* clause)
......@@ -873,15 +872,15 @@ namespace JSC {
{
}
inline BlockNode::BlockNode(JSGlobalData* globalData, SourceElements* statements)
inline BlockNode::BlockNode(JSGlobalData* globalData, SourceElements* children)
: StatementNode(globalData)
, m_statements(statements)
{
if (children)
children->releaseContentsIntoVector(m_children);
}
inline ForInNode::ForInNode(JSGlobalData* globalData, ExpressionNode* l, ExpressionNode* expr, StatementNode* statement)
: StatementNode(globalData)
, m_ident(globalData->propertyNames->nullIdentifier)
, m_init(0)
, m_lexpr(l)
, m_expr(expr)
......
This diff is collapsed.
This diff is collapsed.
......@@ -53,7 +53,7 @@ void Parser::parse(JSGlobalData* globalData, int* errLine, UString* errMsg)
*errMsg = 0;
Lexer& lexer = *globalData->lexer;
lexer.setCode(*m_source, m_arena);
lexer.setCode(*m_source);
int parseError = jscyyparse(globalData);
bool lexError = lexer.sawError();
......
......@@ -25,7 +25,6 @@
#include "Debugger.h"
#include "Nodes.h"
#include "ParserArena.h"
#include "SourceProvider.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
......
......@@ -30,39 +30,9 @@
namespace JSC {
ParserArena::ParserArena()
: m_freeableMemory(0)
, m_freeablePoolEnd(0)
, m_identifierArena(new IdentifierArena)
{
}
inline void* ParserArena::freeablePool()
{