diff options
| author | Shimeng (Simon) Wang <swang@google.com> | 2010-12-07 17:22:45 -0800 |
|---|---|---|
| committer | Shimeng (Simon) Wang <swang@google.com> | 2010-12-22 14:15:40 -0800 |
| commit | 4576aa36e9a9671459299c7963ac95aa94beaea9 (patch) | |
| tree | 3863574e050f168c0126ecb47c83319fab0972d8 /JavaScriptCore/bytecompiler | |
| parent | 55323ac613cc31553107b68603cb627264d22bb0 (diff) | |
| download | external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.zip external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.gz external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.bz2 | |
Merge WebKit at r73109: Initial merge by git.
Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8
Diffstat (limited to 'JavaScriptCore/bytecompiler')
| -rw-r--r-- | JavaScriptCore/bytecompiler/BytecodeGenerator.cpp | 38 | ||||
| -rw-r--r-- | JavaScriptCore/bytecompiler/BytecodeGenerator.h | 31 |
2 files changed, 33 insertions, 36 deletions
diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 1fa5aa4..26de0a1 100644 --- a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -153,11 +153,6 @@ void BytecodeGenerator::generate() if ((m_codeType == FunctionCode && !m_codeBlock->needsFullScopeChain() && !m_codeBlock->usesArguments()) || m_codeType == EvalCode) symbolTable().clear(); -#if !ENABLE(OPCODE_SAMPLING) - if (!m_regeneratingForExceptionInfo && !m_usesExceptions && (m_codeType == FunctionCode || m_codeType == EvalCode)) - m_codeBlock->clearExceptionInfo(); -#endif - m_codeBlock->shrinkToFit(); } @@ -199,9 +194,10 @@ void BytecodeGenerator::preserveLastVar() m_lastVar = &m_calleeRegisters.last(); } -BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* debugger, const ScopeChain& scopeChain, SymbolTable* symbolTable, ProgramCodeBlock* codeBlock) - : m_shouldEmitDebugHooks(!!debugger) +BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const ScopeChain& scopeChain, SymbolTable* symbolTable, ProgramCodeBlock* codeBlock) + : m_shouldEmitDebugHooks(scopeChain.globalObject()->debugger()) , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling()) + , m_shouldEmitRichSourceInfo(scopeChain.globalObject()->supportsRichSourceInfo()) , m_scopeChain(&scopeChain) , m_symbolTable(symbolTable) , m_scopeNode(programNode) @@ -217,7 +213,7 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d , m_hasCreatedActivation(true) , m_firstLazyFunction(0) , m_lastLazyFunction(0) - , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) + , m_globalData(&scopeChain.globalObject()->globalData()) , m_lastOpcodeID(op_end) #ifndef NDEBUG , m_lastOpcodePosition(0) @@ -293,9 +289,10 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d codeBlock->m_numCapturedVars = codeBlock->m_numVars; } -BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debugger* debugger, const ScopeChain& scopeChain, SymbolTable* symbolTable, CodeBlock* codeBlock) - : m_shouldEmitDebugHooks(!!debugger) +BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const ScopeChain& scopeChain, SymbolTable* symbolTable, CodeBlock* codeBlock) + : m_shouldEmitDebugHooks(scopeChain.globalObject()->debugger()) , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling()) + , m_shouldEmitRichSourceInfo(scopeChain.globalObject()->supportsRichSourceInfo()) , m_scopeChain(&scopeChain) , m_symbolTable(symbolTable) , m_scopeNode(functionBody) @@ -310,7 +307,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug , m_hasCreatedActivation(false) , m_firstLazyFunction(0) , m_lastLazyFunction(0) - , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) + , m_globalData(&scopeChain.globalObject()->globalData()) , m_lastOpcodeID(op_end) #ifndef NDEBUG , m_lastOpcodePosition(0) @@ -387,7 +384,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug addVar(ident, varStack[i].second & DeclarationStacks::IsConstant); } } - bool canLazilyCreateFunctions = !functionBody->needsActivationForMoreThanVariables() && !debugger; + bool canLazilyCreateFunctions = !functionBody->needsActivationForMoreThanVariables() && !m_shouldEmitDebugHooks; if (!canLazilyCreateFunctions && !m_hasCreatedActivation) { m_hasCreatedActivation = true; emitOpcode(op_create_activation); @@ -419,7 +416,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug addVar(ident, varStack[i].second & DeclarationStacks::IsConstant); } - if (debugger) + if (m_shouldEmitDebugHooks) codeBlock->m_numCapturedVars = codeBlock->m_numVars; FunctionParameters& parameters = *functionBody->parameters(); @@ -457,9 +454,10 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug } } -BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugger, const ScopeChain& scopeChain, SymbolTable* symbolTable, EvalCodeBlock* codeBlock) - : m_shouldEmitDebugHooks(!!debugger) +BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const ScopeChain& scopeChain, SymbolTable* symbolTable, EvalCodeBlock* codeBlock) + : m_shouldEmitDebugHooks(scopeChain.globalObject()->debugger()) , m_shouldEmitProfileHooks(scopeChain.globalObject()->supportsProfiling()) + , m_shouldEmitRichSourceInfo(scopeChain.globalObject()->supportsRichSourceInfo()) , m_scopeChain(&scopeChain) , m_symbolTable(symbolTable) , m_scopeNode(evalNode) @@ -474,7 +472,7 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge , m_hasCreatedActivation(true) , m_firstLazyFunction(0) , m_lastLazyFunction(0) - , m_globalData(&scopeChain.globalObject()->globalExec()->globalData()) + , m_globalData(&scopeChain.globalObject()->globalData()) , m_lastOpcodeID(op_end) #ifndef NDEBUG , m_lastOpcodePosition(0) @@ -1649,10 +1647,6 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi if (m_shouldEmitProfileHooks) { emitOpcode(op_profile_will_call); instructions().append(callArguments.profileHookRegister()->index()); - -#if ENABLE(JIT) - m_codeBlock->addFunctionRegisterInfo(instructions().size(), callArguments.profileHookRegister()->index()); -#endif } emitExpressionInfo(divot, startOffset, endOffset); @@ -1697,10 +1691,6 @@ RegisterID* BytecodeGenerator::emitCallVarargs(RegisterID* dst, RegisterID* func if (m_shouldEmitProfileHooks) { emitOpcode(op_profile_will_call); instructions().append(func->index()); - -#if ENABLE(JIT) - m_codeBlock->addFunctionRegisterInfo(instructions().size(), func->index()); -#endif } emitExpressionInfo(divot, startOffset, endOffset); diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 499d232..a90f756 100644 --- a/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -93,9 +93,9 @@ namespace JSC { static void setDumpsGeneratedCode(bool dumpsGeneratedCode); static bool dumpsGeneratedCode(); - BytecodeGenerator(ProgramNode*, const Debugger*, const ScopeChain&, SymbolTable*, ProgramCodeBlock*); - BytecodeGenerator(FunctionBodyNode*, const Debugger*, const ScopeChain&, SymbolTable*, CodeBlock*); - BytecodeGenerator(EvalNode*, const Debugger*, const ScopeChain&, SymbolTable*, EvalCodeBlock*); + BytecodeGenerator(ProgramNode*, const ScopeChain&, SymbolTable*, ProgramCodeBlock*); + BytecodeGenerator(FunctionBodyNode*, const ScopeChain&, SymbolTable*, CodeBlock*); + BytecodeGenerator(EvalNode*, const ScopeChain&, SymbolTable*, EvalCodeBlock*); JSGlobalData* globalData() const { return m_globalData; } const CommonIdentifiers& propertyNames() const { return *m_globalData->propertyNames; } @@ -207,10 +207,8 @@ namespace JSC { { // Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary. ASSERT(!dst || dst == ignoredResult() || !dst->isTemporary() || dst->refCount()); - if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) { - LineInfo info = { instructions().size(), n->lineNo() }; - m_codeBlock->addLineInfo(info); - } + addLineInfo(n->lineNo()); + if (m_emitNodeDepth >= s_maxEmitNodeDepth) return emitThrowExpressionTooDeepException(); ++m_emitNodeDepth; @@ -226,10 +224,7 @@ namespace JSC { void emitNodeInConditionContext(ExpressionNode* n, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue) { - if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) { - LineInfo info = { instructions().size(), n->lineNo() }; - m_codeBlock->addLineInfo(info); - } + addLineInfo(n->lineNo()); if (m_emitNodeDepth >= s_maxEmitNodeDepth) { emitThrowExpressionTooDeepException(); return; @@ -240,7 +235,10 @@ namespace JSC { } void emitExpressionInfo(unsigned divot, unsigned startOffset, unsigned endOffset) - { + { + if (!m_shouldEmitRichSourceInfo) + return; + divot -= m_codeBlock->sourceOffset(); if (divot > ExpressionRangeInfo::MaxDivot) { // Overflow has occurred, we can only give line number info for errors for this region @@ -504,6 +502,14 @@ namespace JSC { return FunctionExecutable::create(globalData, body->ident(), body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine()); } + void addLineInfo(unsigned lineNo) + { +#if !ENABLE(OPCODE_SAMPLING) + if (m_shouldEmitRichSourceInfo) +#endif + m_codeBlock->addLineInfo(instructions().size(), lineNo); + } + RegisterID* emitInitLazyRegister(RegisterID*); Vector<Instruction>& instructions() { return m_codeBlock->instructions(); } @@ -520,6 +526,7 @@ namespace JSC { bool m_shouldEmitDebugHooks; bool m_shouldEmitProfileHooks; + bool m_shouldEmitRichSourceInfo; const ScopeChain* m_scopeChain; SymbolTable* m_symbolTable; |
