summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-12 15:18:42 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-12 16:54:54 +1000
commitf47e66cf8d6e433a1036113a69ec421966d3509c (patch)
treeb00212eb487b4d1e0eccb394c1dbc69395708f72 /src
parent7b9be30e478d09e3bf533b445584107f65c5fdbc (diff)
downloadfengari-f47e66cf8d6e433a1036113a69ec421966d3509c.tar.gz
fengari-f47e66cf8d6e433a1036113a69ec421966d3509c.tar.bz2
fengari-f47e66cf8d6e433a1036113a69ec421966d3509c.zip
src/ldo.js: Don't bother keeping around a pool of CallInfo objects
Diffstat (limited to 'src')
-rw-r--r--src/ldo.js37
-rw-r--r--src/lvm.js1
2 files changed, 14 insertions, 24 deletions
diff --git a/src/ldo.js b/src/ldo.js
index 23c5969..da110e7 100644
--- a/src/ldo.js
+++ b/src/ldo.js
@@ -47,7 +47,6 @@ const seterrorobj = function(L, errcode, oldtop) {
*/
const luaD_precall = function(L, off, nresults) {
let func = L.stack[off];
- let ci;
switch(func.type) {
case CT.LUA_TCCL:
@@ -55,18 +54,12 @@ const luaD_precall = function(L, off, nresults) {
let f = func.type === CT.LUA_TCCL ? func.value.f : func.value;
// next_ci
- if (L.ci.next) {
- L.ci = L.ci.next;
- ci = L.ci;
- } else {
- ci = new lstate.CallInfo(off);
- L.ci.next = ci;
- ci.previous = L.ci;
- ci.next = null;
-
- L.ci = ci;
- L.ciOff++;
- }
+ let ci = new lstate.CallInfo(off);
+ L.ci.next = ci;
+ ci.previous = L.ci;
+ ci.next = null;
+ L.ci = ci;
+ L.ciOff++;
ci.nresults = nresults;
ci.func = func;
@@ -99,18 +92,13 @@ const luaD_precall = function(L, off, nresults) {
}
// next_ci
- if (L.ci.next) {
- L.ci = L.ci.next;
- ci = L.ci;
- } else {
- ci = new lstate.CallInfo(off);
- L.ci.next = ci;
- ci.previous = L.ci;
- ci.next = null;
+ let ci = new lstate.CallInfo(off);
+ L.ci.next = ci;
+ ci.previous = L.ci;
+ ci.next = null;
+ L.ci = ci;
+ L.ciOff++;
- L.ci = ci;
- L.ciOff++;
- }
ci.nresults = nresults;
ci.func = func;
ci.funcOff = off;
@@ -140,6 +128,7 @@ const luaD_poscall = function(L, ci, firstResult, nres) {
let res = ci.funcOff;
L.ci = ci.previous;
+ L.ci.next = null;
L.ciOff--;
return moveresults(L, firstResult, res, nres, wanted);
};
diff --git a/src/lvm.js b/src/lvm.js
index d86b783..7483738 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -494,6 +494,7 @@ const luaV_execute = function(L) {
oci.l_savedpc = nci.l_savedpc;
oci.pcOff = nci.pcOff;
oci.callstatus |= lstate.CIST_TAIL;
+ oci.next = null;
L.ci = oci;
ci = L.ci;
L.ciOff--;