| 1 | '''List of tasks in no order -- pick one, tell everyone what you're doing: |
| 2 | ''' |
| 3 | |
| 4 | '''Geoff is planning on: |
| 5 | ''' |
| 6 | |
| 7 | Implement closures |
| 8 | |
| 9 | Arguments object |
| 10 | |
| 11 | Implement dynamic scope required by "with" (just like closures, but the activation doesn't need to be saved on return) |
| 12 | |
| 13 | Function calls to native functions (requires revamping the List class to be an alias to the register file -- Geoff has some ideas for making this fast) |
| 14 | |
| 15 | '''You could take something from Geoff, or make something up yourself, or do one of these:''' |
| 16 | |
| 17 | Make everything work with a switch statement, based on macros -- for the sake of platforms without computed goto |
| 18 | |
| 19 | Statically detect presence of "with" and/or "catch" in the parser (required for correct scope chain behavior) |
| 20 | |
| 21 | Implement more "emitCode" functions, along with support in the CodeGenerator and the Machine. IfNode would be a good place to start. |
| 22 | |
| 23 | Make const work -- const info has to go in the symbol table, so writes to const vars can turn to no-ops at compile time. |
| 24 | |
| 25 | Make global code work, including: |
| 26 | |
| 27 | {{{ |
| 28 | global code should only emit "overwrite var with undefined" if the var doesn't exist already. |
| 29 | Global code needs to deal with new vars being added. Stupid solution: always allocate a new vector, add new, then copy old. Better solution: provide pre-capacity to the existing vector. Alternative solution: just renumber the vars -- does any code depend on the old numbers? |
| 30 | }}} |
| 31 | |
| 32 | |
| 33 | Zero-cost exception handling, using a table. |
| 34 | |
| 35 | Function call should store offset of R, not R, since vector may reallocate. This probably solves most problems related to new evaluations in same global object, since they all occur beneath function calls |
| 36 | -- arguments object also holds a pointer into the register file -- probably needs to be indirect index, instead |
| 37 | -- activation objects also hold pointers into the register file -- ditto |
| 38 | -- lists, if we decide not to make them copy |
| 39 | |
| 40 | Current function is in the register file -- gets marked automatically, marks the CodeBlock's constant pool |
| 41 | |
| 42 | Must mark register file -- probably use zero fill plus type tagging to get it right |
| 43 | |
| 44 | Pointers to registers and labels become invalid if the register or label vector resizes. |
| 45 | |
| 46 | GC mark for constant pools |
| 47 | |
| 48 | GC mark for possibly uninitialized register file |
| 49 | |
| 50 | Add relevant files to AllInOneFile.cpp. |
| 51 | |
| 52 | remove irrelevent files |
| 53 | |
| 54 | What things should go in dedicated local variables? CodeBlock::jsValues? CodeBlock::identifiers? |
| 55 | |
| 56 | VarStatementNode should just be nixed in favor of AssignmentNode. |
| 57 | |
| 58 | Remove ::execute, ::evaluate, ::optimizeVariableAccess |
| 59 | |
| 60 | |
| 61 | Future optimizations: |
| 62 | |
| 63 | Tile matching algorithm for emitting faster patterns of code |
| 64 | |
| 65 | The introduction of op_new_func, op_call, and op_ret regressed the simple for loop tests by about 25%. Seems to have to do with the fact that these opcodes call arbitrary external functions. |
| 66 | |
| 67 | Use RefPtr to indicate use of register -- moves to un-refed registers should be stripped or consolidated to other instructions. |
| 68 | - i++ => ++i |
| 69 | - less, jtrue => jless |
| 70 | |
| 71 | emit actual instructions for var and function initialization -- often, there will be 0; often, the var initialization will be dead code. any read of variable before init can statically become "load undefined". |
| 72 | |
| 73 | a single run of SunSpider performs 1,191,803 var initializations |
| 74 | |
| 75 | -1 means "never happend" |
| 76 | |
| 77 | var buckets: [846461] [40445] [350197] [9412] [7531] [50] [9] [178] [35000] [3] [1022] [3] [4499] [-1] [1353] [-1] [-1] [1851] [-1] [0] [-1] [0] [-1] [0] [-1] [0] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] |
| 78 | |
| 79 | fun buckets: [1297008] [7] [3] [2] [1] [0] [-1] [0] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [0] [-1] [1] [-1] [-1] [0] [-1] [0] [-1] [-1] [-1] [-1] [-1] [999] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] [-1] ] |
| 80 | |
| 81 | for resolve-evaluate-put, we can have a { DontCare, Clean, Dirty } switch -- get slot and if DontCare, set clean, evaluate, set slot if clean |
| 82 | |
| 83 | instead of branching to see if you've emitted code, just start out with a stub that does that emitting when invoked. |
| 84 | |
| 85 | single, shared constant pool |
| 86 | |
| 87 | At least for loops with fewer iterations it would probably be a win to duplicate the loop condition at the start and end of the loop |
| 88 | |
| 89 | Perhaps we should have a distinguished "condition code" register for expressions in a boolean context. For relational and logical operators we can output directly to the condition code register, for other opcodes you get an extra instruction. Jump instructions can read implicitly from the condition code. That avoids the less writing to r0, it just puts a bool in the condition code register. |
| 90 | |
| 91 | Can't you just make all opcodes have variants that use constant table operands directly? |
| 92 | |
| 93 | A named function expression can just enter its name into the symbol table instead of adding an object to the scope chain. |
| 94 | |
| 95 | Shrink instructions -- usually, don't need a whole word to store int values. Perhaps use tagging of opcodes to encode the first operand. Special work-around instructions when whole words are needed |
| 96 | |