aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-05 18:04:06 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-05 18:04:06 +1000
commitf6a4dcf3871c6c5a4f9bdbfe699042dddbb8a62a (patch)
treeeae1e8dff2831fdfa32a5e98928a63f85223ff04 /src
parentc706c851f52c0b56a65dbaf74bafb66f36a9c521 (diff)
downloadfengari-f6a4dcf3871c6c5a4f9bdbfe699042dddbb8a62a.tar.gz
fengari-f6a4dcf3871c6c5a4f9bdbfe699042dddbb8a62a.tar.bz2
fengari-f6a4dcf3871c6c5a4f9bdbfe699042dddbb8a62a.zip
src/lvm.js: Remove special case
This makes it faster on my computer
Diffstat (limited to 'src')
-rw-r--r--src/lvm.js33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/lvm.js b/src/lvm.js
index 9e280c9..7c827a8 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -100,34 +100,27 @@ const RKC = function(L, base, k, i) {
const luaV_execute = function(L) {
let OCi = OC.OpCodesI;
let ci = L.ci;
- let specialCase = null; // To enable jump to specific opcode without reading current op/ra
let opcode, k, base, i, ra;
var cl;
ci.callstatus |= lstate.CIST_FRESH;
newframe:
for (;;) {
- if (specialCase) {
- opcode = specialCase;
- specialCase = null;
- } else {
- ci = L.ci;
- cl = ci.func.value;
- k = cl.p.k;
- base = ci.l_base;
-
- i = ci.l_savedpc[ci.pcOff++];
+ assert(ci === L.ci);
+ cl = ci.func.value;
+ k = cl.p.k;
+ base = ci.l_base;
- if (L.hookmask & (defs.LUA_MASKLINE | defs.LUA_MASKCOUNT)) {
- ldebug.luaG_traceexec(L);
- base = ci.l_base;
- }
+ i = ci.l_savedpc[ci.pcOff++];
-
- ra = RA(L, base, i);
- opcode = i.opcode;
+ if (L.hookmask & (defs.LUA_MASKLINE | defs.LUA_MASKCOUNT)) {
+ ldebug.luaG_traceexec(L);
+ base = ci.l_base;
}
+ ra = RA(L, base, i);
+ opcode = i.opcode;
+
if (i.breakpoint) // TODO: remove, used until lapi
return;
@@ -629,13 +622,13 @@ const luaV_execute = function(L) {
L.stack[cb] = L.stack[ra];
L.top = cb + 3; /* func. + 2 args (state and index) */
ldo.luaD_call(L, cb, i.C);
+ /* go straight to OP_TFORLOOP */
base = ci.l_base;
L.top = ci.top;
i = ci.l_savedpc[ci.pcOff++];
ra = RA(L, base, i);
assert(i.opcode === OCi.OP_TFORLOOP);
- specialCase = OCi.OP_TFORLOOP;
- break;
+ /* fall through */
}
case OCi.OP_TFORLOOP: {
if (!L.stack[ra + 1].ttisnil()) { /* continue loop? */