Permalink
Browse files

singleton pause object to reduce allocation

  • Loading branch information...
1 parent b788e1b commit 0ad456d380937ee9567ad67e208c69006f5564af Danny Yoo committed Mar 2, 2012
Showing with 6 additions and 5 deletions.
  1. +5 −4 js-assembler/runtime-src/runtime.js
  2. +1 −1 version.rkt
@@ -488,11 +488,12 @@
var Pause = function(onPause) {
// onPause: MACHINE -> void
- this.onPause = onPause || function(MACHINE) {};
+ this.onPause = onPause;
};
-
+ var THE_SINGLETON_PAUSE = new Pause();
var PAUSE = function(onPause) {
- throw(new Pause(onPause));
+ THE_SINGLETON_PAUSE.onPause = onPause;
+ throw(THE_SINGLETON_PAUSE);
};
@@ -564,7 +565,7 @@
scheduleTrampoline(that, thunk, release);
return;
}
- } else if (e instanceof Pause) {
+ } else if (e === THE_SINGLETON_PAUSE) {
var pauseLock = new ExclusiveLock();
var oldArgcount = that.a;
var restarted = false;
View
@@ -7,4 +7,4 @@
(provide version)
(: version String)
-(define version "1.213")
+(define version "1.215")

0 comments on commit 0ad456d

Please sign in to comment.