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:
parent
2504a604cb
commit
3c4820aa85
12
js/boot.js
12
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();
|
||||
|
|
Loading…
Reference in New Issue