Created
September 15, 2011 23:45
-
-
Save Constellation/1220820 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| V8の実装は, | |
| StringがSeqString or ConsString | |
| Consはleft / rightのStringへのptrを持っているという形, つまり, | |
| "STRING" + "STR" + "STR2" | |
| はparse時連結をしないとすると, | |
| ConsString -> first ConsString -> first SeqString["STRING"] | |
| -> second SeqString["STR"] | |
| -> second SeqString["STR2"] | |
| となります. | |
| 連結時は, これを再帰的にめぐることで連結できます. objects-inl.h / objects.cc | |
| これを平たくするのを, Flatというので, Flatでgrepかけると「ああー」というのが見れます. | |
| JSCは | |
| JSString 3 slots | |
| [ RopeOrFiber RopeOrFiber RopeOrFiber ] | |
| で, RopeはRopeOrFiberの配列を持っているという形です. | |
| Fiberは単なるStringです. 3段重ねです. 例えば, | |
| "S1" + "S2" + "S3" + "S4" + "S5" + "S6; | |
| の場合, | |
| JSString | |
| [ | |
| Rope => ["S1" "S2" "S3" "S4"] | |
| Fiber=>"S5" | |
| Fiber=>"S6" | |
| ] | |
| となります. | |
| lv5はJSCの実装を参考に実装しています. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment