WebKit Bugzilla
Attachment 349926 Details for
Bug 189637
: The BytecodeGenerator should not waste time calling emitDebugHook() when the debugger is off.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch.
bug-189637.patch (text/plain), 30.04 KB, created by
Mark Lam
on 2018-09-17 13:11:31 PDT
(
hide
)
Description:
proposed patch.
Filename:
MIME Type:
Creator:
Mark Lam
Created:
2018-09-17 13:11:31 PDT
Size:
30.04 KB
patch
obsolete
>Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 236078) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,54 @@ >+2018-09-17 Mark Lam <mark.lam@apple.com> >+ >+ The BytecodeGenerator should not waste time calling emitDebugHook() when the debugger is off. >+ https://bugs.webkit.org/show_bug.cgi?id=189637 >+ <rdar://problem/44473828> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * API/JSScriptRef.cpp: >+ (parseScript): >+ * builtins/BuiltinExecutables.cpp: >+ (JSC::BuiltinExecutables::createExecutable): >+ * bytecode/UnlinkedFunctionExecutable.cpp: >+ (JSC::generateUnlinkedFunctionCodeBlock): >+ * bytecompiler/BytecodeGenerator.cpp: >+ (JSC::BytecodeGenerator::BytecodeGenerator): >+ (JSC::BytecodeGenerator::emitCall): >+ (JSC::BytecodeGenerator::emitCallVarargs): >+ (JSC::BytecodeGenerator::emitDebugHook): >+ (JSC::BytecodeGenerator::emitDebugHookImpl): >+ (JSC::BytecodeGenerator::emitWillLeaveCallFrameDebugHook): >+ * bytecompiler/BytecodeGenerator.h: >+ (JSC::BytecodeGenerator::emitDebugHook): >+ * bytecompiler/NodesCodegen.cpp: >+ (JSC::LogicalOpNode::emitBytecodeInConditionContext): >+ (JSC::EmptyStatementNode::emitBytecode): >+ (JSC::emitProgramNodeBytecode): >+ (JSC::EvalNode::emitBytecode): >+ (JSC::FunctionNode::emitBytecode): >+ * debugger/DebuggerParseData.cpp: >+ (JSC::gatherDebuggerParseData): >+ * parser/ASTBuilder.h: >+ (JSC::ASTBuilder::ASTBuilder): >+ (JSC::ASTBuilder::breakpointLocation): >+ * parser/Parser.cpp: >+ (JSC::Parser<LexerType>::parseInner): >+ * parser/Parser.h: >+ (JSC::Parser<LexerType>::parse): >+ (JSC::parse): >+ * runtime/CodeCache.cpp: >+ (JSC::CodeCache::getUnlinkedGlobalFunctionExecutable): >+ * runtime/CodeCache.h: >+ (JSC::generateUnlinkedCodeBlock): >+ * runtime/Completion.cpp: >+ (JSC::checkSyntax): >+ (JSC::checkModuleSyntax): >+ * runtime/JSModuleLoader.cpp: >+ (JSC::moduleLoaderParseModule): >+ * runtime/ProgramExecutable.cpp: >+ (JSC::ProgramExecutable::checkSyntax): >+ > 2018-09-17 Darin Adler <darin@apple.com> > > Use OpaqueJSString rather than JSRetainPtr inside WebKit >Index: Source/JavaScriptCore/API/JSScriptRef.cpp >=================================================================== >--- Source/JavaScriptCore/API/JSScriptRef.cpp (revision 236072) >+++ Source/JavaScriptCore/API/JSScriptRef.cpp (working copy) >@@ -74,8 +74,10 @@ private: > > static bool parseScript(VM& vm, const SourceCode& source, ParserError& error) > { >+ // We're just doing syntax checks here. Don't care about debug hooks. >+ const bool shouldEmitDebugHooks = false; > return !!JSC::parse<JSC::ProgramNode>( >- &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, >+ &vm, shouldEmitDebugHooks, source, Identifier(), JSParserBuiltinMode::NotBuiltin, > JSParserStrictMode::NotStrict, JSParserScriptMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, > error); > } >Index: Source/JavaScriptCore/builtins/BuiltinExecutables.cpp >=================================================================== >--- Source/JavaScriptCore/builtins/BuiltinExecutables.cpp (revision 236072) >+++ Source/JavaScriptCore/builtins/BuiltinExecutables.cpp (working copy) >@@ -216,8 +216,9 @@ UnlinkedFunctionExecutable* BuiltinExecu > JSTextPosition positionBeforeLastNewlineFromParser; > ParserError error; > JSParserBuiltinMode builtinMode = isBuiltinDefaultClassConstructor ? JSParserBuiltinMode::NotBuiltin : JSParserBuiltinMode::Builtin; >+ const bool shouldEmitDebugHooks = false; // Never emit debug hooks for builtins. > std::unique_ptr<ProgramNode> program = parse<ProgramNode>( >- &vm, source, Identifier(), builtinMode, >+ &vm, shouldEmitDebugHooks, source, Identifier(), builtinMode, > JSParserStrictMode::NotStrict, JSParserScriptMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error, > &positionBeforeLastNewlineFromParser, constructorKind); > >Index: Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp >=================================================================== >--- Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp (revision 236072) >+++ Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp (working copy) >@@ -55,8 +55,9 @@ static UnlinkedFunctionCodeBlock* genera > JSParserStrictMode strictMode = executable->isInStrictContext() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict; > JSParserScriptMode scriptMode = executable->scriptMode(); > ASSERT(isFunctionParseMode(executable->parseMode())); >+ bool shouldEmitDebugHooks = debuggerMode == DebuggerOn; > std::unique_ptr<FunctionNode> function = parse<FunctionNode>( >- &vm, source, executable->name(), builtinMode, strictMode, scriptMode, executable->parseMode(), executable->superBinding(), error, nullptr); >+ &vm, shouldEmitDebugHooks, source, executable->name(), builtinMode, strictMode, scriptMode, executable->parseMode(), executable->superBinding(), error, nullptr); > > if (!function) { > ASSERT(error.isValid()); >Index: Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >=================================================================== >--- Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp (revision 236072) >+++ Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp (working copy) >@@ -220,12 +220,12 @@ ParserError BytecodeGenerator::generate( > } > > BytecodeGenerator::BytecodeGenerator(VM& vm, ProgramNode* programNode, UnlinkedProgramCodeBlock* codeBlock, DebuggerMode debuggerMode, const VariableEnvironment* parentScopeTDZVariables) >- : m_shouldEmitDebugHooks(Options::forceDebuggerBytecodeGeneration() || debuggerMode == DebuggerOn) >- , m_scopeNode(programNode) >+ : m_scopeNode(programNode) > , m_codeBlock(vm, codeBlock) > , m_thisRegister(CallFrame::thisArgumentOffset()) > , m_codeType(GlobalCode) > , m_vm(&vm) >+ , m_shouldEmitDebugHooks(Options::forceDebuggerBytecodeGeneration() || debuggerMode == DebuggerOn) > , m_needsToUpdateArrowFunctionContext(programNode->usesArrowFunction() || programNode->usesEval()) > { > ASSERT_UNUSED(parentScopeTDZVariables, !parentScopeTDZVariables->size()); >@@ -266,11 +266,11 @@ BytecodeGenerator::BytecodeGenerator(VM& > } > > BytecodeGenerator::BytecodeGenerator(VM& vm, FunctionNode* functionNode, UnlinkedFunctionCodeBlock* codeBlock, DebuggerMode debuggerMode, const VariableEnvironment* parentScopeTDZVariables) >- : m_shouldEmitDebugHooks(Options::forceDebuggerBytecodeGeneration() || debuggerMode == DebuggerOn) >- , m_scopeNode(functionNode) >+ : m_scopeNode(functionNode) > , m_codeBlock(vm, codeBlock) > , m_codeType(FunctionCode) > , m_vm(&vm) >+ , m_shouldEmitDebugHooks(Options::forceDebuggerBytecodeGeneration() || debuggerMode == DebuggerOn) > , m_isBuiltinFunction(codeBlock->isBuiltinFunction()) > , m_usesNonStrictEval(codeBlock->usesEval() && !codeBlock->isStrictMode()) > // FIXME: We should be able to have tail call elimination with the profiler >@@ -759,12 +759,12 @@ BytecodeGenerator::BytecodeGenerator(VM& > } > > BytecodeGenerator::BytecodeGenerator(VM& vm, EvalNode* evalNode, UnlinkedEvalCodeBlock* codeBlock, DebuggerMode debuggerMode, const VariableEnvironment* parentScopeTDZVariables) >- : m_shouldEmitDebugHooks(Options::forceDebuggerBytecodeGeneration() || debuggerMode == DebuggerOn) >- , m_scopeNode(evalNode) >+ : m_scopeNode(evalNode) > , m_codeBlock(vm, codeBlock) > , m_thisRegister(CallFrame::thisArgumentOffset()) > , m_codeType(EvalCode) > , m_vm(&vm) >+ , m_shouldEmitDebugHooks(Options::forceDebuggerBytecodeGeneration() || debuggerMode == DebuggerOn) > , m_usesNonStrictEval(codeBlock->usesEval() && !codeBlock->isStrictMode()) > , m_needsToUpdateArrowFunctionContext(evalNode->usesArrowFunction() || evalNode->usesEval()) > , m_derivedContextType(codeBlock->derivedContextType()) >@@ -822,12 +822,12 @@ BytecodeGenerator::BytecodeGenerator(VM& > } > > BytecodeGenerator::BytecodeGenerator(VM& vm, ModuleProgramNode* moduleProgramNode, UnlinkedModuleProgramCodeBlock* codeBlock, DebuggerMode debuggerMode, const VariableEnvironment* parentScopeTDZVariables) >- : m_shouldEmitDebugHooks(Options::forceDebuggerBytecodeGeneration() || debuggerMode == DebuggerOn) >- , m_scopeNode(moduleProgramNode) >+ : m_scopeNode(moduleProgramNode) > , m_codeBlock(vm, codeBlock) > , m_thisRegister(CallFrame::thisArgumentOffset()) > , m_codeType(ModuleCode) > , m_vm(&vm) >+ , m_shouldEmitDebugHooks(Options::forceDebuggerBytecodeGeneration() || debuggerMode == DebuggerOn) > , m_usesNonStrictEval(false) > , m_needsToUpdateArrowFunctionContext(moduleProgramNode->usesArrowFunction() || moduleProgramNode->usesEval()) > { >@@ -3524,7 +3524,7 @@ RegisterID* BytecodeGenerator::emitCall( > for (int i = 0; i < CallFrame::headerSizeInRegisters; ++i) > callFrame.append(newTemporary()); > >- if (m_shouldEmitDebugHooks && debuggableCall == DebuggableCall::Yes) >+ if (UNLIKELY(m_shouldEmitDebugHooks && debuggableCall == DebuggableCall::Yes)) > emitDebugHook(WillExecuteExpression, divotStart); > > emitExpressionInfo(divot, divotStart, divotEnd); >@@ -3578,7 +3578,7 @@ RegisterID* BytecodeGenerator::emitCallF > > RegisterID* BytecodeGenerator::emitCallVarargs(OpcodeID opcode, RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* arguments, RegisterID* firstFreeRegister, int32_t firstVarArgOffset, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd, DebuggableCall debuggableCall) > { >- if (m_shouldEmitDebugHooks && debuggableCall == DebuggableCall::Yes) >+ if (UNLIKELY(m_shouldEmitDebugHooks && debuggableCall == DebuggableCall::Yes)) > emitDebugHook(WillExecuteExpression, divotStart); > > emitExpressionInfo(divot, divotStart, divotEnd); >@@ -3841,9 +3841,7 @@ void BytecodeGenerator::emitPopWithScope > > void BytecodeGenerator::emitDebugHook(DebugHookType debugHookType, const JSTextPosition& divot) > { >- if (!m_shouldEmitDebugHooks) >- return; >- >+ ASSERT(debugHookType == DidReachBreakpoint || m_shouldEmitDebugHooks); > emitExpressionInfo(divot, divot, divot); > emitOpcode(op_debug); > instructions().append(debugHookType); >@@ -3858,19 +3856,21 @@ void BytecodeGenerator::emitDebugHook(De > void BytecodeGenerator::emitDebugHook(StatementNode* statement) > { > // DebuggerStatementNode will output its own special debug hook. >- if (statement->isDebuggerStatement()) >+ if (UNLIKELY(statement->isDebuggerStatement())) > return; > > emitDebugHook(WillExecuteStatement, statement->position()); > } > >-void BytecodeGenerator::emitDebugHook(ExpressionNode* expr) >+void BytecodeGenerator::emitDebugHookImpl(ExpressionNode* expr) > { > emitDebugHook(WillExecuteStatement, expr->position()); > } > > void BytecodeGenerator::emitWillLeaveCallFrameDebugHook() > { >+ if (LIKELY(!m_shouldEmitDebugHooks)) >+ return; > RELEASE_ASSERT(m_scopeNode->isFunctionNode()); > emitDebugHook(WillLeaveCallFrame, m_scopeNode->lastLine(), m_scopeNode->startOffset(), m_scopeNode->lineStartOffset()); > } >Index: Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h >=================================================================== >--- Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h (revision 236072) >+++ Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h (working copy) >@@ -878,7 +878,11 @@ namespace JSC { > void emitDebugHook(DebugHookType, const JSTextPosition&); > void emitDebugHook(DebugHookType, unsigned line, unsigned charOffset, unsigned lineStart); > void emitDebugHook(StatementNode*); >- void emitDebugHook(ExpressionNode*); >+ void emitDebugHook(ExpressionNode* expressionNode) >+ { >+ if (UNLIKELY(m_shouldEmitDebugHooks)) >+ emitDebugHookImpl(expressionNode); >+ } > void emitWillLeaveCallFrameDebugHook(); > > class CompletionRecordScope { >@@ -927,6 +931,8 @@ namespace JSC { > void emitFinallyCompletion(FinallyContext&, RegisterID* completionTypeRegister, Label& normalCompletionLabel); > > private: >+ void emitDebugHookImpl(ExpressionNode*); >+ > bool allocateCompletionRecordRegisters(); > void releaseCompletionRecordRegisters(); > >@@ -1147,8 +1153,6 @@ namespace JSC { > private: > Vector<UnlinkedInstruction, 0, UnsafeVectorOverflow> m_instructions; > >- bool m_shouldEmitDebugHooks; >- > struct LexicalScopeStackEntry { > SymbolTable* m_symbolTable; > RegisterID* m_scope; >@@ -1244,6 +1248,7 @@ namespace JSC { > size_t m_lastOpcodePosition { 0 }; > #endif > >+ bool m_shouldEmitDebugHooks { false }; > bool m_usesExceptions { false }; > bool m_expressionTooDeep { false }; > bool m_isBuiltinFunction { false }; >Index: Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp >=================================================================== >--- Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp (revision 236072) >+++ Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp (working copy) >@@ -2321,8 +2321,7 @@ RegisterID* LogicalOpNode::emitBytecode( > > void LogicalOpNode::emitBytecodeInConditionContext(BytecodeGenerator& generator, Label& trueTarget, Label& falseTarget, FallThroughMode fallThroughMode) > { >- if (UNLIKELY(needsDebugHook())) >- generator.emitDebugHook(this); >+ generator.emitDebugHook(this); > > Ref<Label> afterExpr1 = generator.newLabel(); > if (m_operator == OpLogicalAnd) >@@ -2695,9 +2694,9 @@ void BlockNode::emitBytecode(BytecodeGen > > // ------------------------------ EmptyStatementNode --------------------------- > >-void EmptyStatementNode::emitBytecode(BytecodeGenerator&, RegisterID*) >+void EmptyStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID*) > { >- RELEASE_ASSERT(needsDebugHook()); >+ RELEASE_ASSERT(!generator.shouldEmitDebugHooks() || needsDebugHook()); > } > > // ------------------------------ DebuggerStatementNode --------------------------- >@@ -3710,14 +3709,16 @@ inline void ScopeNode::emitStatementsByt > > static void emitProgramNodeBytecode(BytecodeGenerator& generator, ScopeNode& scopeNode) > { >- generator.emitDebugHook(WillExecuteProgram, scopeNode.startLine(), scopeNode.startStartOffset(), scopeNode.startLineStartOffset()); >+ if (UNLIKELY(generator.shouldEmitDebugHooks())) >+ generator.emitDebugHook(WillExecuteProgram, scopeNode.startLine(), scopeNode.startStartOffset(), scopeNode.startLineStartOffset()); > > RefPtr<RegisterID> dstRegister = generator.newTemporary(); > generator.emitLoad(dstRegister.get(), jsUndefined()); > generator.emitProfileControlFlow(scopeNode.startStartOffset()); > scopeNode.emitStatementsBytecode(generator, dstRegister.get()); > >- generator.emitDebugHook(DidExecuteProgram, scopeNode.lastLine(), scopeNode.startOffset(), scopeNode.lineStartOffset()); >+ if (UNLIKELY(generator.shouldEmitDebugHooks())) >+ generator.emitDebugHook(DidExecuteProgram, scopeNode.lastLine(), scopeNode.startOffset(), scopeNode.lineStartOffset()); > generator.emitEnd(dstRegister.get()); > } > >@@ -3739,13 +3740,15 @@ void ModuleProgramNode::emitBytecode(Byt > > void EvalNode::emitBytecode(BytecodeGenerator& generator, RegisterID*) > { >- generator.emitDebugHook(WillExecuteProgram, startLine(), startStartOffset(), startLineStartOffset()); >+ if (UNLIKELY(generator.shouldEmitDebugHooks())) >+ generator.emitDebugHook(WillExecuteProgram, startLine(), startStartOffset(), startLineStartOffset()); > > RefPtr<RegisterID> dstRegister = generator.newTemporary(); > generator.emitLoad(dstRegister.get(), jsUndefined()); > emitStatementsBytecode(generator, dstRegister.get()); > >- generator.emitDebugHook(DidExecuteProgram, lastLine(), startOffset(), lineStartOffset()); >+ if (UNLIKELY(generator.shouldEmitDebugHooks())) >+ generator.emitDebugHook(DidExecuteProgram, lastLine(), startOffset(), lineStartOffset()); > generator.emitEnd(dstRegister.get()); > } > >@@ -3765,7 +3768,8 @@ void FunctionNode::emitBytecode(Bytecode > } > > generator.emitProfileControlFlow(startStartOffset()); >- generator.emitDebugHook(DidEnterCallFrame, startLine(), startStartOffset(), startLineStartOffset()); >+ if (UNLIKELY(generator.shouldEmitDebugHooks())) >+ generator.emitDebugHook(DidEnterCallFrame, startLine(), startStartOffset(), startLineStartOffset()); > > switch (generator.parseMode()) { > case SourceParseMode::GeneratorWrapperFunctionMode: >@@ -3795,7 +3799,8 @@ void FunctionNode::emitBytecode(Bytecode > } > > ASSERT(startOffset() >= lineStartOffset()); >- generator.emitDebugHook(WillLeaveCallFrame, lastLine(), startOffset(), lineStartOffset()); >+ if (UNLIKELY(generator.shouldEmitDebugHooks())) >+ generator.emitDebugHook(WillLeaveCallFrame, lastLine(), startOffset(), lineStartOffset()); > generator.emitReturn(generator.generatorRegister()); > break; > } >@@ -3824,7 +3829,8 @@ void FunctionNode::emitBytecode(Bytecode > generator.emitPutGeneratorFields(next.get()); > > ASSERT(startOffset() >= lineStartOffset()); >- generator.emitDebugHook(WillLeaveCallFrame, lastLine(), startOffset(), lineStartOffset()); >+ if (UNLIKELY(generator.shouldEmitDebugHooks())) >+ generator.emitDebugHook(WillLeaveCallFrame, lastLine(), startOffset(), lineStartOffset()); > > // load and call @asyncFunctionResume > auto var = generator.variable(generator.propertyNames().builtinNames().asyncFunctionResumePrivateName()); >Index: Source/JavaScriptCore/debugger/DebuggerParseData.cpp >=================================================================== >--- Source/JavaScriptCore/debugger/DebuggerParseData.cpp (revision 236072) >+++ Source/JavaScriptCore/debugger/DebuggerParseData.cpp (working copy) >@@ -153,7 +153,8 @@ bool gatherDebuggerParseData(VM& vm, con > JSParserScriptMode scriptMode = DebuggerParseInfo<T>::scriptMode; > > ParserError error; >- std::unique_ptr<RootNode> rootNode = parse<RootNode>(&vm, source, Identifier(), >+ const bool shouldEmitDebugHooks = false; // Don't care about debug hooks for the data we're gathering here. >+ std::unique_ptr<RootNode> rootNode = parse<RootNode>(&vm, shouldEmitDebugHooks, source, Identifier(), > JSParserBuiltinMode::NotBuiltin, strictMode, scriptMode, parseMode, SuperBinding::NotNeeded, > error, nullptr, ConstructorKind::None, DerivedContextType::None, EvalContextType::None, > &debuggerParseData); >Index: Source/JavaScriptCore/parser/ASTBuilder.h >=================================================================== >--- Source/JavaScriptCore/parser/ASTBuilder.h (revision 236072) >+++ Source/JavaScriptCore/parser/ASTBuilder.h (working copy) >@@ -78,11 +78,12 @@ class ASTBuilder { > Operator m_op; > }; > public: >- ASTBuilder(VM* vm, ParserArena& parserArena, SourceCode* sourceCode) >+ ASTBuilder(VM* vm, ParserArena& parserArena, SourceCode* sourceCode, bool shouldEmitDebugHooks) > : m_vm(vm) > , m_parserArena(parserArena) > , m_sourceCode(sourceCode) > , m_evalCount(0) >+ , m_shouldEmitDebugHooks(shouldEmitDebugHooks) > { > } > >@@ -1028,7 +1029,8 @@ public: > > JSTextPosition breakpointLocation(Node* node) > { >- node->setNeedsDebugHook(); >+ if (UNLIKELY(m_shouldEmitDebugHooks)) >+ node->setNeedsDebugHook(); > return node->position(); > } > >@@ -1129,6 +1131,7 @@ private: > Vector<std::pair<int, int>, 10, UnsafeVectorOverflow> m_binaryOperatorStack; > Vector<std::pair<int, JSTextPosition>, 10, UnsafeVectorOverflow> m_unaryTokenStack; > int m_evalCount; >+ bool m_shouldEmitDebugHooks { false }; > }; > > ExpressionNode* ASTBuilder::makeTypeOfNode(const JSTokenLocation& location, ExpressionNode* expr) >Index: Source/JavaScriptCore/parser/Parser.cpp >=================================================================== >--- Source/JavaScriptCore/parser/Parser.cpp (revision 236072) >+++ Source/JavaScriptCore/parser/Parser.cpp (working copy) >@@ -195,11 +195,11 @@ Parser<LexerType>::~Parser() > } > > template <typename LexerType> >-String Parser<LexerType>::parseInner(const Identifier& calleeName, SourceParseMode parseMode) >+String Parser<LexerType>::parseInner(const Identifier& calleeName, SourceParseMode parseMode, bool shouldEmitDebugHooks) > { > String parseError = String(); > >- ASTBuilder context(const_cast<VM*>(m_vm), m_parserArena, const_cast<SourceCode*>(m_source)); >+ ASTBuilder context(const_cast<VM*>(m_vm), m_parserArena, const_cast<SourceCode*>(m_source), shouldEmitDebugHooks); > ScopeRef scope = currentScope(); > scope->setIsLexicalScope(); > SetForScope<FunctionParsePhase> functionParsePhasePoisoner(m_parserState.functionParsePhase, FunctionParsePhase::Body); >Index: Source/JavaScriptCore/parser/Parser.h >=================================================================== >--- Source/JavaScriptCore/parser/Parser.h (revision 236072) >+++ Source/JavaScriptCore/parser/Parser.h (working copy) >@@ -874,7 +874,7 @@ public: > ~Parser(); > > template <class ParsedNode> >- std::unique_ptr<ParsedNode> parse(ParserError&, const Identifier&, SourceParseMode); >+ std::unique_ptr<ParsedNode> parse(ParserError&, const Identifier&, SourceParseMode, bool shouldEmitDebugHooks); > > JSTextPosition positionBeforeLastNewline() const { return m_lexer->positionBeforeLastNewline(); } > JSTokenLocation locationBeforeLastToken() const { return m_lexer->lastTokenLocation(); } >@@ -1312,7 +1312,7 @@ private: > } > > Parser(); >- String parseInner(const Identifier&, SourceParseMode); >+ String parseInner(const Identifier&, SourceParseMode, bool shouldEmitDebugHooks); > > void didFinishParsing(SourceElements*, DeclarationStacks::FunctionStack&&, VariableEnvironment&, UniquedStringImplPtrSet&&, CodeFeatures, int); > >@@ -1848,7 +1848,7 @@ private: > > template <typename LexerType> > template <class ParsedNode> >-std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error, const Identifier& calleeName, SourceParseMode parseMode) >+std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error, const Identifier& calleeName, SourceParseMode parseMode, bool shouldEmitDebugHooks) > { > int errLine; > String errMsg; >@@ -1865,7 +1865,7 @@ std::unique_ptr<ParsedNode> Parser<Lexer > ASSERT(m_source->startColumn() > OrdinalNumber::beforeFirst()); > unsigned startColumn = m_source->startColumn().zeroBasedInt(); > >- String parseError = parseInner(calleeName, parseMode); >+ String parseError = parseInner(calleeName, parseMode, shouldEmitDebugHooks); > > int lineNumber = m_lexer->lineNumber(); > bool lexError = m_lexer->sawError(); >@@ -1942,7 +1942,7 @@ std::unique_ptr<ParsedNode> Parser<Lexer > > template <class ParsedNode> > std::unique_ptr<ParsedNode> parse( >- VM* vm, const SourceCode& source, >+ VM* vm, bool shouldEmitDebugHooks, const SourceCode& source, > const Identifier& name, JSParserBuiltinMode builtinMode, > JSParserStrictMode strictMode, JSParserScriptMode scriptMode, SourceParseMode parseMode, SuperBinding superBinding, > ParserError& error, JSTextPosition* positionBeforeLastNewline = nullptr, >@@ -1960,7 +1960,7 @@ std::unique_ptr<ParsedNode> parse( > std::unique_ptr<ParsedNode> result; > if (source.provider()->source().is8Bit()) { > Parser<Lexer<LChar>> parser(vm, source, builtinMode, strictMode, scriptMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType, debuggerParseData); >- result = parser.parse<ParsedNode>(error, name, parseMode); >+ result = parser.parse<ParsedNode>(error, name, parseMode, shouldEmitDebugHooks); > if (positionBeforeLastNewline) > *positionBeforeLastNewline = parser.positionBeforeLastNewline(); > if (builtinMode == JSParserBuiltinMode::Builtin) { >@@ -1973,7 +1973,7 @@ std::unique_ptr<ParsedNode> parse( > } else { > ASSERT_WITH_MESSAGE(defaultConstructorKind == ConstructorKind::None, "BuiltinExecutables::createDefaultConstructor should always use a 8-bit string"); > Parser<Lexer<UChar>> parser(vm, source, builtinMode, strictMode, scriptMode, parseMode, superBinding, defaultConstructorKind, derivedContextType, isEvalNode<ParsedNode>(), evalContextType, debuggerParseData); >- result = parser.parse<ParsedNode>(error, name, parseMode); >+ result = parser.parse<ParsedNode>(error, name, parseMode, shouldEmitDebugHooks); > if (positionBeforeLastNewline) > *positionBeforeLastNewline = parser.positionBeforeLastNewline(); > } >Index: Source/JavaScriptCore/runtime/CodeCache.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/CodeCache.cpp (revision 236072) >+++ Source/JavaScriptCore/runtime/CodeCache.cpp (working copy) >@@ -117,8 +117,9 @@ UnlinkedFunctionExecutable* CodeCache::g > } > > JSTextPosition positionBeforeLastNewline; >+ bool shouldEmitDebugHooks = debuggerMode == DebuggerOn; > std::unique_ptr<ProgramNode> program = parse<ProgramNode>( >- &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, >+ &vm, shouldEmitDebugHooks, source, Identifier(), JSParserBuiltinMode::NotBuiltin, > JSParserStrictMode::NotStrict, JSParserScriptMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, > error, &positionBeforeLastNewline); > if (!program) { >Index: Source/JavaScriptCore/runtime/CodeCache.h >=================================================================== >--- Source/JavaScriptCore/runtime/CodeCache.h (revision 236072) >+++ Source/JavaScriptCore/runtime/CodeCache.h (working copy) >@@ -230,8 +230,9 @@ UnlinkedCodeBlockType* generateUnlinkedC > { > typedef typename CacheTypes<UnlinkedCodeBlockType>::RootNode RootNode; > DerivedContextType derivedContextType = executable->derivedContextType(); >+ bool shouldEmitDebugHooks = debuggerMode == DebuggerOn; > std::unique_ptr<RootNode> rootNode = parse<RootNode>( >- &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, strictMode, scriptMode, CacheTypes<UnlinkedCodeBlockType>::parseMode, SuperBinding::NotNeeded, error, nullptr, ConstructorKind::None, derivedContextType, evalContextType); >+ &vm, shouldEmitDebugHooks, source, Identifier(), JSParserBuiltinMode::NotBuiltin, strictMode, scriptMode, CacheTypes<UnlinkedCodeBlockType>::parseMode, SuperBinding::NotNeeded, error, nullptr, ConstructorKind::None, derivedContextType, evalContextType); > if (!rootNode) > return nullptr; > >Index: Source/JavaScriptCore/runtime/Completion.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/Completion.cpp (revision 236072) >+++ Source/JavaScriptCore/runtime/Completion.cpp (working copy) >@@ -65,8 +65,9 @@ bool checkSyntax(VM& vm, const SourceCod > { > JSLockHolder lock(vm); > RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable()); >+ const bool shouldEmitDebugHooks = false; // Syntax checks don't care about debug hooks. > return !!parse<ProgramNode>( >- &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, >+ &vm, shouldEmitDebugHooks, source, Identifier(), JSParserBuiltinMode::NotBuiltin, > JSParserStrictMode::NotStrict, JSParserScriptMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error); > } > >@@ -75,8 +76,9 @@ bool checkModuleSyntax(ExecState* exec, > VM& vm = exec->vm(); > JSLockHolder lock(vm); > RELEASE_ASSERT(vm.atomicStringTable() == Thread::current().atomicStringTable()); >+ const bool shouldEmitDebugHooks = false; // Syntax checks don't care about debug hooks. > std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>( >- &vm, source, Identifier(), JSParserBuiltinMode::NotBuiltin, >+ &vm, shouldEmitDebugHooks, source, Identifier(), JSParserBuiltinMode::NotBuiltin, > JSParserStrictMode::Strict, JSParserScriptMode::Module, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error); > if (!moduleProgramNode) > return false; >Index: Source/JavaScriptCore/runtime/JSModuleLoader.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSModuleLoader.cpp (revision 236072) >+++ Source/JavaScriptCore/runtime/JSModuleLoader.cpp (working copy) >@@ -371,8 +371,9 @@ EncodedJSValue JSC_HOST_CALL moduleLoade > CodeProfiling profile(sourceCode); > > ParserError error; >+ const bool shouldEmitDebugHooks = false; // Don't care about debug hooks for the data we're gathering here. > std::unique_ptr<ModuleProgramNode> moduleProgramNode = parse<ModuleProgramNode>( >- &vm, sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin, >+ &vm, shouldEmitDebugHooks, sourceCode, Identifier(), JSParserBuiltinMode::NotBuiltin, > JSParserStrictMode::Strict, JSParserScriptMode::Module, SourceParseMode::ModuleAnalyzeMode, SuperBinding::NotNeeded, error); > if (error.isValid()) { > auto result = deferred->reject(exec, error.toErrorObject(exec->lexicalGlobalObject(), sourceCode)); >Index: Source/JavaScriptCore/runtime/ProgramExecutable.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/ProgramExecutable.cpp (revision 236072) >+++ Source/JavaScriptCore/runtime/ProgramExecutable.cpp (working copy) >@@ -63,8 +63,9 @@ JSObject* ProgramExecutable::checkSyntax > ParserError error; > VM* vm = &exec->vm(); > JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject(); >+ const bool shouldEmitDebugHooks = false; // Syntax checks don't care about debug hooks. > std::unique_ptr<ProgramNode> programNode = parse<ProgramNode>( >- vm, m_source, Identifier(), JSParserBuiltinMode::NotBuiltin, >+ vm, shouldEmitDebugHooks, m_source, Identifier(), JSParserBuiltinMode::NotBuiltin, > JSParserStrictMode::NotStrict, JSParserScriptMode::Classic, SourceParseMode::ProgramMode, SuperBinding::NotNeeded, error); > if (programNode) > return 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189637
: 349926 |
349929
|
349945