tree: dddfedbbca3f77a98fb87c74cca5fc7f43b1345d [path history] [tgz]
  1. base.h
  2. char-predicates-inl.h
  3. char-predicates.cc
  4. char-predicates.h
  5. flags.h
  6. gen-regexp-special-case.cc
  7. label.h
  8. memcopy.h
  9. README.md
  10. regexp-ast.cc
  11. regexp-ast.h
  12. regexp-bytecode-generator-inl.h
  13. regexp-bytecode-generator.cc
  14. regexp-bytecode-generator.h
  15. regexp-bytecodes-inl.h
  16. regexp-bytecodes.h
  17. regexp-compiler-tonode.cc
  18. regexp-compiler.cc
  19. regexp-compiler.h
  20. regexp-error.cc
  21. regexp-error.h
  22. regexp-flags.h
  23. regexp-interpreter.cc
  24. regexp-interpreter.h
  25. regexp-macro-assembler.cc
  26. regexp-macro-assembler.h
  27. regexp-nodes.h
  28. regexp-parser.cc
  29. regexp-parser.h
  30. regexp.cc
  31. regexp.h
  32. regexp_sources.gni
  33. regexp_test.cc
  34. small-vector.h
  35. special-case.cc
  36. special-case.h
  37. unibrow-inl.h
  38. unibrow.cc
  39. unibrow.h
  40. vector.h
  41. zone-containers.h
  42. zone-list-inl.h
  43. zone-list.h
runtime/vm/regexp/README.md

RegExp

Dart RegExp is defined to have the same behavior as JS RegExp so that the JS implementations of Dart can directly use the host JS RegExp engine. The Dart VM's implementation is taken from V8, which is called Irregexp.

The following are disabled

  • the atom matching optimization
  • the experimental implementation
  • the bytecode peephole optimization
  • the machine code implementations
  • tiering up and statistics counters
  • caching of matches
  • caching of regexp (though we do this in the VM at an earlier place)

To update

  • copy the files from v8/src/{regexp,base,zone,strings}/* to runtime/vm/regexp
    • most of these will become unused
  • update the includes to account for the new location
  • add includes of vm/regexp/base.h to get shims mapping many V8-isms to Dart-isms
  • remove or comment-out anything listed as disabled above
    • hopefully these will mostly be obvious from the diff from the previous port
  • map any remaining compile time errors from V8 things to Dart things
    • Handle -> String&
    • Handle -> RegExp&
    • Handle -> TypedData&

Note that all Dart strings are what V8 calls “flat”. We have no special String representations that delay concatenation or taking substrings. All Dart RegExp are also “unmodified”: users can't add/remove slots or replace methods.

The most recent update used v8 commit 254cc758346f10be2a7e22e55d90d4defe9cad74, which might be helpful for looking at a diff on the V8 side.