Browse Source

Inliner improvements

Nicolas Petton 12 years ago
parent
commit
c4cf26f527

+ 27 - 5
js/Compiler-AST.deploy.js

@@ -139,7 +139,7 @@ smalltalk.addMethod(
 "_left_",
 smalltalk.method({
 selector: "left:",
-fn: function (aNode){
+fn: function (aNode) {
 var self=this;
 (self['@left']=aNode);
 return self;}
@@ -512,7 +512,7 @@ smalltalk.addMethod(
 "_nonLocalReturn",
 smalltalk.method({
 selector: "nonLocalReturn",
-fn: function (){
+fn: function () {
 var self=this;
 return smalltalk.send(smalltalk.send(smalltalk.send(self, "_scope", []), "_isMethodScope", []), "_not", []);
 return self;}
@@ -523,7 +523,7 @@ smalltalk.addMethod(
 "_scope",
 smalltalk.method({
 selector: "scope",
-fn: function (){
+fn: function () {
 var self=this;
 return self['@scope'];
 return self;}
@@ -534,7 +534,7 @@ smalltalk.addMethod(
 "_scope_",
 smalltalk.method({
 selector: "scope:",
-fn: function (aLexicalScope){
+fn: function (aLexicalScope) {
 var self=this;
 (self['@scope']=aLexicalScope);
 return self;}
@@ -543,7 +543,7 @@ smalltalk.ReturnNode);
 
 
 
-smalltalk.addClass('SendNode', smalltalk.Node, ['selector', 'arguments', 'receiver', 'superSend'], 'Compiler-AST');
+smalltalk.addClass('SendNode', smalltalk.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
 smalltalk.addMethod(
 "_accept_",
 smalltalk.method({
@@ -590,6 +590,28 @@ return self;}
 }),
 smalltalk.SendNode);
 
+smalltalk.addMethod(
+"_index",
+smalltalk.method({
+selector: "index",
+fn: function () {
+var self=this;
+return self['@index'];
+return self;}
+}),
+smalltalk.SendNode);
+
+smalltalk.addMethod(
+"_index_",
+smalltalk.method({
+selector: "index:",
+fn: function (anInteger) {
+var self=this;
+(self['@index']=anInteger);
+return self;}
+}),
+smalltalk.SendNode);
+
 smalltalk.addMethod(
 "_isSendNode",
 smalltalk.method({

+ 37 - 5
js/Compiler-AST.js

@@ -201,7 +201,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "left:",
 category: 'accessing',
-fn: function (aNode){
+fn: function (aNode) {
 var self=this;
 (self['@left']=aNode);
 return self;},
@@ -734,7 +734,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "nonLocalReturn",
 category: 'testing',
-fn: function (){
+fn: function () {
 var self=this;
 return smalltalk.send(smalltalk.send(smalltalk.send(self, "_scope", []), "_isMethodScope", []), "_not", []);
 return self;},
@@ -750,7 +750,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "scope",
 category: 'accessing',
-fn: function (){
+fn: function () {
 var self=this;
 return self['@scope'];
 return self;},
@@ -766,7 +766,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "scope:",
 category: 'accessing',
-fn: function (aLexicalScope){
+fn: function (aLexicalScope) {
 var self=this;
 (self['@scope']=aLexicalScope);
 return self;},
@@ -779,7 +779,7 @@ smalltalk.ReturnNode);
 
 
 
-smalltalk.addClass('SendNode', smalltalk.Node, ['selector', 'arguments', 'receiver', 'superSend'], 'Compiler-AST');
+smalltalk.addClass('SendNode', smalltalk.Node, ['selector', 'arguments', 'receiver', 'superSend', 'index'], 'Compiler-AST');
 smalltalk.addMethod(
 "_accept_",
 smalltalk.method({
@@ -846,6 +846,38 @@ referencedClasses: ["SendNode", "Array", "CascadeNode"]
 }),
 smalltalk.SendNode);
 
+smalltalk.addMethod(
+"_index",
+smalltalk.method({
+selector: "index",
+category: 'accessing',
+fn: function () {
+var self=this;
+return self['@index'];
+return self;},
+args: [],
+source: "index\x0a\x09^ index",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.SendNode);
+
+smalltalk.addMethod(
+"_index_",
+smalltalk.method({
+selector: "index:",
+category: 'accessing',
+fn: function (anInteger) {
+var self=this;
+(self['@index']=anInteger);
+return self;},
+args: ["anInteger"],
+source: "index: anInteger\x0a\x09index := anInteger",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.SendNode);
+
 smalltalk.addMethod(
 "_isSendNode",
 smalltalk.method({

File diff suppressed because it is too large
+ 57 - 35
js/Compiler-IR.deploy.js


File diff suppressed because it is too large
+ 69 - 37
js/Compiler-IR.js


+ 30 - 32
js/Compiler-Inlining.deploy.js

@@ -4,7 +4,7 @@ smalltalk.addMethod(
 "_accept_",
 smalltalk.method({
 selector: "accept:",
-fn: function (aVisitor){
+fn: function (aVisitor) {
 var self=this;
 return smalltalk.send(aVisitor, "_visitIRInlinedAssignment_", [self]);
 return self;}
@@ -15,7 +15,7 @@ smalltalk.addMethod(
 "_isInlined",
 smalltalk.method({
 selector: "isInlined",
-fn: function (){
+fn: function () {
 var self=this;
 return true;
 return self;}
@@ -51,7 +51,7 @@ smalltalk.addMethod(
 "_assignTo_",
 smalltalk.method({
 selector: "assignTo:",
-fn: function (aScopeVar){
+fn: function (aScopeVar) {
 var self=this;
 (self['@assignTo']=aScopeVar);
 return self;}
@@ -62,7 +62,7 @@ smalltalk.addMethod(
 "_isInlined",
 smalltalk.method({
 selector: "isInlined",
-fn: function (){
+fn: function () {
 var self=this;
 return true;
 return self;}
@@ -76,7 +76,7 @@ smalltalk.addMethod(
 "_accept_",
 smalltalk.method({
 selector: "accept:",
-fn: function (aVisitor){
+fn: function (aVisitor) {
 var self=this;
 return smalltalk.send(aVisitor, "_visitIRInlinedNonLocalReturn_", [self]);
 return self;}
@@ -87,7 +87,7 @@ smalltalk.addMethod(
 "_isInlined",
 smalltalk.method({
 selector: "isInlined",
-fn: function (){
+fn: function () {
 var self=this;
 return true;
 return self;}
@@ -112,7 +112,7 @@ smalltalk.addMethod(
 "_isInlined",
 smalltalk.method({
 selector: "isInlined",
-fn: function (){
+fn: function () {
 var self=this;
 return true;
 return self;}
@@ -126,7 +126,7 @@ smalltalk.addMethod(
 "_accept_",
 smalltalk.method({
 selector: "accept:",
-fn: function (aVisitor){
+fn: function (aVisitor) {
 var self=this;
 smalltalk.send(aVisitor, "_visitIRInlinedIfFalse_", [self]);
 return self;}
@@ -176,7 +176,7 @@ smalltalk.addMethod(
 "_shouldInlineAssignment_",
 smalltalk.method({
 selector: "shouldInlineAssignment:",
-fn: function (anIRAssignment){
+fn: function (anIRAssignment) {
 var self=this;
 return smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment, "_isInlined", []), "_not", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_last", []), "_isSend", []), "_and_", [(function(){return smalltalk.send(self, "_shouldInlineSend_", [smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_last", [])]);})]);})]);
 return self;}
@@ -187,7 +187,7 @@ smalltalk.addMethod(
 "_shouldInlineSend_",
 smalltalk.method({
 selector: "shouldInlineSend:",
-fn: function (anIRSend){
+fn: function (anIRSend) {
 var self=this;
 return smalltalk.send(smalltalk.send(smalltalk.send(anIRSend, "_isInlined", []), "_not", []), "_and_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.IRSendInliner || IRSendInliner), "_inlinedSelectors", []), "_includes_", [smalltalk.send(anIRSend, "_selector", [])]);})]);
 return self;}
@@ -198,7 +198,7 @@ smalltalk.addMethod(
 "_visitIRAssignment_",
 smalltalk.method({
 selector: "visitIRAssignment:",
-fn: function (anIRAssignment){
+fn: function (anIRAssignment) {
 var self=this;
 ((($receiver = smalltalk.send(self, "_shouldInlineAssignment_", [anIRAssignment])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_assignmentInliner", []), "_inlineAssignment_", [anIRAssignment]);})() : (function(){return smalltalk.send(self, "_visitIRAssignment_", [anIRAssignment], smalltalk.IRInliner.superclass || nil);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_assignmentInliner", []), "_inlineAssignment_", [anIRAssignment]);}), (function(){return smalltalk.send(self, "_visitIRAssignment_", [anIRAssignment], smalltalk.IRInliner.superclass || nil);})]));
 return self;}
@@ -209,7 +209,7 @@ smalltalk.addMethod(
 "_visitIRNonLocalReturn_",
 smalltalk.method({
 selector: "visitIRNonLocalReturn:",
-fn: function (anIRNonLocalReturn){
+fn: function (anIRNonLocalReturn) {
 var self=this;
 var localReturn=nil;
 ((($receiver = smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_scope", []), "_canInlineNonLocalReturns", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_scope", []), "_methodScope", []), "_removeNonLocalReturn_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);(localReturn=(function($rec){smalltalk.send($rec, "_scope_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn), "_new", [])));smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_instructions", []), "_do_", [(function(each){return smalltalk.send(localReturn, "_add_", [each]);})]);return smalltalk.send(anIRNonLocalReturn, "_replaceWith_", [localReturn]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_scope", []), "_methodScope", []), "_removeNonLocalReturn_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);(localReturn=(function($rec){smalltalk.send($rec, "_scope_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn), "_new", [])));smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_instructions", []), "_do_", [(function(each){return smalltalk.send(localReturn, "_add_", [each]);})]);return smalltalk.send(anIRNonLocalReturn, "_replaceWith_", [localReturn]);})]));
@@ -222,7 +222,7 @@ smalltalk.addMethod(
 "_visitIRSend_",
 smalltalk.method({
 selector: "visitIRSend:",
-fn: function (anIRSend){
+fn: function (anIRSend) {
 var self=this;
 ((($receiver = smalltalk.send(self, "_shouldInlineSend_", [anIRSend])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_sendInliner", []), "_inlineSend_", [anIRSend]);})() : (function(){return smalltalk.send(self, "_visitIRSend_", [anIRSend], smalltalk.IRInliner.superclass || nil);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_sendInliner", []), "_inlineSend_", [anIRSend]);}), (function(){return smalltalk.send(self, "_visitIRSend_", [anIRSend], smalltalk.IRInliner.superclass || nil);})]));
 return self;}
@@ -236,7 +236,7 @@ smalltalk.addMethod(
 "_visitIRInlinedAssignment_",
 smalltalk.method({
 selector: "visitIRInlinedAssignment:",
-fn: function (anIRInlinedAssignment){
+fn: function (anIRInlinedAssignment) {
 var self=this;
 smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedAssignment, "_instructions", []), "_last", [])]);
 return self;}
@@ -247,11 +247,9 @@ smalltalk.addMethod(
 "_visitIRInlinedClosure_",
 smalltalk.method({
 selector: "visitIRInlinedClosure:",
-fn: function (anIRInlinedClosure){
+fn: function (anIRInlinedClosure) {
 var self=this;
-smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_allButLast", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
-((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_notNil", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_last", []), "_canBeAssigned", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_variable", []), "_alias", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_variable", []), "_alias", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);})]));
-smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_last", [])]);
+smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_ifNotEmpty_", [(function(){smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_allButLast", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_notNil", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_last", []), "_canBeAssigned", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_variable", []), "_alias", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_variable", []), "_alias", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);})]));return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_last", [])]);})]);
 return self;}
 }),
 smalltalk.IRInliningJSTranslator);
@@ -260,9 +258,9 @@ smalltalk.addMethod(
 "_visitIRInlinedIfFalse_",
 smalltalk.method({
 selector: "visitIRInlinedIfFalse:",
-fn: function (anIRInlinedIfFalse){
+fn: function (anIRInlinedIfFalse) {
 var self=this;
-smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["!"]);return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_first", [])]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_last", [])]);})]);
+smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["! smalltalk.assert("]);smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_first", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [")"]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_last", [])]);})]);
 return self;}
 }),
 smalltalk.IRInliningJSTranslator);
@@ -271,9 +269,9 @@ smalltalk.addMethod(
 "_visitIRInlinedIfTrue_",
 smalltalk.method({
 selector: "visitIRInlinedIfTrue:",
-fn: function (anIRInlinedIfTrue){
+fn: function (anIRInlinedIfTrue) {
 var self=this;
-smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_first", [])]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_last", [])]);})]);
+smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["smalltalk.assert("]);smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_first", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [")"]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_last", [])]);})]);
 return self;}
 }),
 smalltalk.IRInliningJSTranslator);
@@ -285,7 +283,7 @@ smalltalk.addMethod(
 "_ifFalse_",
 smalltalk.method({
 selector: "ifFalse:",
-fn: function (anIRInstruction){
+fn: function (anIRInstruction) {
 var self=this;
 var inlinedSend=nil;
 var inlinedClosure=nil;
@@ -304,7 +302,7 @@ smalltalk.addMethod(
 "_ifTrue_",
 smalltalk.method({
 selector: "ifTrue:",
-fn: function (anIRInstruction){
+fn: function (anIRInstruction) {
 var self=this;
 var inlinedSend=nil;
 var inlinedClosure=nil;
@@ -323,7 +321,7 @@ smalltalk.addMethod(
 "_inlineClosure_",
 smalltalk.method({
 selector: "inlineClosure:",
-fn: function (anIRClosure){
+fn: function (anIRClosure) {
 var self=this;
 var inlinedClosure=nil;
 (inlinedClosure=smalltalk.send(self, "_inlinedClosure", []));
@@ -338,7 +336,7 @@ smalltalk.addMethod(
 "_inlineSend_",
 smalltalk.method({
 selector: "inlineSend:",
-fn: function (anIRSend){
+fn: function (anIRSend) {
 var self=this;
 smalltalk.send(self, "_send_", [anIRSend]);
 smalltalk.send(self, "_perform_withArguments_", [smalltalk.send(smalltalk.send(self, "_send", []), "_selector", []), smalltalk.send(smalltalk.send(smalltalk.send(self, "_send", []), "_instructions", []), "_allButFirst", [])]);
@@ -350,7 +348,7 @@ smalltalk.addMethod(
 "_inlinedClosure",
 smalltalk.method({
 selector: "inlinedClosure",
-fn: function (){
+fn: function () {
 var self=this;
 return smalltalk.send((smalltalk.IRInlinedClosure || IRInlinedClosure), "_new", []);
 return self;}
@@ -417,7 +415,7 @@ smalltalk.addMethod(
 "_inlinedSelectors",
 smalltalk.method({
 selector: "inlinedSelectors",
-fn: function (){
+fn: function () {
 var self=this;
 return ["ifTrue:", "ifFalse:"];
 return self;}
@@ -452,7 +450,7 @@ smalltalk.addMethod(
 "_inlineAssignment_",
 smalltalk.method({
 selector: "inlineAssignment:",
-fn: function (anIRAssignment){
+fn: function (anIRAssignment) {
 var self=this;
 var inlinedAssignment=nil;
 smalltalk.send(self, "_assignment_", [anIRAssignment]);
@@ -469,7 +467,7 @@ smalltalk.addMethod(
 "_inlinedClosure",
 smalltalk.method({
 selector: "inlinedClosure",
-fn: function (){
+fn: function () {
 var self=this;
 return (function($rec){smalltalk.send($rec, "_assignTo_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_assignment", []), "_instructions", []), "_first", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_inlinedClosure", [], smalltalk.IRAssignmentInliner.superclass || nil));
 return self;}
@@ -483,7 +481,7 @@ smalltalk.addMethod(
 "_compileNode_",
 smalltalk.method({
 selector: "compileNode:",
-fn: function (aNode){
+fn: function (aNode) {
 var self=this;
 var ir=nil;
 var stream=nil;
@@ -499,7 +497,7 @@ smalltalk.addMethod(
 "_inliner",
 smalltalk.method({
 selector: "inliner",
-fn: function (){
+fn: function () {
 var self=this;
 return smalltalk.send((smalltalk.IRInliner || IRInliner), "_new", []);
 return self;}

+ 35 - 37
js/Compiler-Inlining.js

@@ -5,7 +5,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "accept:",
 category: 'visiting',
-fn: function (aVisitor){
+fn: function (aVisitor) {
 var self=this;
 return smalltalk.send(aVisitor, "_visitIRInlinedAssignment_", [self]);
 return self;},
@@ -21,7 +21,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "isInlined",
 category: 'testing',
-fn: function (){
+fn: function () {
 var self=this;
 return true;
 return self;},
@@ -72,7 +72,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "assignTo:",
 category: 'accessing',
-fn: function (aScopeVar){
+fn: function (aScopeVar) {
 var self=this;
 (self['@assignTo']=aScopeVar);
 return self;},
@@ -88,7 +88,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "isInlined",
 category: 'testing',
-fn: function (){
+fn: function () {
 var self=this;
 return true;
 return self;},
@@ -107,7 +107,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "accept:",
 category: 'visiting',
-fn: function (aVisitor){
+fn: function (aVisitor) {
 var self=this;
 return smalltalk.send(aVisitor, "_visitIRInlinedNonLocalReturn_", [self]);
 return self;},
@@ -123,7 +123,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "isInlined",
 category: 'testing',
-fn: function (){
+fn: function () {
 var self=this;
 return true;
 return self;},
@@ -158,7 +158,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "isInlined",
 category: 'testing',
-fn: function (){
+fn: function () {
 var self=this;
 return true;
 return self;},
@@ -177,7 +177,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "accept:",
 category: 'visiting',
-fn: function (aVisitor){
+fn: function (aVisitor) {
 var self=this;
 smalltalk.send(aVisitor, "_visitIRInlinedIfFalse_", [self]);
 return self;},
@@ -247,7 +247,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "shouldInlineAssignment:",
 category: 'testing',
-fn: function (anIRAssignment){
+fn: function (anIRAssignment) {
 var self=this;
 return smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment, "_isInlined", []), "_not", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_last", []), "_isSend", []), "_and_", [(function(){return smalltalk.send(self, "_shouldInlineSend_", [smalltalk.send(smalltalk.send(anIRAssignment, "_instructions", []), "_last", [])]);})]);})]);
 return self;},
@@ -263,7 +263,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "shouldInlineSend:",
 category: 'testing',
-fn: function (anIRSend){
+fn: function (anIRSend) {
 var self=this;
 return smalltalk.send(smalltalk.send(smalltalk.send(anIRSend, "_isInlined", []), "_not", []), "_and_", [(function(){return smalltalk.send(smalltalk.send((smalltalk.IRSendInliner || IRSendInliner), "_inlinedSelectors", []), "_includes_", [smalltalk.send(anIRSend, "_selector", [])]);})]);
 return self;},
@@ -279,7 +279,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "visitIRAssignment:",
 category: 'visiting',
-fn: function (anIRAssignment){
+fn: function (anIRAssignment) {
 var self=this;
 ((($receiver = smalltalk.send(self, "_shouldInlineAssignment_", [anIRAssignment])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_assignmentInliner", []), "_inlineAssignment_", [anIRAssignment]);})() : (function(){return smalltalk.send(self, "_visitIRAssignment_", [anIRAssignment], smalltalk.IRInliner.superclass || nil);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_assignmentInliner", []), "_inlineAssignment_", [anIRAssignment]);}), (function(){return smalltalk.send(self, "_visitIRAssignment_", [anIRAssignment], smalltalk.IRInliner.superclass || nil);})]));
 return self;},
@@ -295,7 +295,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "visitIRNonLocalReturn:",
 category: 'visiting',
-fn: function (anIRNonLocalReturn){
+fn: function (anIRNonLocalReturn) {
 var self=this;
 var localReturn=nil;
 ((($receiver = smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_scope", []), "_canInlineNonLocalReturns", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_scope", []), "_methodScope", []), "_removeNonLocalReturn_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);(localReturn=(function($rec){smalltalk.send($rec, "_scope_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn), "_new", [])));smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_instructions", []), "_do_", [(function(each){return smalltalk.send(localReturn, "_add_", [each]);})]);return smalltalk.send(anIRNonLocalReturn, "_replaceWith_", [localReturn]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_scope", []), "_methodScope", []), "_removeNonLocalReturn_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);(localReturn=(function($rec){smalltalk.send($rec, "_scope_", [smalltalk.send(anIRNonLocalReturn, "_scope", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn), "_new", [])));smalltalk.send(smalltalk.send(anIRNonLocalReturn, "_instructions", []), "_do_", [(function(each){return smalltalk.send(localReturn, "_add_", [each]);})]);return smalltalk.send(anIRNonLocalReturn, "_replaceWith_", [localReturn]);})]));
@@ -313,7 +313,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "visitIRSend:",
 category: 'visiting',
-fn: function (anIRSend){
+fn: function (anIRSend) {
 var self=this;
 ((($receiver = smalltalk.send(self, "_shouldInlineSend_", [anIRSend])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(smalltalk.send(self, "_sendInliner", []), "_inlineSend_", [anIRSend]);})() : (function(){return smalltalk.send(self, "_visitIRSend_", [anIRSend], smalltalk.IRInliner.superclass || nil);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self, "_sendInliner", []), "_inlineSend_", [anIRSend]);}), (function(){return smalltalk.send(self, "_visitIRSend_", [anIRSend], smalltalk.IRInliner.superclass || nil);})]));
 return self;},
@@ -332,7 +332,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "visitIRInlinedAssignment:",
 category: 'visiting',
-fn: function (anIRInlinedAssignment){
+fn: function (anIRInlinedAssignment) {
 var self=this;
 smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedAssignment, "_instructions", []), "_last", [])]);
 return self;},
@@ -348,15 +348,13 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "visitIRInlinedClosure:",
 category: 'visiting',
-fn: function (anIRInlinedClosure){
+fn: function (anIRInlinedClosure) {
 var self=this;
-smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_allButLast", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);
-((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_notNil", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_last", []), "_canBeAssigned", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_variable", []), "_alias", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_variable", []), "_alias", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);})]));
-smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_last", [])]);
+smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_ifNotEmpty_", [(function(){smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_allButLast", []), "_do_", [(function(each){return smalltalk.send(self, "_visit_", [each]);})]);((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_notNil", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_last", []), "_canBeAssigned", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_variable", []), "_alias", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(anIRInlinedClosure, "_assignTo", []), "_variable", []), "_alias", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAssignment", []);})]));return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedClosure, "_instructions", []), "_last", [])]);})]);
 return self;},
 args: ["anIRInlinedClosure"],
-source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09anIRInlinedClosure instructions allButLast do: [ :each | self visit: each ].\x0a\x09(anIRInlinedClosure assignTo notNil and: [\x0a\x09\x09anIRInlinedClosure instructions last canBeAssigned ]) ifTrue: [\x0a\x09\x09\x09self stream nextPutAll: anIRInlinedClosure assignTo variable alias.\x0a\x09\x09\x09self stream nextPutAssignment ].\x0a\x09self visit: anIRInlinedClosure instructions last",
-messageSends: ["do:", "allButLast", "instructions", "visit:", "ifTrue:", "and:", "notNil", "assignTo", "canBeAssigned", "last", "nextPutAll:", "stream", "alias", "variable", "nextPutAssignment"],
+source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09anIRInlinedClosure instructions ifNotEmpty: [\x0a\x09\x09anIRInlinedClosure instructions allButLast do: [ :each | self visit: each ].\x0a\x09\x09(anIRInlinedClosure assignTo notNil and: [\x0a\x09\x09\x09anIRInlinedClosure instructions last canBeAssigned ]) ifTrue: [\x0a\x09\x09\x09\x09self stream nextPutAll: anIRInlinedClosure assignTo variable alias.\x0a\x09\x09\x09\x09self stream nextPutAssignment ].\x0a\x09\x09self visit: anIRInlinedClosure instructions last ]",
+messageSends: ["ifNotEmpty:", "instructions", "do:", "allButLast", "visit:", "ifTrue:", "and:", "notNil", "assignTo", "canBeAssigned", "last", "nextPutAll:", "stream", "alias", "variable", "nextPutAssignment"],
 referencedClasses: []
 }),
 smalltalk.IRInliningJSTranslator);
@@ -366,12 +364,12 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "visitIRInlinedIfFalse:",
 category: 'visiting',
-fn: function (anIRInlinedIfFalse){
+fn: function (anIRInlinedIfFalse) {
 var self=this;
-smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["!"]);return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_first", [])]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_last", [])]);})]);
+smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["! smalltalk.assert("]);smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_first", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [")"]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfFalse, "_instructions", []), "_last", [])]);})]);
 return self;},
 args: ["anIRInlinedIfFalse"],
-source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream \x0a\x09\x09nextPutIf: [ \x0a\x09\x09\x09self stream nextPutAll: '!'.\x0a\x09\x09\x09self visit: anIRInlinedIfFalse instructions first ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
+source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream \x0a\x09\x09nextPutIf: [ \x0a\x09\x09\x09self stream nextPutAll: '! smalltalk.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
 messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
 referencedClasses: []
 }),
@@ -382,13 +380,13 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "visitIRInlinedIfTrue:",
 category: 'visiting',
-fn: function (anIRInlinedIfTrue){
+fn: function (anIRInlinedIfTrue) {
 var self=this;
-smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_first", [])]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_last", [])]);})]);
+smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutIf_with_", [(function(){smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", ["smalltalk.assert("]);smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_first", [])]);return smalltalk.send(smalltalk.send(self, "_stream", []), "_nextPutAll_", [")"]);}), (function(){return smalltalk.send(self, "_visit_", [smalltalk.send(smalltalk.send(anIRInlinedIfTrue, "_instructions", []), "_last", [])]);})]);
 return self;},
 args: ["anIRInlinedIfTrue"],
-source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream \x0a\x09\x09nextPutIf: [ self visit: anIRInlinedIfTrue instructions first ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
-messageSends: ["nextPutIf:with:", "stream", "visit:", "first", "instructions", "last"],
+source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream \x0a\x09\x09nextPutIf: [ \x0a\x09\x09\x09self stream nextPutAll: 'smalltalk.assert('. \x0a\x09\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
+messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
 referencedClasses: []
 }),
 smalltalk.IRInliningJSTranslator);
@@ -402,7 +400,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "ifFalse:",
 category: 'inlining',
-fn: function (anIRInstruction){
+fn: function (anIRInstruction) {
 var self=this;
 var inlinedSend=nil;
 var inlinedClosure=nil;
@@ -426,7 +424,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "ifTrue:",
 category: 'inlining',
-fn: function (anIRInstruction){
+fn: function (anIRInstruction) {
 var self=this;
 var inlinedSend=nil;
 var inlinedClosure=nil;
@@ -450,7 +448,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "inlineClosure:",
 category: 'inlining',
-fn: function (anIRClosure){
+fn: function (anIRClosure) {
 var self=this;
 var inlinedClosure=nil;
 (inlinedClosure=smalltalk.send(self, "_inlinedClosure", []));
@@ -470,7 +468,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "inlineSend:",
 category: 'inlining',
-fn: function (anIRSend){
+fn: function (anIRSend) {
 var self=this;
 smalltalk.send(self, "_send_", [anIRSend]);
 smalltalk.send(self, "_perform_withArguments_", [smalltalk.send(smalltalk.send(self, "_send", []), "_selector", []), smalltalk.send(smalltalk.send(smalltalk.send(self, "_send", []), "_instructions", []), "_allButFirst", [])]);
@@ -487,7 +485,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "inlinedClosure",
 category: 'accessing',
-fn: function (){
+fn: function () {
 var self=this;
 return smalltalk.send((smalltalk.IRInlinedClosure || IRInlinedClosure), "_new", []);
 return self;},
@@ -584,7 +582,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "inlinedSelectors",
 category: 'accessing',
-fn: function (){
+fn: function () {
 var self=this;
 return ["ifTrue:", "ifFalse:"];
 return self;},
@@ -634,7 +632,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "inlineAssignment:",
 category: 'inlining',
-fn: function (anIRAssignment){
+fn: function (anIRAssignment) {
 var self=this;
 var inlinedAssignment=nil;
 smalltalk.send(self, "_assignment_", [anIRAssignment]);
@@ -656,7 +654,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "inlinedClosure",
 category: 'accessing',
-fn: function (){
+fn: function () {
 var self=this;
 return (function($rec){smalltalk.send($rec, "_assignTo_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_assignment", []), "_instructions", []), "_first", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_inlinedClosure", [], smalltalk.IRAssignmentInliner.superclass || nil));
 return self;},
@@ -675,7 +673,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "compileNode:",
 category: 'compiling',
-fn: function (aNode){
+fn: function (aNode) {
 var self=this;
 var ir=nil;
 var stream=nil;
@@ -696,7 +694,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "inliner",
 category: 'compiling',
-fn: function (){
+fn: function () {
 var self=this;
 return smalltalk.send((smalltalk.IRInliner || IRInliner), "_new", []);
 return self;},

+ 13 - 12
js/Compiler-Semantic.deploy.js

@@ -61,7 +61,7 @@ smalltalk.addMethod(
 "_canInlineNonLocalReturns",
 smalltalk.method({
 selector: "canInlineNonLocalReturns",
-fn: function (){
+fn: function () {
 var self=this;
 return smalltalk.send(smalltalk.send(self, "_isInlined", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_outerScope", []), "_canInlineNonLocalReturns", []);})]);
 return self;}
@@ -94,7 +94,7 @@ smalltalk.addMethod(
 "_isInlined",
 smalltalk.method({
 selector: "isInlined",
-fn: function (){
+fn: function () {
 var self=this;
 return smalltalk.send(smalltalk.send(self, "_instruction", []), "_isInlined", []);
 return self;}
@@ -233,7 +233,7 @@ smalltalk.addMethod(
 "_addNonLocalReturn_",
 smalltalk.method({
 selector: "addNonLocalReturn:",
-fn: function (aScope){
+fn: function (aScope) {
 var self=this;
 smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_add_", [aScope]);
 return self;}
@@ -266,7 +266,7 @@ smalltalk.addMethod(
 "_canInlineNonLocalReturns",
 smalltalk.method({
 selector: "canInlineNonLocalReturns",
-fn: function (){
+fn: function () {
 var self=this;
 return true;
 return self;}
@@ -377,7 +377,7 @@ smalltalk.addMethod(
 "_removeNonLocalReturn_",
 smalltalk.method({
 selector: "removeNonLocalReturn:",
-fn: function (aScope){
+fn: function (aScope) {
 var self=this;
 smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_remove_ifAbsent_", [aScope, (function(){return nil;})]);
 return self;}
@@ -736,7 +736,7 @@ smalltalk.method({
 selector: "messageSends",
 fn: function () {
 var self=this;
-return (($receiver = self['@messageSends']) == nil || $receiver == undefined) ? (function(){return (self['@messageSends']=smalltalk.send((smalltalk.Set || Set), "_new", []));})() : $receiver;
+return (($receiver = self['@messageSends']) == nil || $receiver == undefined) ? (function(){return (self['@messageSends']=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));})() : $receiver;
 return self;}
 }),
 smalltalk.SemanticAnalyzer);
@@ -845,7 +845,7 @@ smalltalk.addMethod(
 "_visitAssignmentNode_",
 smalltalk.method({
 selector: "visitAssignmentNode:",
-fn: function (aNode){
+fn: function (aNode) {
 var self=this;
 smalltalk.send(self, "_visitAssignmentNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
 smalltalk.send(smalltalk.send(aNode, "_left", []), "_beAssigned", []);
@@ -922,7 +922,7 @@ smalltalk.send(self['@currentScope'], "_node_", [aNode]);
 smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_allInstanceVariableNames", []), "_do_", [(function(each){return smalltalk.send(self['@currentScope'], "_addIVar_", [each]);})]);
 smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_", [(function(each){smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);})]);
 smalltalk.send(self, "_visitMethodNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
-(function($rec){smalltalk.send($rec, "_classReferences_", [smalltalk.send(self, "_classReferences", [])]);return smalltalk.send($rec, "_messageSends_", [smalltalk.send(self, "_messageSends", [])]);})(aNode);
+(function($rec){smalltalk.send($rec, "_classReferences_", [smalltalk.send(self, "_classReferences", [])]);return smalltalk.send($rec, "_messageSends_", [smalltalk.send(smalltalk.send(self, "_messageSends", []), "_keys", [])]);})(aNode);
 smalltalk.send(self, "_popScope", []);
 return self;}
 }),
@@ -932,10 +932,10 @@ smalltalk.addMethod(
 "_visitReturnNode_",
 smalltalk.method({
 selector: "visitReturnNode:",
-fn: function (aNode){
+fn: function (aNode) {
 var self=this;
 smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
-((($receiver = smalltalk.send(self['@currentScope'], "_isMethodScope", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);})]));
+((($receiver = smalltalk.send(self['@currentScope'], "_isMethodScope", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@currentScope'], "_localReturn_", [true]);})() : (function(){return smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@currentScope'], "_localReturn_", [true]);}), (function(){return smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);})]));
 smalltalk.send(self, "_visitReturnNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
 return self;}
 }),
@@ -945,10 +945,11 @@ smalltalk.addMethod(
 "_visitSendNode_",
 smalltalk.method({
 selector: "visitSendNode:",
-fn: function (aNode){
+fn: function (aNode) {
 var self=this;
 ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value", []), "__eq", ["super"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aNode, "_superSend_", [true]);return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value_", ["self"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(aNode, "_superSend_", [true]);return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value_", ["self"]);})]));
-smalltalk.send(smalltalk.send(self, "_messageSends", []), "_add_", [smalltalk.send(aNode, "_selector", [])]);
+smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_ifPresent_ifAbsent_", [smalltalk.send(aNode, "_selector", []), (function(){return smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_put_", [smalltalk.send(aNode, "_selector", []), ((($receiver = smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_", [smalltalk.send(aNode, "_selector", [])])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);}), (function(){return smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_put_", [smalltalk.send(aNode, "_selector", []), (1)]);})]);
+smalltalk.send(aNode, "_index_", [smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_", [smalltalk.send(aNode, "_selector", [])])]);
 smalltalk.send(self, "_visitSendNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
 return self;}
 }),

+ 21 - 20
js/Compiler-Semantic.js

@@ -88,7 +88,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "canInlineNonLocalReturns",
 category: 'testing',
-fn: function (){
+fn: function () {
 var self=this;
 return smalltalk.send(smalltalk.send(self, "_isInlined", []), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_outerScope", []), "_canInlineNonLocalReturns", []);})]);
 return self;},
@@ -136,7 +136,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "isInlined",
 category: 'testing',
-fn: function (){
+fn: function () {
 var self=this;
 return smalltalk.send(smalltalk.send(self, "_instruction", []), "_isInlined", []);
 return self;},
@@ -336,7 +336,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "addNonLocalReturn:",
 category: 'adding',
-fn: function (aScope){
+fn: function (aScope) {
 var self=this;
 smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_add_", [aScope]);
 return self;},
@@ -384,7 +384,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "canInlineNonLocalReturns",
 category: 'testing',
-fn: function (){
+fn: function () {
 var self=this;
 return true;
 return self;},
@@ -545,7 +545,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "removeNonLocalReturn:",
 category: 'adding',
-fn: function (aScope){
+fn: function (aScope) {
 var self=this;
 smalltalk.send(smalltalk.send(self, "_nonLocalReturns", []), "_remove_ifAbsent_", [aScope, (function(){return nil;})]);
 return self;},
@@ -1063,12 +1063,12 @@ selector: "messageSends",
 category: 'accessing',
 fn: function () {
 var self=this;
-return (($receiver = self['@messageSends']) == nil || $receiver == undefined) ? (function(){return (self['@messageSends']=smalltalk.send((smalltalk.Set || Set), "_new", []));})() : $receiver;
+return (($receiver = self['@messageSends']) == nil || $receiver == undefined) ? (function(){return (self['@messageSends']=smalltalk.send((smalltalk.Dictionary || Dictionary), "_new", []));})() : $receiver;
 return self;},
 args: [],
-source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Set new ]",
+source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
 messageSends: ["ifNil:", "new"],
-referencedClasses: ["Set"]
+referencedClasses: ["Dictionary"]
 }),
 smalltalk.SemanticAnalyzer);
 
@@ -1222,7 +1222,7 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "visitAssignmentNode:",
 category: 'visiting',
-fn: function (aNode){
+fn: function (aNode) {
 var self=this;
 smalltalk.send(self, "_visitAssignmentNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
 smalltalk.send(smalltalk.send(aNode, "_left", []), "_beAssigned", []);
@@ -1319,12 +1319,12 @@ smalltalk.send(self['@currentScope'], "_node_", [aNode]);
 smalltalk.send(smalltalk.send(smalltalk.send(self, "_theClass", []), "_allInstanceVariableNames", []), "_do_", [(function(each){return smalltalk.send(self['@currentScope'], "_addIVar_", [each]);})]);
 smalltalk.send(smalltalk.send(aNode, "_arguments", []), "_do_", [(function(each){smalltalk.send(self, "_validateVariableScope_", [each]);return smalltalk.send(self['@currentScope'], "_addArg_", [each]);})]);
 smalltalk.send(self, "_visitMethodNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
-(function($rec){smalltalk.send($rec, "_classReferences_", [smalltalk.send(self, "_classReferences", [])]);return smalltalk.send($rec, "_messageSends_", [smalltalk.send(self, "_messageSends", [])]);})(aNode);
+(function($rec){smalltalk.send($rec, "_classReferences_", [smalltalk.send(self, "_classReferences", [])]);return smalltalk.send($rec, "_messageSends_", [smalltalk.send(smalltalk.send(self, "_messageSends", []), "_keys", [])]);})(aNode);
 smalltalk.send(self, "_popScope", []);
 return self;},
 args: ["aNode"],
-source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [:each | \x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each | \x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode \x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09messageSends: self messageSends.\x0a\x09self popScope",
-messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "messageSends", "popScope"],
+source: "visitMethodNode: aNode\x0a\x09self pushScope: self newMethodScope.\x0a\x09aNode scope: currentScope.\x0a\x09currentScope node: aNode.\x0a\x0a\x09self theClass allInstanceVariableNames do: [:each | \x0a\x09\x09currentScope addIVar: each ].\x0a\x09aNode arguments do: [ :each | \x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addArg: each ].\x0a\x0a\x09super visitMethodNode: aNode.\x0a\x0a\x09aNode \x0a\x09\x09classReferences: self classReferences;\x0a\x09\x09messageSends: self messageSends keys.\x0a\x09self popScope",
+messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "messageSends:", "keys", "messageSends", "popScope"],
 referencedClasses: []
 }),
 smalltalk.SemanticAnalyzer);
@@ -1334,15 +1334,15 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "visitReturnNode:",
 category: 'visiting',
-fn: function (aNode){
+fn: function (aNode) {
 var self=this;
 smalltalk.send(aNode, "_scope_", [self['@currentScope']]);
-((($receiver = smalltalk.send(self['@currentScope'], "_isMethodScope", [])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);})]));
+((($receiver = smalltalk.send(self['@currentScope'], "_isMethodScope", [])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(self['@currentScope'], "_localReturn_", [true]);})() : (function(){return smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);})()) : smalltalk.send($receiver, "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self['@currentScope'], "_localReturn_", [true]);}), (function(){return smalltalk.send(smalltalk.send(self['@currentScope'], "_methodScope", []), "_addNonLocalReturn_", [self['@currentScope']]);})]));
 smalltalk.send(self, "_visitReturnNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
 return self;},
 args: ["aNode"],
-source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode",
-messageSends: ["scope:", "ifFalse:", "isMethodScope", "addNonLocalReturn:", "methodScope", "visitReturnNode:"],
+source: "visitReturnNode: aNode\x0a\x09aNode scope: currentScope.\x0a\x09currentScope isMethodScope\x0a\x09\x09ifTrue: [ currentScope localReturn: true ]\x0a\x09\x09ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].\x0a\x09super visitReturnNode: aNode",
+messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"],
 referencedClasses: []
 }),
 smalltalk.SemanticAnalyzer);
@@ -1352,15 +1352,16 @@ smalltalk.addMethod(
 smalltalk.method({
 selector: "visitSendNode:",
 category: 'visiting',
-fn: function (aNode){
+fn: function (aNode) {
 var self=this;
 ((($receiver = smalltalk.send(smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value", []), "__eq", ["super"])).klass === smalltalk.Boolean) ? ($receiver ? (function(){smalltalk.send(aNode, "_superSend_", [true]);return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value_", ["self"]);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(aNode, "_superSend_", [true]);return smalltalk.send(smalltalk.send(aNode, "_receiver", []), "_value_", ["self"]);})]));
-smalltalk.send(smalltalk.send(self, "_messageSends", []), "_add_", [smalltalk.send(aNode, "_selector", [])]);
+smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_ifPresent_ifAbsent_", [smalltalk.send(aNode, "_selector", []), (function(){return smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_put_", [smalltalk.send(aNode, "_selector", []), ((($receiver = smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_", [smalltalk.send(aNode, "_selector", [])])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);}), (function(){return smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_put_", [smalltalk.send(aNode, "_selector", []), (1)]);})]);
+smalltalk.send(aNode, "_index_", [smalltalk.send(smalltalk.send(self, "_messageSends", []), "_at_", [smalltalk.send(aNode, "_selector", [])])]);
 smalltalk.send(self, "_visitSendNode_", [aNode], smalltalk.SemanticAnalyzer.superclass || nil);
 return self;},
 args: ["aNode"],
-source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super' ifTrue: [\x0a\x09\x09aNode superSend: true.\x0a\x09\x09aNode receiver value: 'self'].\x0a\x0a\x09self messageSends add: aNode selector.\x0a\x09super visitSendNode: aNode",
-messageSends: ["ifTrue:", "=", "value", "receiver", "superSend:", "value:", "add:", "messageSends", "selector", "visitSendNode:"],
+source: "visitSendNode: aNode\x0a\x0a\x09aNode receiver value = 'super' ifTrue: [\x0a\x09\x09aNode superSend: true.\x0a\x09\x09aNode receiver value: 'self' ].\x0a\x0a\x09self messageSends \x0a\x09\x09at: aNode selector\x0a\x09\x09ifPresent: [ self messageSends at: aNode selector put: (self messageSends at: aNode selector) + 1 ]\x0a\x09\x09ifAbsent: [ self messageSends at: aNode selector put: 1 ].\x0a\x0a\x09aNode index: (self messageSends at: aNode selector).\x0a\x0a\x09super visitSendNode: aNode",
+messageSends: ["ifTrue:", "=", "value", "receiver", "superSend:", "value:", "at:ifPresent:ifAbsent:", "messageSends", "selector", "at:put:", "+", "at:", "index:", "visitSendNode:"],
 referencedClasses: []
 }),
 smalltalk.SemanticAnalyzer);

+ 25 - 50
js/Kernel-Exceptions.deploy.js

@@ -102,56 +102,6 @@ return self;}
 smalltalk.Error.klass);
 
 
-smalltalk.addClass('Continuation', smalltalk.Error, ['context'], 'Kernel-Exceptions');
-smalltalk.addMethod(
-"_initializeFromContext_",
-smalltalk.method({
-selector: "initializeFromContext:",
-fn: function (aContext) {
-var self=this;
-smalltalk.send(self, "_initialize", [], smalltalk.Continuation.superclass || nil);
-(self['@context']=aContext);
-smalltalk.send(self, "_basicAt_put_", ["cc", true]);
-return self;}
-}),
-smalltalk.Continuation);
-
-smalltalk.addMethod(
-"_restore",
-smalltalk.method({
-selector: "restore",
-fn: function () {
-var self=this;
-smalltalk.send(self['@context'], "_resume", []);
-return self;}
-}),
-smalltalk.Continuation);
-
-smalltalk.addMethod(
-"_value_",
-smalltalk.method({
-selector: "value:",
-fn: function (aBlock) {
-var self=this;
-smalltalk.send(aBlock, "_value_", [self]);
-smalltalk.send(self, "_signal", []);
-return self;}
-}),
-smalltalk.Continuation);
-
-
-smalltalk.addMethod(
-"_currentDo_",
-smalltalk.method({
-selector: "currentDo:",
-fn: function (aBlock) {
-var self=this;
-return (function($rec){smalltalk.send($rec, "_initializeWithContext_", [smalltalk.send((smalltalk.getThisContext()), "_home", [])]);return smalltalk.send($rec, "_value_", [aBlock]);})(smalltalk.send(self, "_new", []));
-return self;}
-}),
-smalltalk.Continuation.klass);
-
-
 smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
 smalltalk.addMethod(
 "_message",
@@ -210,6 +160,31 @@ smalltalk.MessageNotUnderstood);
 
 
 
+smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
+smalltalk.addMethod(
+"_object",
+smalltalk.method({
+selector: "object",
+fn: function () {
+var self=this;
+return self['@object'];
+return self;}
+}),
+smalltalk.NonBooleanReceiver);
+
+smalltalk.addMethod(
+"_object_",
+smalltalk.method({
+selector: "object:",
+fn: function (anObject) {
+var self=this;
+(self['@object']=anObject);
+return self;}
+}),
+smalltalk.NonBooleanReceiver);
+
+
+
 smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
 smalltalk.addMethod(
 "_handleError_",

+ 35 - 70
js/Kernel-Exceptions.js

@@ -147,76 +147,6 @@ referencedClasses: []
 smalltalk.Error.klass);
 
 
-smalltalk.addClass('Continuation', smalltalk.Error, ['context'], 'Kernel-Exceptions');
-smalltalk.addMethod(
-"_initializeFromContext_",
-smalltalk.method({
-selector: "initializeFromContext:",
-category: 'initialization',
-fn: function (aContext) {
-var self=this;
-smalltalk.send(self, "_initialize", [], smalltalk.Continuation.superclass || nil);
-(self['@context']=aContext);
-smalltalk.send(self, "_basicAt_put_", ["cc", true]);
-return self;},
-args: ["aContext"],
-source: "initializeFromContext: aContext\x0a\x09\x22Add a cc flag to the error object so Smalltalk knows how to handle it\x22\x0a\x0a\x09super initialize.\x0a\x09context := aContext.\x0a\x09self basicAt: 'cc' put: true",
-messageSends: ["initialize", "basicAt:put:"],
-referencedClasses: []
-}),
-smalltalk.Continuation);
-
-smalltalk.addMethod(
-"_restore",
-smalltalk.method({
-selector: "restore",
-category: 'initialization',
-fn: function () {
-var self=this;
-smalltalk.send(self['@context'], "_resume", []);
-return self;},
-args: [],
-source: "restore\x0a\x09context resume",
-messageSends: ["resume"],
-referencedClasses: []
-}),
-smalltalk.Continuation);
-
-smalltalk.addMethod(
-"_value_",
-smalltalk.method({
-selector: "value:",
-category: 'initialization',
-fn: function (aBlock) {
-var self=this;
-smalltalk.send(aBlock, "_value_", [self]);
-smalltalk.send(self, "_signal", []);
-return self;},
-args: ["aBlock"],
-source: "value: aBlock\x0a\x09aBlock value: self.\x0a\x09self signal",
-messageSends: ["value:", "signal"],
-referencedClasses: []
-}),
-smalltalk.Continuation);
-
-
-smalltalk.addMethod(
-"_currentDo_",
-smalltalk.method({
-selector: "currentDo:",
-category: 'instance creation',
-fn: function (aBlock) {
-var self=this;
-return (function($rec){smalltalk.send($rec, "_initializeWithContext_", [smalltalk.send((smalltalk.getThisContext()), "_home", [])]);return smalltalk.send($rec, "_value_", [aBlock]);})(smalltalk.send(self, "_new", []));
-return self;},
-args: ["aBlock"],
-source: "currentDo: aBlock\x0a\x09^ self new \x0a\x09\x09initializeWithContext: thisContext home;\x0a\x09\x09value: aBlock",
-messageSends: ["initializeWithContext:", "home", "value:", "new"],
-referencedClasses: []
-}),
-smalltalk.Continuation.klass);
-
-
 smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
 smalltalk.addMethod(
 "_message",
@@ -300,6 +230,41 @@ smalltalk.MessageNotUnderstood);
 
 
 
+smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
+smalltalk.addMethod(
+"_object",
+smalltalk.method({
+selector: "object",
+category: 'accessing',
+fn: function () {
+var self=this;
+return self['@object'];
+return self;},
+args: [],
+source: "object\x0a\x09^ object",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.NonBooleanReceiver);
+
+smalltalk.addMethod(
+"_object_",
+smalltalk.method({
+selector: "object:",
+category: 'accessing',
+fn: function (anObject) {
+var self=this;
+(self['@object']=anObject);
+return self;},
+args: ["anObject"],
+source: "object: anObject\x0a\x09object := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.NonBooleanReceiver);
+
+
+
 smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
 smalltalk.addMethod(
 "_handleError_",

+ 25 - 15
js/boot.js

@@ -335,11 +335,11 @@ function Smalltalk(){
 
 	/* Handles unhandled errors during message sends */
 
-	st.send = function(receiver, selector, args, klass) {
+	st.send = function(receiver, selector, args, klass, index) {
 		if(st.thisContext) {
-			return withContextSend(receiver, selector, args, klass);
+			return withContextSend(receiver, selector, args, klass, index);
 		} else {
-			try {return withContextSend(receiver, selector, args, klass)}
+			try {return withContextSend(receiver, selector, args, klass, index)}
 			catch(error) {
 				// Reset the context stack in any case
 				st.thisContext = undefined;
@@ -352,15 +352,15 @@ function Smalltalk(){
 		}
 	};
 
-	function withContextSend(receiver, selector, args, klass) {
-		var call, imp;
+	function withContextSend(receiver, selector, args, klass, index) {
+		var call, method;
 		if(receiver == null) {
 			receiver = nil;
 		}
-		imp = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
-		if(imp) {
-			var context = pushContext(receiver, selector, imp, args);
-			call = imp.apply(receiver, args);
+		method = klass ? klass.fn.prototype[selector] : receiver.klass && receiver[selector];
+		if(method) {
+			var context = pushContext(receiver, selector, method, args, index);
+			call = method.apply(receiver, args);
 			popContext(context);
 			return call;
 		} else {
@@ -442,10 +442,10 @@ function Smalltalk(){
 		}
 	};
 
-	function pushContext(receiver, selector, method, temps) {
+	function pushContext(receiver, selector, method, temps, index) {
 		var c = st.oldContext, tc = st.thisContext;
 		if (!c) {
-			return st.thisContext = new SmalltalkMethodContext(receiver, selector, method, temps, tc);
+			return st.thisContext = new SmalltalkMethodContext(receiver, selector, method, temps, index, tc);
 		}
 		st.oldContext = null;
 		c.homeContext = tc;
@@ -453,6 +453,7 @@ function Smalltalk(){
 		c.receiver    = receiver;
         c.selector    = selector;
 		c.method      = method;
+        c.index       = index;
 		c.temps       = temps || {};
 		return st.thisContext = c;
 	};
@@ -512,15 +513,24 @@ function Smalltalk(){
 		}
 		return object;
 	};
+
+    /* Boolean assertion */
+    st.assert = function(boolean) {
+        if(boolean.klass === smalltalk.Boolean) {
+            return boolean;
+        } else {
+            smalltalk.NonBooleanReceiver._new()._object_(boolean)._signal();
+        }
+    }
 };
 
-function SmalltalkMethodContext(receiver, selector, method, temps, home, pc) {
+function SmalltalkMethodContext(receiver, selector, method, temps, index, home) {
 	this.receiver    = receiver;
     this.selector    = selector;
 	this.method      = method;
 	this.temps       = temps || {};
+    this.index       = index;
 	this.homeContext = home;
-    this.pc          = pc || 1;
 
     this.resume = function() {
         //Brutally set the receiver as thisContext, then re-enter the function
@@ -537,8 +547,8 @@ SmalltalkMethodContext.prototype.copy = function() {
         this.selector,
 		this.method, 
 		this.temps, 
-		home,
-        this.pc
+        this.index,
+		home
 	);
 };
 

+ 9 - 1
st/Compiler-AST.st

@@ -268,7 +268,7 @@ accept: aVisitor
 ! !
 
 Node subclass: #SendNode
-	instanceVariableNames: 'selector arguments receiver superSend'
+	instanceVariableNames: 'selector arguments receiver superSend index'
 	package: 'Compiler-AST'!
 
 !SendNode methodsFor: 'accessing'!
@@ -293,6 +293,14 @@ cascadeNodeWithMessages: aCollection
 	    yourself
 !
 
+index
+	^ index
+!
+
+index: anInteger
+	index := anInteger
+!
+
 nodes
 	^ (Array withAll: self arguments)
 		add: self receiver;

+ 21 - 4
st/Compiler-IR.st

@@ -171,7 +171,9 @@ visitReturnNode: aNode
 visitSendNode: aNode
 	| send receiver arguments |
 	send := IRSend new.
-	send selector: aNode selector.
+	send 
+		selector: aNode selector;
+		index: aNode index.
 	aNode superSend ifTrue: [ send classSend: self theClass superclass ].
 
 	receiver := self visit: aNode receiver.
@@ -458,7 +460,7 @@ accept: aVisitor
 ! !
 
 IRInstruction subclass: #IRSend
-	instanceVariableNames: 'selector classSend'
+	instanceVariableNames: 'selector classSend index'
 	package: 'Compiler-IR'!
 !IRSend commentStamp!
 I am a message send instruction.!
@@ -473,6 +475,14 @@ classSend: aClass
 	classSend := aClass
 !
 
+index
+	^ index
+!
+
+index: anInteger
+	index := anInteger
+!
+
 selector
 	^ selector
 !
@@ -820,8 +830,15 @@ visitIRSend: anIRSend
 		do: [ :each | self visit: each ]
 		separatedBy: [ self stream nextPutAll: ',' ].
 	self stream nextPutAll: ']'.
-	anIRSend classSend ifNotNil: [  
-		self stream nextPutAll: ',', anIRSend classSend asJavascript ].
+	anIRSend index > 1 
+		ifTrue: [
+			anIRSend classSend 
+				ifNil: [ self stream nextPutAll: ',undefined' ]
+				ifNotNil: [ self stream nextPutAll: ',', anIRSend classSend asJavascript ].
+			self stream nextPutAll: ',', anIRSend index asJavascript ]
+		ifFalse: [
+			anIRSend classSend ifNotNil: [  
+				self stream nextPutAll: ',', anIRSend classSend asJavascript ]].
 	self stream nextPutAll: ')'
 !
 

+ 14 - 9
st/Compiler-Inlining.st

@@ -160,25 +160,30 @@ visitIRInlinedAssignment: anIRInlinedAssignment
 !
 
 visitIRInlinedClosure: anIRInlinedClosure
-	anIRInlinedClosure instructions allButLast do: [ :each | self visit: each ].
-	(anIRInlinedClosure assignTo notNil and: [
-		anIRInlinedClosure instructions last canBeAssigned ]) ifTrue: [
-			self stream nextPutAll: anIRInlinedClosure assignTo variable alias.
-			self stream nextPutAssignment ].
-	self visit: anIRInlinedClosure instructions last
+	anIRInlinedClosure instructions ifNotEmpty: [
+		anIRInlinedClosure instructions allButLast do: [ :each | self visit: each ].
+		(anIRInlinedClosure assignTo notNil and: [
+			anIRInlinedClosure instructions last canBeAssigned ]) ifTrue: [
+				self stream nextPutAll: anIRInlinedClosure assignTo variable alias.
+				self stream nextPutAssignment ].
+		self visit: anIRInlinedClosure instructions last ]
 !
 
 visitIRInlinedIfFalse: anIRInlinedIfFalse
 	self stream 
 		nextPutIf: [ 
-			self stream nextPutAll: '!!'.
-			self visit: anIRInlinedIfFalse instructions first ]
+			self stream nextPutAll: '!! smalltalk.assert('.
+			self visit: anIRInlinedIfFalse instructions first.
+			self stream nextPutAll: ')' ]
 		with: [ self visit: anIRInlinedIfFalse instructions last ]
 !
 
 visitIRInlinedIfTrue: anIRInlinedIfTrue
 	self stream 
-		nextPutIf: [ self visit: anIRInlinedIfTrue instructions first ]
+		nextPutIf: [ 
+			self stream nextPutAll: 'smalltalk.assert('. 
+			self visit: anIRInlinedIfTrue instructions first.
+			self stream nextPutAll: ')' ]
 		with: [ self visit: anIRInlinedIfTrue instructions last ]
 ! !
 

+ 12 - 6
st/Compiler-Semantic.st

@@ -378,7 +378,7 @@ classReferences
 !
 
 messageSends
-	^ messageSends ifNil: [ messageSends := Set new ]
+	^ messageSends ifNil: [ messageSends := Dictionary new ]
 !
 
 pseudoVariables
@@ -500,15 +500,15 @@ visitMethodNode: aNode
 
 	aNode 
 		classReferences: self classReferences;
-		messageSends: self messageSends.
+		messageSends: self messageSends keys.
 	self popScope
 !
 
 visitReturnNode: aNode
 	aNode scope: currentScope.
 	currentScope isMethodScope
-		ifFalse: [
-			currentScope methodScope addNonLocalReturn: currentScope ].
+		ifTrue: [ currentScope localReturn: true ]
+		ifFalse: [ currentScope methodScope addNonLocalReturn: currentScope ].
 	super visitReturnNode: aNode
 !
 
@@ -516,9 +516,15 @@ visitSendNode: aNode
 
 	aNode receiver value = 'super' ifTrue: [
 		aNode superSend: true.
-		aNode receiver value: 'self'].
+		aNode receiver value: 'self' ].
+
+	self messageSends 
+		at: aNode selector
+		ifPresent: [ self messageSends at: aNode selector put: (self messageSends at: aNode selector) + 1 ]
+		ifAbsent: [ self messageSends at: aNode selector put: 1 ].
+
+	aNode index: (self messageSends at: aNode selector).
 
-	self messageSends add: aNode selector.
 	super visitSendNode: aNode
 !
 

+ 14 - 31
st/Kernel-Exceptions.st

@@ -49,37 +49,6 @@ signal: aString
 		signal: aString
 ! !
 
-Error subclass: #Continuation
-	instanceVariableNames: 'context'
-	package: 'Kernel-Exceptions'!
-
-!Continuation methodsFor: 'initialization'!
-
-initializeFromContext: aContext
-	"Add a cc flag to the error object so Smalltalk knows how to handle it"
-
-	super initialize.
-	context := aContext.
-	self basicAt: 'cc' put: true
-!
-
-restore
-	context resume
-!
-
-value: aBlock
-	aBlock value: self.
-	self signal
-! !
-
-!Continuation class methodsFor: 'instance creation'!
-
-currentDo: aBlock
-	^ self new 
-		initializeWithContext: thisContext home;
-		value: aBlock
-! !
-
 Error subclass: #MessageNotUnderstood
 	instanceVariableNames: 'message receiver'
 	package: 'Kernel-Exceptions'!
@@ -106,6 +75,20 @@ receiver: anObject
 	receiver := anObject
 ! !
 
+Error subclass: #NonBooleanReceiver
+	instanceVariableNames: 'object'
+	package: 'Kernel-Exceptions'!
+
+!NonBooleanReceiver methodsFor: 'accessing'!
+
+object
+	^ object
+!
+
+object: anObject
+	object := anObject
+! !
+
 Object subclass: #ErrorHandler
 	instanceVariableNames: ''
 	package: 'Kernel-Exceptions'!

Some files were not shown because too many files changed in this diff