Repository navigation
Commit ff36f6e
authored
perf(runtime): cache where a masking canary's native property writes land (#600)
* perf(runtime): cache the native setter a canary's property write runs
The masking canary setter looked a native property's name up along the
prototype chain on every write before running its setter. It now caches
the setter by the name written and the receiver's prototype. A hit
rechecks that the receiver and every prototype below the setter's owner
still lack the name, that each prototype up to the owner is the one the
entry was made with, and that the owner still has an accessor whose
setter was not forgotten. Native class prototypes get the per-name
recheck too: a [[Set]] that starts elsewhere with such a prototype as its
receiver defines a data property there without reaching its handlers. A
write of a name with no entry reads one line of name tags and makes no
V8 call.
TrySetNativeProperty splits into FindNativeSetter and RunNativeSetter, so
the setter can be cached. The handlers read the lifetime counters through
the isolate's canary state, StateForWrite takes the canary its caller
already has, and the flag that lets copies through the handlers is per
isolate instead of per thread.
getWrapperLifetimeStats() counts the hits as canaryCachedNativeWrites.
* fix(runtime): count a cached native write only when its setter ran
A cache entry whose NativeSetter was forgotten (JS assigned the name on
the prototype that declares it) still passes NativeWriteCache::Check,
since the owner keeps its accessor. RunNativeSetter then declines and
the write takes the slow path, but canaryCachedNativeWrites had
already been incremented. Increment it only after RunNativeSetter runs
the setter, and cover the forgotten-setter sequence with a spec.1 parent 77e9a79 commit ff36f6e
13 files changed
Lines changed: 839 additions & 79 deletions
File tree
- NativeScript/runtime
- TestFixtures/Marshalling
- TestRunner/app/tests
- docs
- knowledge
- types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| |||
217 | 221 | | |
218 | 222 | | |
219 | 223 | | |
| 224 | + | |
220 | 225 | | |
221 | 226 | | |
222 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
92 | 100 | | |
93 | | - | |
| 101 | + | |
94 | 102 | | |
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
107 | | - | |
108 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
109 | 113 | | |
110 | | - | |
| 114 | + | |
111 | 115 | | |
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
115 | | - | |
| 119 | + | |
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
| |||
127 | 131 | | |
128 | 132 | | |
129 | 133 | | |
130 | | - | |
| 134 | + | |
131 | 135 | | |
132 | 136 | | |
133 | 137 | | |
| |||
142 | 146 | | |
143 | 147 | | |
144 | 148 | | |
145 | | - | |
| 149 | + | |
146 | 150 | | |
147 | 151 | | |
148 | 152 | | |
| |||
1596 | 1600 | | |
1597 | 1601 | | |
1598 | 1602 | | |
1599 | | - | |
1600 | | - | |
1601 | | - | |
| 1603 | + | |
| 1604 | + | |
1602 | 1605 | | |
1603 | 1606 | | |
1604 | | - | |
| 1607 | + | |
1605 | 1608 | | |
1606 | | - | |
1607 | | - | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
1608 | 1617 | | |
1609 | 1618 | | |
1610 | | - | |
| 1619 | + | |
1611 | 1620 | | |
1612 | 1621 | | |
1613 | 1622 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| 271 | + | |
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| |||
0 commit comments