SmalltalkMethodContext faster instatiation.

SmalltalkMethodContext is instatiated very often,
so having .resume in .prototype helps, memory/gc-wise
as well as performance-wise.
This commit is contained in:
Herbert Vojčík 2012-12-03 22:33:13 +01:00
parent 2504a604cb
commit 3c4820aa85
1 changed files with 6 additions and 6 deletions

View File

@ -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();