12015-02-04 Filip Pizlo <fpizlo@apple.com>
2
3 Remove BytecodeGenerator::preserveLastVar() and replace it with a more robust mechanism for preserving non-temporary registers
4 https://bugs.webkit.org/show_bug.cgi?id=141211
5
6 Reviewed by NOBODY (OOPS!).
7
8 Previously, the way non-temporary registers were preserved (i.e. not reclaimed anytime
9 we did newTemporary()) by calling preserveLastVar() after all non-temps are created. It
10 would raise the refcount on the last (highest-numbered) variable created, and rely on
11 the fact that register reclamation started at higher-numbered registers and worked its
12 way down. So any retained register would block any lower-numbered registers from being
13 reclaimed.
14
15 Also, preserveLastVar() sets a thing called m_firstConstantIndex. It's unused.
16
17 This removes preserveLastVar() and makes addVar() retain each register it creates. This
18 is more explicit, since addVar() is the mechanism for creating non-temporary registers.
19
20 To make this work I had to remove an assertion that Register::setIndex() can only be
21 called when the refcount is zero. This method might be called after a var is created to
22 change its index. This previously worked because preserveLastVar() would be called after
23 we had already made all index changes, so the vars would still have refcount zero. Now
24 they have refcount 1. I think it's OK to lose this assertion; I can't remember this
25 assertion ever firing in a way that alerted me to a serious issue.
26
27 * bytecompiler/BytecodeGenerator.cpp:
28 (JSC::BytecodeGenerator::BytecodeGenerator):
29 (JSC::BytecodeGenerator::preserveLastVar): Deleted.
30 * bytecompiler/BytecodeGenerator.h:
31 (JSC::BytecodeGenerator::addVar):
32 * bytecompiler/RegisterID.h:
33 (JSC::RegisterID::setIndex):
34
352015-02-03 Filip Pizlo <fpizlo@apple.com>
36
37 Reviewed by NOBODY (OOPS!).
38
39 Also removes the localArgumentsRegister local variable in BytecodeGenerator's
40 constructor. It's not used.
41
42 * bytecompiler/BytecodeGenerator.cpp:
43 (JSC::BytecodeGenerator::BytecodeGenerator):
44 (JSC::BytecodeGenerator::preserveLastVar): Deleted.
45 * bytecompiler/BytecodeGenerator.h:
46 (JSC::BytecodeGenerator::addVar):
47