Browse Source

SmalltalkMethodContext faster instatiation.

SmalltalkMethodContext is instatiated very often,
so having .resume in .prototype helps, memory/gc-wise
as well as performance-wise.
Herbert Vojčík 12 years ago
parent
commit
3c4820aa85
1 changed files with 6 additions and 6 deletions
  1. 6 6
      js/boot.js

+ 6 - 6
js/boot.js

@@ -581,12 +581,6 @@ function SmalltalkMethodContext(receiver, selector, method, temps, home) {
 	this.method      = method;
 	this.temps       = temps || {};
 	this.homeContext = home;
-
-    this.resume = function() {
-        //Brutally set the receiver as thisContext, then re-enter the function
-        smalltalk.thisContext = this;
-        return this.method.apply(receiver, temps);
-    };
 };
 
 SmalltalkMethodContext.prototype.copy = function() {
@@ -601,6 +595,12 @@ SmalltalkMethodContext.prototype.copy = function() {
 	);
 };
 
+SmalltalkMethodContext.prototype.resume = function() {
+    //Brutally set the receiver as thisContext, then re-enter the function
+    smalltalk.thisContext = this;
+    return this.method.apply(receiver, temps);
+};
+
 /* Global Smalltalk objects. */
 
 var nil = new SmalltalkNil();