From 3350281b3b4640b24b09f2897b033678670ed37a Mon Sep 17 00:00:00 2001 From: Jedrzej Nowacki Date: Thu, 6 Aug 2009 10:07:02 +0200 Subject: Force parser to send information about current column number. Add new member in all statements nodes which suppose to be a column number from parser. All calls to setLoc were changed, they should pass 2xline number (first and last line) and column number of current "cursor"(token?) position. Develop op_debug opcode to contain column number. Review by: Kent Hansen --- .../webkit/JavaScriptCore/bytecode/CodeBlock.cpp | 3 +- .../webkit/JavaScriptCore/bytecode/Opcode.h | 2 +- .../bytecompiler/BytecodeGenerator.cpp | 3 +- .../bytecompiler/BytecodeGenerator.h | 2 +- .../webkit/JavaScriptCore/generated/Grammar.cpp | 2 +- .../JavaScriptCore/interpreter/Interpreter.cpp | 3 +- .../webkit/JavaScriptCore/parser/Grammar.y | 2 +- .../webkit/JavaScriptCore/parser/Nodes.cpp | 61 +++++++++++----------- src/3rdparty/webkit/JavaScriptCore/parser/Nodes.h | 4 +- src/3rdparty/webkit/JavaScriptCore/parser/Parser.h | 6 ++- src/3rdparty/webkit/WebCore/generated/Grammar.cpp | 2 +- 11 files changed, 49 insertions(+), 41 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp index 0cb3813..4b943c2 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/CodeBlock.cpp @@ -1087,7 +1087,8 @@ void CodeBlock::dump(ExecState* exec, const Vector::const_iterator& int debugHookID = (++it)->u.operand; int firstLine = (++it)->u.operand; int lastLine = (++it)->u.operand; - printf("[%4d] debug\t\t %s, %d, %d\n", location, debugHookName(debugHookID), firstLine, lastLine); + int column = (++it)->u.operand; + printf("[%4d] debug\t\t %s, %d, %d, %d\n", location, debugHookName(debugHookID), firstLine, lastLine, column); break; } case op_profile_will_call: { diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h index 2d1ca98..4baa0be 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecode/Opcode.h @@ -167,7 +167,7 @@ namespace JSC { macro(op_jsr, 3) \ macro(op_sret, 2) \ \ - macro(op_debug, 4) \ + macro(op_debug, 5) \ macro(op_profile_will_call, 2) \ macro(op_profile_did_call, 2) \ \ diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 15261ee..ce5518f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -1602,7 +1602,7 @@ void BytecodeGenerator::emitPopScope() m_dynamicScopeDepth--; } -void BytecodeGenerator::emitDebugHook(DebugHookID debugHookID, int firstLine, int lastLine) +void BytecodeGenerator::emitDebugHook(DebugHookID debugHookID, int firstLine, int lastLine, int column) { if (!m_shouldEmitDebugHooks) return; @@ -1610,6 +1610,7 @@ void BytecodeGenerator::emitDebugHook(DebugHookID debugHookID, int firstLine, in instructions().append(debugHookID); instructions().append(firstLine); instructions().append(lastLine); + instructions().append(column); } void BytecodeGenerator::pushFinallyContext(Label* target, RegisterID* retAddrDst) diff --git a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h index 54d0289..f7f7e1c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/src/3rdparty/webkit/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -324,7 +324,7 @@ namespace JSC { RegisterID* emitPushScope(RegisterID* scope); void emitPopScope(); - void emitDebugHook(DebugHookID, int firstLine, int lastLine); + void emitDebugHook(DebugHookID, int firstLine, int lastLine, int column ); int scopeDepth() { return m_dynamicScopeDepth + m_finallyDepth; } bool hasFinaliser() { return m_finallyDepth != 0; } diff --git a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp index 94b9654..06c6e38 100644 --- a/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/generated/Grammar.cpp @@ -139,7 +139,7 @@ static inline bool allowAutomaticSemicolon(JSC::Lexer&, int); #define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*LEXER, yychar)) YYABORT; } while (0) #define SET_EXCEPTION_LOCATION(node, start, divot, end) node->setExceptionSourceCode((divot), (divot) - (start), (end) - (divot)) -#define DBG(l, s, e) (l)->setLoc((s).first_line, (e).last_line) +#define DBG(l, s, e) (l)->setLoc((s).first_line, (e).last_line, (s).first_column + 1) using namespace JSC; using namespace std; diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp index 9c930ca..5a8f474 100644 --- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Interpreter.cpp @@ -3814,7 +3814,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi NEXT_INSTRUCTION(); } DEFINE_OPCODE(op_debug) { - /* debug debugHookID(n) firstLine(n) lastLine(n) + /* debug debugHookID(n) firstLine(n) lastLine(n) columnNumber(n) Notifies the debugger of the current state of execution. This opcode is only generated while the debugger is attached. @@ -3822,6 +3822,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi int debugHookID = (++vPC)->u.operand; int firstLine = (++vPC)->u.operand; int lastLine = (++vPC)->u.operand; + int column = (++vPC)->u.operand; debug(callFrame, static_cast(debugHookID), firstLine, lastLine); diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Grammar.y b/src/3rdparty/webkit/JavaScriptCore/parser/Grammar.y index 354c786..a3bf1fe 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/Grammar.y +++ b/src/3rdparty/webkit/JavaScriptCore/parser/Grammar.y @@ -62,7 +62,7 @@ static inline bool allowAutomaticSemicolon(JSC::Lexer&, int); #define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*LEXER, yychar)) YYABORT; } while (0) #define SET_EXCEPTION_LOCATION(node, start, divot, end) node->setExceptionSourceCode((divot), (divot) - (start), (end) - (divot)) -#define DBG(l, s, e) (l)->setLoc((s).first_line, (e).last_line) +#define DBG(l, s, e) (l)->setLoc((s).first_line, (e).last_line, (s).first_column + 1) using namespace JSC; using namespace std; diff --git a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp index 6c0d1af..8cb98e0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/parser/Nodes.cpp @@ -83,10 +83,11 @@ RegisterID* ThrowableExpressionData::emitThrowError(BytecodeGenerator& generator // ------------------------------ StatementNode -------------------------------- -void StatementNode::setLoc(int firstLine, int lastLine) +void StatementNode::setLoc(int firstLine, int lastLine, int column) { m_line = firstLine; m_lastLine = lastLine; + m_column = column; } // ------------------------------ SourceElements -------------------------------- @@ -1225,7 +1226,7 @@ RegisterID* ConstDeclNode::emitBytecode(BytecodeGenerator& generator, RegisterID RegisterID* ConstStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID*) { - generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine()); + generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), column()); return generator.emitNode(m_next); } @@ -1250,7 +1251,7 @@ RegisterID* BlockNode::emitBytecode(BytecodeGenerator& generator, RegisterID* ds RegisterID* EmptyStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) { - generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine()); + generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), column()); return dst; } @@ -1258,7 +1259,7 @@ RegisterID* EmptyStatementNode::emitBytecode(BytecodeGenerator& generator, Regis RegisterID* DebuggerStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) { - generator.emitDebugHook(DidReachBreakpoint, firstLine(), lastLine()); + generator.emitDebugHook(DidReachBreakpoint, firstLine(), lastLine(), column()); return dst; } @@ -1267,7 +1268,7 @@ RegisterID* DebuggerStatementNode::emitBytecode(BytecodeGenerator& generator, Re RegisterID* ExprStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) { ASSERT(m_expr); - generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine()); + generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), column()); return generator.emitNode(dst, m_expr); } @@ -1276,7 +1277,7 @@ RegisterID* ExprStatementNode::emitBytecode(BytecodeGenerator& generator, Regist RegisterID* VarStatementNode::emitBytecode(BytecodeGenerator& generator, RegisterID*) { ASSERT(m_expr); - generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine()); + generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), column()); return generator.emitNode(m_expr); } @@ -1284,7 +1285,7 @@ RegisterID* VarStatementNode::emitBytecode(BytecodeGenerator& generator, Registe RegisterID* IfNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) { - generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine()); + generator.emitDebugHook(WillExecuteStatement, firstLine(), lastLine(), column()); RefPtr