Title: [137988] trunk/Source/_javascript_Core
- Revision
- 137988
- Author
- [email protected]
- Date
- 2012-12-17 22:54:52 -0800 (Mon, 17 Dec 2012)
Log Message
Constant fold !{number} in the parser
https://bugs.webkit.org/show_bug.cgi?id=105232
Reviewed by Filip Pizlo.
Typically, we wait for hot execution and constant fold in the DFG.
However, !0 and !1 are common enough in minifiers that it can be good
to get them out of the way early, for faster/smaller parsing and startup.
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createLogicalNot): !{literal} is super simple, especially
since there's no literal form of NaN or Inf.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (137987 => 137988)
--- trunk/Source/_javascript_Core/ChangeLog 2012-12-18 06:37:08 UTC (rev 137987)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-12-18 06:54:52 UTC (rev 137988)
@@ -1,3 +1,18 @@
+2012-12-17 Geoffrey Garen <[email protected]>
+
+ Constant fold !{number} in the parser
+ https://bugs.webkit.org/show_bug.cgi?id=105232
+
+ Reviewed by Filip Pizlo.
+
+ Typically, we wait for hot execution and constant fold in the DFG.
+ However, !0 and !1 are common enough in minifiers that it can be good
+ to get them out of the way early, for faster/smaller parsing and startup.
+
+ * parser/ASTBuilder.h:
+ (JSC::ASTBuilder::createLogicalNot): !{literal} is super simple, especially
+ since there's no literal form of NaN or Inf.
+
2012-12-17 Filip Pizlo <[email protected]>
DFG is too aggressive eliding overflow checks for additions involving large constants
Modified: trunk/Source/_javascript_Core/parser/ASTBuilder.h (137987 => 137988)
--- trunk/Source/_javascript_Core/parser/ASTBuilder.h 2012-12-18 06:37:08 UTC (rev 137987)
+++ trunk/Source/_javascript_Core/parser/ASTBuilder.h 2012-12-18 06:54:52 UTC (rev 137988)
@@ -145,7 +145,13 @@
ExpressionNode* makeRightShiftNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
ExpressionNode* makeURightShiftNode(const JSTokenLocation&, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments);
- ExpressionNode* createLogicalNot(const JSTokenLocation& location, ExpressionNode* expr) { return new (m_globalData) LogicalNotNode(location, expr); }
+ ExpressionNode* createLogicalNot(const JSTokenLocation& location, ExpressionNode* expr)
+ {
+ if (expr->isNumber())
+ return createBoolean(location, !static_cast<NumberNode*>(expr)->value());
+
+ return new (m_globalData) LogicalNotNode(location, expr);
+ }
ExpressionNode* createUnaryPlus(const JSTokenLocation& location, ExpressionNode* expr) { return new (m_globalData) UnaryPlusNode(location, expr); }
ExpressionNode* createVoid(const JSTokenLocation& location, ExpressionNode* expr)
{
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes