I have removed all the strategy-id-code. It wasn't used for anything yet.
I'm not storing the strategy in the backing-store at all. Eventually I'll
want
to use heap-allocated ByteArrays for backing-stores, and I'd prefer not to
store
a C-function pointer in those.
I'll have removed the backing store completely for now, and just use default
buffers for each table.
http://codereview.chromium.org/3467010/diff/1/3
File src/runtime.cc (right):
http://codereview.chromium.org/3467010/diff/1/3#newcode4743
src/runtime.cc:4743: index = search.Search(subject, index);
Can you explain why you don't expect it to be inlined?
http://codereview.chromium.org/3467010/diff/1/4
File src/string-search.h (right):
http://codereview.chromium.org/3467010/diff/1/4#newcode69
src/string-search.h:69: static const int kStrategyOffset = 0;
This is done in anticipation of having the backing store supplied by the
caller in some cases, so, e.g., Atom RegExps can keep their BoyerMoore
tables between calls.
I have made accessors on the search object to get the int* of the
buffers, so each search/populate function doesn't need to know about the
backing store.
http://codereview.chromium.org/3467010/diff/1/4#newcode91
src/string-search.h:91: static inline bool NonAsciiString(Vector<const
char>) {
Done.
http://codereview.chromium.org/3467010/diff/1/4#newcode105
src/string-search.h:105: // for later use.
Done.
http://codereview.chromium.org/3467010/diff/1/4#newcode152
src/string-search.h:152: // UC16 Needle.
Done.
http://codereview.chromium.org/3467010/diff/1/4#newcode162
src/string-search.h:162: typedef int
(*SearchStrategy)(StringSearch<PatternChar, SubjectChar>*, // NOLINT -
it's not a cast!
Rewrapped.
http://codereview.chromium.org/3467010/diff/1/4#newcode392
src/string-search.h:392: static int
InitialStrategy(StringSearch<PatternChar, SubjectChar>* search,
No, this should be a noun, it is the strategy, not a getter for it, or
an initializer for anything. It is the initial strategy for complex
searching - it's the strategy for linear search with bailout to BMH (the
name sucks, though).
I have removed the strategy objects and use pointers to the search
functions themselves now (which means that the function is now called
InitialSearch - a better name will be appreciated).
http://codereview.chromium.org/3467010/diff/1/4#newcode438
src/string-search.h:438: switch (id) {
Ids have been removed (eventually we'll want to keep BoyerMoore tables
between calls, and then the current state of those needs to be stored
and the strategy should be initialized based on that state, but no need
to complicate the code yet.
http://codereview.chromium.org/3467010/show
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev