- Revision
- 208830
- Author
- [email protected]
- Date
- 2016-11-16 17:02:06 -0800 (Wed, 16 Nov 2016)
Log Message
UnlinkedCodeBlock should not have a starting line number
https://bugs.webkit.org/show_bug.cgi?id=164838
Reviewed by Mark Lam.
Here's how the starting line number in UnlinkedCodeBlock used to work:
(1) Assign the source code starting line number to the parser starting
line number.
(2) Assign (1) to the AST.
(3) Subtract (1) from (2) and assign to UnlinkedCodeBlock.
Then, when linking:
(4) Add (3) to (1).
This was an awesome no-op.
Generally, unlinked code is code that is not tied to any particular
web page or resource. So, it's inappropriate to think of it having a
starting line number.
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::recordParse):
(JSC::UnlinkedCodeBlock::hasCapturedVariables):
(JSC::UnlinkedCodeBlock::firstLine): Deleted.
* runtime/CodeCache.cpp:
(JSC::CodeCache::getUnlinkedGlobalCodeBlock):
* runtime/CodeCache.h:
(JSC::generateUnlinkedCodeBlock):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (208829 => 208830)
--- trunk/Source/_javascript_Core/ChangeLog 2016-11-17 00:59:04 UTC (rev 208829)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-11-17 01:02:06 UTC (rev 208830)
@@ -1,3 +1,40 @@
+2016-11-16 Geoffrey Garen <[email protected]>
+
+ UnlinkedCodeBlock should not have a starting line number
+ https://bugs.webkit.org/show_bug.cgi?id=164838
+
+ Reviewed by Mark Lam.
+
+ Here's how the starting line number in UnlinkedCodeBlock used to work:
+
+ (1) Assign the source code starting line number to the parser starting
+ line number.
+
+ (2) Assign (1) to the AST.
+
+ (3) Subtract (1) from (2) and assign to UnlinkedCodeBlock.
+
+ Then, when linking:
+
+ (4) Add (3) to (1).
+
+ This was an awesome no-op.
+
+ Generally, unlinked code is code that is not tied to any particular
+ web page or resource. So, it's inappropriate to think of it having a
+ starting line number.
+
+ * bytecode/UnlinkedCodeBlock.cpp:
+ (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
+ * bytecode/UnlinkedCodeBlock.h:
+ (JSC::UnlinkedCodeBlock::recordParse):
+ (JSC::UnlinkedCodeBlock::hasCapturedVariables):
+ (JSC::UnlinkedCodeBlock::firstLine): Deleted.
+ * runtime/CodeCache.cpp:
+ (JSC::CodeCache::getUnlinkedGlobalCodeBlock):
+ * runtime/CodeCache.h:
+ (JSC::generateUnlinkedCodeBlock):
+
2016-11-16 Yusuke Suzuki <[email protected]>
[ES6][WebCore] Change ES6_MODULES compile time flag to runtime flag
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp (208829 => 208830)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp 2016-11-17 00:59:04 UTC (rev 208829)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp 2016-11-17 01:02:06 UTC (rev 208830)
@@ -70,7 +70,6 @@
, m_constructorKind(static_cast<unsigned>(info.constructorKind()))
, m_derivedContextType(static_cast<unsigned>(info.derivedContextType()))
, m_evalContextType(static_cast<unsigned>(info.evalContextType()))
- , m_firstLine(0)
, m_lineCount(0)
, m_endColumn(UINT_MAX)
, m_didOptimize(MixedTriState)
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h (208829 => 208830)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h 2016-11-17 00:59:04 UTC (rev 208829)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h 2016-11-17 01:02:06 UTC (rev 208830)
@@ -347,11 +347,10 @@
bool typeProfilerExpressionInfoForBytecodeOffset(unsigned bytecodeOffset, unsigned& startDivot, unsigned& endDivot);
- void recordParse(CodeFeatures features, bool hasCapturedVariables, unsigned firstLine, unsigned lineCount, unsigned endColumn)
+ void recordParse(CodeFeatures features, bool hasCapturedVariables, unsigned lineCount, unsigned endColumn)
{
m_features = features;
m_hasCapturedVariables = hasCapturedVariables;
- m_firstLine = firstLine;
m_lineCount = lineCount;
// For the UnlinkedCodeBlock, startColumn is always 0.
m_endColumn = endColumn;
@@ -364,7 +363,6 @@
CodeFeatures codeFeatures() const { return m_features; }
bool hasCapturedVariables() const { return m_hasCapturedVariables; }
- unsigned firstLine() const { return m_firstLine; }
unsigned lineCount() const { return m_lineCount; }
ALWAYS_INLINE unsigned startColumn() const { return 0; }
unsigned endColumn() const { return m_endColumn; }
@@ -436,7 +434,6 @@
unsigned m_constructorKind : 2;
unsigned m_derivedContextType : 2;
unsigned m_evalContextType : 2;
- unsigned m_firstLine;
unsigned m_lineCount;
unsigned m_endColumn;
Modified: trunk/Source/_javascript_Core/runtime/CodeCache.cpp (208829 => 208830)
--- trunk/Source/_javascript_Core/runtime/CodeCache.cpp 2016-11-17 00:59:04 UTC (rev 208829)
+++ trunk/Source/_javascript_Core/runtime/CodeCache.cpp 2016-11-17 01:02:06 UTC (rev 208830)
@@ -61,12 +61,11 @@
SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key);
if (cache && Options::useCodeCache()) {
UnlinkedCodeBlockType* unlinkedCodeBlock = jsCast<UnlinkedCodeBlockType*>(cache->cell.get());
- unsigned firstLine = source.firstLine() + unlinkedCodeBlock->firstLine();
unsigned lineCount = unlinkedCodeBlock->lineCount();
unsigned startColumn = unlinkedCodeBlock->startColumn() + source.startColumn();
bool endColumnIsOnStartLine = !lineCount;
unsigned endColumn = unlinkedCodeBlock->endColumn() + (endColumnIsOnStartLine ? startColumn : 1);
- executable->recordParse(unlinkedCodeBlock->codeFeatures(), unlinkedCodeBlock->hasCapturedVariables(), firstLine, firstLine + lineCount, startColumn, endColumn);
+ executable->recordParse(unlinkedCodeBlock->codeFeatures(), unlinkedCodeBlock->hasCapturedVariables(), source.firstLine(), source.firstLine() + lineCount, startColumn, endColumn);
source.provider()->setSourceURLDirective(unlinkedCodeBlock->sourceURLDirective());
source.provider()->setSourceMappingURLDirective(unlinkedCodeBlock->sourceMappingURLDirective());
return unlinkedCodeBlock;
Modified: trunk/Source/_javascript_Core/runtime/CodeCache.h (208829 => 208830)
--- trunk/Source/_javascript_Core/runtime/CodeCache.h 2016-11-17 00:59:04 UTC (rev 208829)
+++ trunk/Source/_javascript_Core/runtime/CodeCache.h 2016-11-17 01:02:06 UTC (rev 208830)
@@ -246,7 +246,7 @@
executable->recordParse(rootNode->features() | arrowContextFeature, rootNode->hasCapturedVariables(), rootNode->firstLine(), rootNode->lastLine(), startColumn, endColumn);
UnlinkedCodeBlockType* unlinkedCodeBlock = UnlinkedCodeBlockType::create(&vm, executable->executableInfo(), debuggerMode);
- unlinkedCodeBlock->recordParse(rootNode->features(), rootNode->hasCapturedVariables(), rootNode->firstLine() - source.firstLine(), lineCount, unlinkedEndColumn);
+ unlinkedCodeBlock->recordParse(rootNode->features(), rootNode->hasCapturedVariables(), lineCount, unlinkedEndColumn);
unlinkedCodeBlock->setSourceURLDirective(source.provider()->sourceURL());
unlinkedCodeBlock->setSourceMappingURLDirective(source.provider()->sourceMappingURL());