Changeset 149557 in webkit
- Timestamp:
- May 4, 2013 8:03:26 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r149553 r149557 1 2013-05-03 Andreas Kling <akling@apple.com> 2 3 Remove CSS selector profiler branches from ElementRuleCollector loop. 4 <http://webkit.org/b/115581> 5 6 Reviewed by Antti Koivisto. 7 8 Templatize the method so we don't have to check for active inspector frontends on every 9 pass through the loop. 10 11 Time spent in this loop goes down from 0.5% to 0.2% on iTunes Store, WebCore binary size 12 goes up 480 bytes (sorry Benjamin, I'll make it up to you.) 13 14 * css/ElementRuleCollector.h: 15 * css/ElementRuleCollector.cpp: 16 (WebCore::ElementRuleCollector::collectMatchingRulesForList): 17 (WebCore::ElementRuleCollector::doCollectMatchingRulesForList): 18 1 19 2013-04-30 Robert Hogan <robert@webkit.org> 2 20 -
trunk/Source/WebCore/css/ElementRuleCollector.cpp
r149532 r149557 404 404 void ElementRuleCollector::collectMatchingRulesForList(const Vector<RuleData>* rules, const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange) 405 405 { 406 if (UNLIKELY(InspectorInstrumentation::hasFrontends())) { 407 doCollectMatchingRulesForList<true>(rules, matchRequest, ruleRange); 408 return; 409 } 410 doCollectMatchingRulesForList<false>(rules, matchRequest, ruleRange); 411 } 412 413 template<bool hasInspectorFrontends> 414 void ElementRuleCollector::doCollectMatchingRulesForList(const Vector<RuleData>* rules, const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange) 415 { 406 416 if (!rules) 407 417 return; … … 416 426 417 427 StyleRule* rule = ruleData.rule(); 418 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willMatchRule(document(), rule, m_inspectorCSSOMWrappers, document()->styleSheetCollection()); 428 InspectorInstrumentationCookie cookie; 429 if (hasInspectorFrontends) 430 cookie = InspectorInstrumentation::willMatchRule(document(), rule, m_inspectorCSSOMWrappers, document()->styleSheetCollection()); 419 431 PseudoId dynamicPseudo = NOPSEUDO; 420 432 if (ruleMatches(ruleData, matchRequest.scope, dynamicPseudo)) { … … 422 434 const StylePropertySet* properties = rule->properties(); 423 435 if (!properties || (properties->isEmpty() && !matchRequest.includeEmptyRules)) { 424 InspectorInstrumentation::didMatchRule(cookie, false); 436 if (hasInspectorFrontends) 437 InspectorInstrumentation::didMatchRule(cookie, false); 425 438 continue; 426 439 } 427 440 // FIXME: Exposing the non-standard getMatchedCSSRules API to web is the only reason this is needed. 428 441 if (m_sameOriginOnly && !ruleData.hasDocumentSecurityOrigin()) { 429 InspectorInstrumentation::didMatchRule(cookie, false); 442 if (hasInspectorFrontends) 443 InspectorInstrumentation::didMatchRule(cookie, false); 430 444 continue; 431 445 } … … 434 448 if (dynamicPseudo != NOPSEUDO && m_pseudoStyleRequest.pseudoId == NOPSEUDO) { 435 449 if (m_mode == SelectorChecker::CollectingRules) { 436 InspectorInstrumentation::didMatchRule(cookie, false); 450 if (hasInspectorFrontends) 451 InspectorInstrumentation::didMatchRule(cookie, false); 437 452 continue; 438 453 } … … 447 462 // Add this rule to our list of matched rules. 448 463 addMatchedRule(&ruleData); 449 InspectorInstrumentation::didMatchRule(cookie, true); 464 if (hasInspectorFrontends) 465 InspectorInstrumentation::didMatchRule(cookie, true); 450 466 continue; 451 467 } 452 468 } 453 InspectorInstrumentation::didMatchRule(cookie, false); 469 if (hasInspectorFrontends) 470 InspectorInstrumentation::didMatchRule(cookie, false); 454 471 } 455 472 } -
trunk/Source/WebCore/css/ElementRuleCollector.h
r149532 r149557 93 93 94 94 private: 95 template<bool hasInspectorFrontends> 96 void doCollectMatchingRulesForList(const Vector<RuleData>*, const MatchRequest&, StyleResolver::RuleRange&); 97 95 98 const StyleResolver::State& m_state; 96 99 DocumentRuleSets& m_ruleSets;
Note: See TracChangeset
for help on using the changeset viewer.