diff options
author | Leon Clarke <leonclarke@google.com> | 2010-07-15 12:03:35 +0100 |
---|---|---|
committer | Leon Clarke <leonclarke@google.com> | 2010-07-20 16:57:23 +0100 |
commit | e458d70a0d18538346f41b503114c9ebe6b2ce12 (patch) | |
tree | 86f1637deca2c524432a822e5fcedd4bef221091 /JavaScriptCore/runtime/Executable.cpp | |
parent | f43eabc081f7ce6af24b9df4953498a3cd6ca24d (diff) | |
download | external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.zip external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.gz external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.bz2 |
Merge WebKit at r63173 : Initial merge by git.
Change-Id: Ife5af0c7c6261fbbc8ae6bc08c390efa9ef10b44
Diffstat (limited to 'JavaScriptCore/runtime/Executable.cpp')
-rw-r--r-- | JavaScriptCore/runtime/Executable.cpp | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/JavaScriptCore/runtime/Executable.cpp b/JavaScriptCore/runtime/Executable.cpp index f33f3b4..355ee86 100644 --- a/JavaScriptCore/runtime/Executable.cpp +++ b/JavaScriptCore/runtime/Executable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -77,7 +77,7 @@ JSObject* EvalExecutable::compile(ExecState* exec, ScopeChainNode* scopeChainNod ASSERT(!m_evalCodeBlock); m_evalCodeBlock = new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth()); - OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(evalNode.get(), globalObject->debugger(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock)); + OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), globalObject->debugger(), scopeChain, m_evalCodeBlock->symbolTable(), m_evalCodeBlock))); generator->generate(); evalNode->destroyData(); @@ -112,7 +112,7 @@ JSObject* ProgramExecutable::compile(ExecState* exec, ScopeChainNode* scopeChain ASSERT(!m_programCodeBlock); m_programCodeBlock = new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider()); - OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(programNode.get(), globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock)); + OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(programNode.get(), globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock))); generator->generate(); programNode->destroyData(); @@ -135,7 +135,7 @@ bool FunctionExecutable::compileForCall(ExecState*, ScopeChainNode* scopeChainNo ASSERT(!m_codeBlockForCall); m_codeBlockForCall = new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), false); - OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForCall->symbolTable(), m_codeBlockForCall)); + OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForCall->symbolTable(), m_codeBlockForCall))); generator->generate(); m_numParametersForCall = m_codeBlockForCall->m_numParameters; ASSERT(m_numParametersForCall); @@ -162,7 +162,7 @@ bool FunctionExecutable::compileForConstruct(ExecState*, ScopeChainNode* scopeCh ASSERT(!m_codeBlockForConstruct); m_codeBlockForConstruct = new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), true); - OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct)); + OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(body.get(), globalObject->debugger(), scopeChain, m_codeBlockForConstruct->symbolTable(), m_codeBlockForConstruct))); generator->generate(); m_numParametersForConstruct = m_codeBlockForConstruct->m_numParameters; ASSERT(m_numParametersForConstruct); @@ -177,6 +177,9 @@ bool FunctionExecutable::compileForConstruct(ExecState*, ScopeChainNode* scopeCh void EvalExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeChainNode) { +#if ENABLE(INTERPRETER) + ASSERT(exec->globalData().canUseJIT()); +#endif CodeBlock* codeBlock = &bytecode(exec, scopeChainNode); m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, codeBlock); @@ -188,6 +191,9 @@ void EvalExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeChain void ProgramExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeChainNode) { +#if ENABLE(INTERPRETER) + ASSERT(exec->globalData().canUseJIT()); +#endif CodeBlock* codeBlock = &bytecode(exec, scopeChainNode); m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, codeBlock); @@ -199,6 +205,9 @@ void ProgramExecutable::generateJITCode(ExecState* exec, ScopeChainNode* scopeCh void FunctionExecutable::generateJITCodeForCall(ExecState* exec, ScopeChainNode* scopeChainNode) { +#if ENABLE(INTERPRETER) + ASSERT(exec->globalData().canUseJIT()); +#endif CodeBlock* codeBlock = bytecodeForCall(exec, scopeChainNode); m_jitCodeForCall = JIT::compile(scopeChainNode->globalData, codeBlock, &m_jitCodeForCallWithArityCheck); @@ -210,6 +219,9 @@ void FunctionExecutable::generateJITCodeForCall(ExecState* exec, ScopeChainNode* void FunctionExecutable::generateJITCodeForConstruct(ExecState* exec, ScopeChainNode* scopeChainNode) { +#if ENABLE(INTERPRETER) + ASSERT(exec->globalData().canUseJIT()); +#endif CodeBlock* codeBlock = bytecodeForConstruct(exec, scopeChainNode); m_jitCodeForConstruct = JIT::compile(scopeChainNode->globalData, codeBlock, &m_jitCodeForConstructWithArityCheck); @@ -229,11 +241,11 @@ void FunctionExecutable::markAggregate(MarkStack& markStack) m_codeBlockForConstruct->markAggregate(markStack); } -ExceptionInfo* FunctionExecutable::reparseExceptionInfo(JSGlobalData* globalData, ScopeChainNode* scopeChainNode, CodeBlock* codeBlock) +PassOwnPtr<ExceptionInfo> FunctionExecutable::reparseExceptionInfo(JSGlobalData* globalData, ScopeChainNode* scopeChainNode, CodeBlock* codeBlock) { RefPtr<FunctionBodyNode> newFunctionBody = globalData->parser->parse<FunctionBodyNode>(globalData, 0, 0, m_source); if (!newFunctionBody) - return 0; + return PassOwnPtr<ExceptionInfo>(); if (m_forceUsesArguments) newFunctionBody->setUsesArguments(); newFunctionBody->finishParsing(m_parameters, m_name); @@ -241,18 +253,23 @@ ExceptionInfo* FunctionExecutable::reparseExceptionInfo(JSGlobalData* globalData ScopeChain scopeChain(scopeChainNode); JSGlobalObject* globalObject = scopeChain.globalObject(); - OwnPtr<CodeBlock> newCodeBlock(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), codeBlock->m_isConstructor)); + OwnPtr<CodeBlock> newCodeBlock(adoptPtr(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset(), codeBlock->m_isConstructor))); globalData->functionCodeBlockBeingReparsed = newCodeBlock.get(); - OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(newFunctionBody.get(), globalObject->debugger(), scopeChain, newCodeBlock->symbolTable(), 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) - JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get()); - ASSERT(codeBlock->m_isConstructor ? newJITCode.size() == generatedJITCodeForConstruct().size() : newJITCode.size() == generatedJITCodeForCall().size()); +#if ENABLE(INTERPRETER) + if (globalData->canUseJIT()) +#endif + { + JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get()); + ASSERT(codeBlock->m_isConstructor ? newJITCode.size() == generatedJITCodeForConstruct().size() : newJITCode.size() == generatedJITCodeForCall().size()); + } #endif globalData->functionCodeBlockBeingReparsed = 0; @@ -260,26 +277,31 @@ ExceptionInfo* FunctionExecutable::reparseExceptionInfo(JSGlobalData* globalData return newCodeBlock->extractExceptionInfo(); } -ExceptionInfo* EvalExecutable::reparseExceptionInfo(JSGlobalData* globalData, ScopeChainNode* scopeChainNode, CodeBlock* codeBlock) +PassOwnPtr<ExceptionInfo> EvalExecutable::reparseExceptionInfo(JSGlobalData* globalData, ScopeChainNode* scopeChainNode, CodeBlock* codeBlock) { RefPtr<EvalNode> newEvalBody = globalData->parser->parse<EvalNode>(globalData, 0, 0, m_source); if (!newEvalBody) - return 0; + return PassOwnPtr<ExceptionInfo>(); ScopeChain scopeChain(scopeChainNode); JSGlobalObject* globalObject = scopeChain.globalObject(); - OwnPtr<EvalCodeBlock> newCodeBlock(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth())); + OwnPtr<EvalCodeBlock> newCodeBlock(adoptPtr(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth()))); - OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(newEvalBody.get(), globalObject->debugger(), scopeChain, newCodeBlock->symbolTable(), newCodeBlock.get())); + 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) - JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get()); - ASSERT(newJITCode.size() == generatedJITCodeForCall().size()); +#if ENABLE(INTERPRETER) + if (globalData->canUseJIT()) +#endif + { + JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get()); + ASSERT(newJITCode.size() == generatedJITCodeForCall().size()); + } #endif return newCodeBlock->extractExceptionInfo(); @@ -334,6 +356,10 @@ UString FunctionExecutable::paramString() const return builder.build(); } -}; - +PassOwnPtr<ExceptionInfo> ProgramExecutable::reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) +{ + // CodeBlocks for program code are transient and therefore do not gain from from throwing out their exception information. + return PassOwnPtr<ExceptionInfo>(); +} +} |