- void emitGetByIdExceptionInfo(OpcodeID opcodeID)
- {
- // Only op_construct and op_instanceof need exception info for
- // a preceding op_get_by_id.
- ASSERT(opcodeID == op_construct || opcodeID == op_instanceof);
- GetByIdExceptionInfo info;
- info.bytecodeOffset = instructions().size();
- info.isOpConstruct = (opcodeID == op_construct);
- m_codeBlock->addGetByIdExceptionInfo(info);
+ void emitExpressionInfo(const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)
+ {
+ ASSERT(divot.offset >= divotStart.offset);
+ ASSERT(divotEnd.offset >= divot.offset);
+
+ int sourceOffset = m_scopeNode->source().startOffset();
+ unsigned firstLine = m_scopeNode->source().firstLine();
+
+ int divotOffset = divot.offset - sourceOffset;
+ int startOffset = divot.offset - divotStart.offset;
+ int endOffset = divotEnd.offset - divot.offset;
+
+ unsigned line = divot.line;
+ ASSERT(line >= firstLine);
+ line -= firstLine;
+
+ int lineStart = divot.lineStartOffset;
+ if (lineStart > sourceOffset)
+ lineStart -= sourceOffset;
+ else
+ lineStart = 0;
+
+ if (divotOffset < lineStart)
+ return;
+
+ unsigned column = divotOffset - lineStart;
+
+ unsigned instructionOffset = instructions().size();
+ if (!m_isBuiltinFunction)
+ m_codeBlock->addExpressionInfo(instructionOffset, divotOffset, startOffset, endOffset, line, column);