Did a quick benchmark with positions and found out there is an deoptimization
pattern in some string functions:

  if (%_ArgumentsLength() > 1) {
    pos = %_Arguments(1);  // position
    pos = TO_INTEGER(pos);
  }

should be

  if (%_ArgumentsLength() > 1) {
    var arg = %_Arguments(1);  // position
    if (!IS_UNDEFINED(arg)) {
      pos = $toInteger(arg);
    }
  }

results into

String.startsWith
OLD  NEW
search: warmup index:undefined
2105 1021
search:  index:undefined
2136 1042
search:  index:0
1122 1179
search:   index:1
1117 1184
search: P index:undefined
2109 975
search: က index:undefined
2093 971
search: က index:100
1050 1119

A further optimization about 250 ms would be to directly specify the argument to
remove ArgumentsLength() and _Arguments() but then
there need to be some way to fake the length property for the ecma spec.
Updated in StartsWith. I will make a new review for all other affected
functions.


https://codereview.chromium.org/1324353002/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to