Title: [136049] trunk/Source/_javascript_Core
- Revision
- 136049
- Author
- oli...@apple.com
- Date
- 2012-11-28 13:11:53 -0800 (Wed, 28 Nov 2012)
Log Message
Make source cache include more information about the function extent.
https://bugs.webkit.org/show_bug.cgi?id=103552
Reviewed by Gavin Barraclough.
Add a bit more information to the source cache.
* parser/Parser.cpp:
(JSC::::parseFunctionInfo):
Store the function start offset
* parser/SourceProviderCacheItem.h:
(JSC::SourceProviderCacheItem::SourceProviderCacheItem):
(SourceProviderCacheItem):
Add additional field for the start of the real function string, and re-arrange
fields to avoid growing the struct.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (136048 => 136049)
--- trunk/Source/_javascript_Core/ChangeLog 2012-11-28 21:04:00 UTC (rev 136048)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-11-28 21:11:53 UTC (rev 136049)
@@ -1,3 +1,21 @@
+2012-11-28 Oliver Hunt <oli...@apple.com>
+
+ Make source cache include more information about the function extent.
+ https://bugs.webkit.org/show_bug.cgi?id=103552
+
+ Reviewed by Gavin Barraclough.
+
+ Add a bit more information to the source cache.
+
+ * parser/Parser.cpp:
+ (JSC::::parseFunctionInfo):
+ Store the function start offset
+ * parser/SourceProviderCacheItem.h:
+ (JSC::SourceProviderCacheItem::SourceProviderCacheItem):
+ (SourceProviderCacheItem):
+ Add additional field for the start of the real function string, and re-arrange
+ fields to avoid growing the struct.
+
2012-11-27 Filip Pizlo <fpi...@apple.com>
Convert some remaining uses of FILE* to PrintStream&.
Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (136048 => 136049)
--- trunk/Source/_javascript_Core/parser/Parser.cpp 2012-11-28 21:04:00 UTC (rev 136048)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp 2012-11-28 21:11:53 UTC (rev 136049)
@@ -812,6 +812,7 @@
{
AutoPopScopeRef functionScope(this, pushScope());
functionScope->setIsFunction();
+ int functionStart = m_token.m_location.startOffset;
if (match(IDENT)) {
name = m_token.m_data.ident;
next();
@@ -865,7 +866,7 @@
OwnPtr<SourceProviderCacheItem> newInfo;
int functionLength = closeBracePos - openBracePos;
if (TreeBuilder::CanUseFunctionCache && m_functionCache && functionLength > minimumFunctionLengthToCache) {
- newInfo = adoptPtr(new SourceProviderCacheItem(m_token.m_location.line, closeBracePos));
+ newInfo = adoptPtr(new SourceProviderCacheItem(functionStart, m_token.m_location.line, closeBracePos));
functionScope->saveFunctionInfo(newInfo.get());
}
Modified: trunk/Source/_javascript_Core/parser/SourceProviderCacheItem.h (136048 => 136049)
--- trunk/Source/_javascript_Core/parser/SourceProviderCacheItem.h 2012-11-28 21:04:00 UTC (rev 136048)
+++ trunk/Source/_javascript_Core/parser/SourceProviderCacheItem.h 2012-11-28 21:11:53 UTC (rev 136049)
@@ -35,8 +35,9 @@
class SourceProviderCacheItem {
WTF_MAKE_FAST_ALLOCATED;
public:
- SourceProviderCacheItem(int closeBraceLine, int closeBracePos)
- : closeBraceLine(closeBraceLine)
+ SourceProviderCacheItem(unsigned functionStart, unsigned closeBraceLine, unsigned closeBracePos)
+ : functionStart(functionStart)
+ , closeBraceLine(closeBraceLine)
, closeBracePos(closeBracePos)
{
}
@@ -59,12 +60,16 @@
token.m_location.line = closeBraceLine;
return token;
}
+
+ unsigned functionStart : 31;
+ bool needsFullActivation : 1;
- int closeBraceLine;
- int closeBracePos;
- bool usesEval;
- bool strictMode;
- bool needsFullActivation;
+ unsigned closeBraceLine : 31;
+ bool usesEval : 1;
+
+ unsigned closeBracePos : 31;
+ bool strictMode : 1;
+
Vector<RefPtr<StringImpl> > usedVariables;
Vector<RefPtr<StringImpl> > writtenVariables;
};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes