Fix major compatibility layer performance issue after incomplete removal of thread.warp

This commit is contained in:
Thomas Weber committed 2021-12-24 10:58:28 -06:00
1 parent 5c8db76257
commit 04592fbcfb
2 files changed
+4 -5

No files matched your search

+3 -4
View File
@@ -134,13 +134,12 @@ const waitPromise = function*(promise) {
return returnValue;
};
const executeInCompatibilityLayer = function*(inputs, blockFunction, useFlags) {
const executeInCompatibilityLayer = function*(inputs, blockFunction, isWarp, useFlags) {
const thread = globalState.thread;
// reset the stackframe
// we only ever use one stackframe at a time, so this shouldn't cause issues
// we assume warp mode is disabled; it doesn't actually matter what we set it to
thread.stackFrames[thread.stackFrames.length - 1].reuse(false);
thread.stackFrames[thread.stackFrames.length - 1].reuse(isWarp);
const executeBlock = () => {
const compatibilityLayerBlockUtility = globalState.compatibilityLayerBlockUtility;
@@ -171,7 +170,7 @@ const executeInCompatibilityLayer = function*(inputs, blockFunction, useFlags) {
if (thread.status === 2 /* STATUS_YIELD */) {
thread.status = 0; // STATUS_RUNNING
// Yield back to the event loop when stuck or not in warp mode.
if (thread.warp === 0 || isStuck()) {
if (!isWarp || isStuck()) {
yield;
}
} else {
+1 -1
View File
@@ -1159,7 +1159,7 @@ class JSGenerator {
result += `"${sanitize(fieldName)}":"${sanitize(field)}",`;
}
const opcodeFunction = this.evaluateOnce(`runtime.getOpcodeFunction("${sanitize(opcode)}")`);
result += `}, ${opcodeFunction}, ${setFlags})`;
result += `}, ${opcodeFunction}, ${this.isWarp}, ${setFlags})`;
return result;
}