Bug 112952

Summary: JSC: Fix lexer charPosition computation when “rewind"ing the lexer
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: fpizlo, ggaren, joepeck, mhahnenberg, msaboff, oliver, timothy
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
the patch msaboff: review+

Description Mark Lam 2013-03-21 12:41:21 PDT
Currently, the lexer keeps a m_charPosition field which is supposed to track the m_code pointer.   m_charPosition used to be m_column which cannot be computed directly from the m_code pointer.  Now that we’re computing the char position instead of the column, we can get rid of m_charPosition and just compute it as m_code - m_codeStartPlusOffset, where m_codeStartPlusOffset is m_codeStart + the SourceCode offset.

This fixes a bug where m_charPosition gets out of sync with m_code when we “rewind” the lexer by setting m_code back to an earlier position in the source string.

ref: <rdar://problem/13467032>.
Comment 1 Mark Lam 2013-03-21 12:50:41 PDT
Created attachment 194322 [details]
the patch
Comment 2 Michael Saboff 2013-03-21 13:04:42 PDT
Comment on attachment 194322 [details]
the patch

Looks good.
Comment 3 Mark Lam 2013-03-21 13:09:02 PDT
Thanks for the review.  Landed in r146505: <http://trac.webkit.org/changeset/146505>.