mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 15:02:52 -05:00
Merge pull request #878 from davidaylaian/reduce-peekstack-calls
Optimize stepThread by reducing the number of calls to peekStack
This commit is contained in:
commit
4e933eed81
1 changed files with 2 additions and 3 deletions
|
@ -174,7 +174,8 @@ class Sequencer {
|
||||||
// A "null block" - empty branch.
|
// A "null block" - empty branch.
|
||||||
thread.popStack();
|
thread.popStack();
|
||||||
}
|
}
|
||||||
while (thread.peekStack()) {
|
// Save the current block ID to notice if we did control flow.
|
||||||
|
while ((currentBlockId = thread.peekStack()) !== 0) {
|
||||||
let isWarpMode = thread.peekStackFrame().warpMode;
|
let isWarpMode = thread.peekStackFrame().warpMode;
|
||||||
if (isWarpMode && !thread.warpTimer) {
|
if (isWarpMode && !thread.warpTimer) {
|
||||||
// Initialize warp-mode timer if it hasn't been already.
|
// Initialize warp-mode timer if it hasn't been already.
|
||||||
|
@ -183,8 +184,6 @@ class Sequencer {
|
||||||
thread.warpTimer.start();
|
thread.warpTimer.start();
|
||||||
}
|
}
|
||||||
// Execute the current block.
|
// Execute the current block.
|
||||||
// Save the current block ID to notice if we did control flow.
|
|
||||||
currentBlockId = thread.peekStack();
|
|
||||||
if (this.runtime.profiler !== null) {
|
if (this.runtime.profiler !== null) {
|
||||||
if (executeProfilerId === -1) {
|
if (executeProfilerId === -1) {
|
||||||
executeProfilerId = this.runtime.profiler.idByName(executeProfilerFrame);
|
executeProfilerId = this.runtime.profiler.idByName(executeProfilerFrame);
|
||||||
|
|
Loading…
Reference in a new issue