Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Issue 1938343002: Generate a series of nested switch statements to parse CSSPrimitiveValue units. (Closed)

Created:
4 years, 7 months ago by meade_UTC10
Modified:
4 years, 6 months ago
Reviewers:
Timothy Loh
CC:
chromium-reviews, blink-reviews-css, dglazkov+blink, apavlov+blink_chromium.org, darktears, blink-reviews, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Generate a series of nested switch statements to parse CSSPrimitiveValue units. First, read in a text file of strings to types, generate a Trie, then use the Trie to generate the nested switch statements. Generated CSSPrimitiveValueUnitTrie.cpp: http://pastebin.com/EMJU9eNp Using the instructions here: https://chromium.googlesource.com/chromium/src/+/master/docs/linux_profiling.md when running the "slow" part of the inline-transform benchmark linked in http://crbug.com/605792, it looks like this change halves the time spent in blink::CSSTokenizer::consumeNumericToken, taking 10% off CSSParserImpl::parseValue. BUG=606695

Patch Set 1 #

Patch Set 2 : #

Total comments: 17

Patch Set 3 : Rewrite trie generation #

Patch Set 4 : Update build dependencies #

Patch Set 5 : Fix template instantiation #

Patch Set 6 : Update template for lowercasing ascii #

Patch Set 7 : #

Patch Set 8 : Replace isASCIIAlphaCaselessEqual with toASCIILower(char) == to avoid hitting CHECKs #

Patch Set 9 : Sync to head #

Patch Set 10 : Fix issues with __qem and make sure switch statements are used properly #

Patch Set 11 : Sort the output so that the order is the same as it was before #

Patch Set 12 : Make all values appear in the .in file #

Total comments: 13

Patch Set 13 : Reparent branch and merge changes #

Patch Set 14 : Remove extra imports #

Total comments: 1

Patch Set 15 : Sync to head #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -4 lines) Patch
M third_party/WebKit/Source/build/scripts/make_css_primitive_value_unit_trie.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSPrimitiveValue.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +0 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/css/CSSPrimitiveValueUnits.in View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 12 (6 generated)
Timothy Loh
comments as per discussion (maybe better to put WIP in the patch title to make ...
4 years, 7 months ago (2016-05-03 07:40:26 UTC) #2
meade_UTC10
https://codereview.chromium.org/1938343002/diff/20001/third_party/WebKit/Source/build/scripts/make_css_primitive_value_unit_trie.py File third_party/WebKit/Source/build/scripts/make_css_primitive_value_unit_trie.py (right): https://codereview.chromium.org/1938343002/diff/20001/third_party/WebKit/Source/build/scripts/make_css_primitive_value_unit_trie.py#newcode40 third_party/WebKit/Source/build/scripts/make_css_primitive_value_unit_trie.py:40: def generate_header(self): On 2016/05/03 07:40:25, Timothy Loh wrote: > ...
4 years, 7 months ago (2016-05-04 07:24:54 UTC) #4
Timothy Loh
As discussed, let's split this up into a patch for generalizing the switch logic and ...
4 years, 7 months ago (2016-05-12 07:03:15 UTC) #8
meade_UTC10
These comments are addressed in https://codereview.chromium.org/1978703002 I will update the rest of the comments in ...
4 years, 7 months ago (2016-05-13 03:48:19 UTC) #9
meade_UTC10
https://codereview.chromium.org/1938343002/diff/220001/third_party/WebKit/Source/build/scripts/make_css_primitive_value_unit_trie.py File third_party/WebKit/Source/build/scripts/make_css_primitive_value_unit_trie.py (right): https://codereview.chromium.org/1938343002/diff/220001/third_party/WebKit/Source/build/scripts/make_css_primitive_value_unit_trie.py#newcode29 third_party/WebKit/Source/build/scripts/make_css_primitive_value_unit_trie.py:29: self._dict = {} On 2016/05/12 07:03:14, Timothy Loh wrote: ...
4 years, 7 months ago (2016-05-13 04:32:05 UTC) #10
Timothy Loh
4 years, 7 months ago (2016-05-13 06:54:48 UTC) #12
lgtm with all the default_value stuff removed, the patch rebased, and an updated
generated file linked to in the description

https://codereview.chromium.org/1938343002/diff/260001/third_party/WebKit/Sou...
File
third_party/WebKit/Source/build/scripts/templates/CSSPrimitiveValueUnitTrie.cpp.tmpl
(right):

https://codereview.chromium.org/1938343002/diff/260001/third_party/WebKit/Sou...
third_party/WebKit/Source/build/scripts/templates/CSSPrimitiveValueUnitTrie.cpp.tmpl:20:
return {{ trie_return_statement(default_value) }};
I think it's clearer to just return CSSPrimitiveValue::UnitType::Unknown, and
remove the default_value everywhere

Powered by Google App Engine
This is Rietveld 408576698