UNPKG

@ambers/lang

Version:

An implementation of the Smalltalk language that runs on top of the JS runtime.

1,300 lines (1,238 loc) 115 kB
define(["amber/boot", "require", "amber/core/Compiler-AST", "amber/core/Compiler-Core", "amber/core/Compiler-IR", "amber/core/Compiler-Semantic", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict"; var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals; var $pkg = $core.addPackage("Compiler-Inlining"); $pkg.transport = {"type":"amd","amdNamespace":"amber/core"}; $core.addClass("ASTPreInliner", $globals.NodeVisitor, "Compiler-Inlining"); $core.addMethod( $core.method({ selector: "visitSendNode:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aNode"], source: "visitSendNode: aNode\x0a\x0a\x09aNode superSend ifFalse: [ \x0a\x09\x09(IRSendInliner inlinedSelectors includes: aNode selector) ifTrue: [\x0a\x09\x09\x09aNode shouldBeAliased: true.\x0a\x09\x09\x09aNode receiver ifNotNil: [ :receiver |\x0a\x09\x09\x09\x09(IRSendInliner inlinedSelectorsNeedingIdempotentReceiver includes: aNode selector) ifTrue: [\x0a\x09\x09\x09\x09\x09receiver shouldBeAliased: true ] ] ] ].\x0a\x0a\x09^ super visitSendNode: aNode", referencedClasses: ["IRSendInliner"], //>>excludeEnd("ide"); pragmas: [], messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeAliased:", "ifNotNil:", "receiver", "inlinedSelectorsNeedingIdempotentReceiver", "visitSendNode:"] }, function ($methodClass){ return function (aNode){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; if(!$core.assert($recv(aNode)._superSend())){ if($core.assert([$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_([$recv(aNode)._selector() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["selector"]=1 //>>excludeEnd("ctx"); ][0]) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["includes:"]=1 //>>excludeEnd("ctx"); ][0])){ [$recv(aNode)._shouldBeAliased_(true) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["shouldBeAliased:"]=1 //>>excludeEnd("ctx"); ][0]; $1=$recv(aNode)._receiver(); if($1 != null && !$1.a$nil){ var receiver; receiver=$1; if($core.assert($recv($recv($globals.IRSendInliner)._inlinedSelectorsNeedingIdempotentReceiver())._includes_($recv(aNode)._selector()))){ $recv(receiver)._shouldBeAliased_(true); } } } } return [( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.call($self,aNode)) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.supercall = false //>>excludeEnd("ctx"); ][0]; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode})}); //>>excludeEnd("ctx"); }; }), $globals.ASTPreInliner); $core.addClass("IRInlinedClosure", $globals.IRClosure, "Compiler-Inlining"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRInlinedClosure.comment="I represent an inlined closure instruction."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "acceptDagVisitor:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aVisitor"], source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["visitIRInlinedClosure:"] }, function ($methodClass){ return function (aVisitor){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aVisitor)._visitIRInlinedClosure_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})}); //>>excludeEnd("ctx"); }; }), $globals.IRInlinedClosure); $core.addMethod( $core.method({ selector: "isInlined", protocol: "testing", //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isInlined\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: [] }, function ($methodClass){ return function (){ var self=this,$self=this; return true; }; }), $globals.IRInlinedClosure); $core.addClass("IRInlinedSend", $globals.IRSend, "Compiler-Inlining"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "acceptDagVisitor:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aVisitor"], source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["visitInlinedSend:"] }, function ($methodClass){ return function (aVisitor){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aVisitor)._visitInlinedSend_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})}); //>>excludeEnd("ctx"); }; }), $globals.IRInlinedSend); $core.addMethod( $core.method({ selector: "internalVariables", protocol: "accessing", //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: [] }, function ($methodClass){ return function (){ var self=this,$self=this; return []; }; }), $globals.IRInlinedSend); $core.addMethod( $core.method({ selector: "isInlined", protocol: "testing", //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isInlined\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: [] }, function ($methodClass){ return function (){ var self=this,$self=this; return true; }; }), $globals.IRInlinedSend); $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, "Compiler-Inlining"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "acceptDagVisitor:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aVisitor"], source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["visitIRInlinedIfFalse:"] }, function ($methodClass){ return function (aVisitor){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aVisitor)._visitIRInlinedIfFalse_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})}); //>>excludeEnd("ctx"); }; }), $globals.IRInlinedIfFalse); $core.addClass("IRInlinedIfNil", $globals.IRInlinedSend, "Compiler-Inlining"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRInlinedIfNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "acceptDagVisitor:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aVisitor"], source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNil: self", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["visitIRInlinedIfNil:"] }, function ($methodClass){ return function (aVisitor){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aVisitor)._visitIRInlinedIfNil_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})}); //>>excludeEnd("ctx"); }; }), $globals.IRInlinedIfNil); $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, "Compiler-Inlining"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "acceptDagVisitor:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aVisitor"], source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["visitIRInlinedIfNilIfNotNil:"] }, function ($methodClass){ return function (aVisitor){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})}); //>>excludeEnd("ctx"); }; }), $globals.IRInlinedIfNilIfNotNil); $core.addClass("IRInlinedIfNotNil", $globals.IRInlinedSend, "Compiler-Inlining"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRInlinedIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "acceptDagVisitor:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aVisitor"], source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNotNil: self", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["visitIRInlinedIfNotNil:"] }, function ($methodClass){ return function (aVisitor){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aVisitor)._visitIRInlinedIfNotNil_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})}); //>>excludeEnd("ctx"); }; }), $globals.IRInlinedIfNotNil); $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, "Compiler-Inlining"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "acceptDagVisitor:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aVisitor"], source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["visitIRInlinedIfTrue:"] }, function ($methodClass){ return function (aVisitor){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aVisitor)._visitIRInlinedIfTrue_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})}); //>>excludeEnd("ctx"); }; }), $globals.IRInlinedIfTrue); $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, "Compiler-Inlining"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "acceptDagVisitor:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aVisitor"], source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["visitIRInlinedIfTrueIfFalse:"] }, function ($methodClass){ return function (aVisitor){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})}); //>>excludeEnd("ctx"); }; }), $globals.IRInlinedIfTrueIfFalse); $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, "Compiler-Inlining"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`)."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "acceptDagVisitor:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["aVisitor"], source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["visitIRInlinedSequence:"] }, function ($methodClass){ return function (aVisitor){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv(aVisitor)._visitIRInlinedSequence_(self); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor})}); //>>excludeEnd("ctx"); }; }), $globals.IRInlinedSequence); $core.addMethod( $core.method({ selector: "isInlined", protocol: "testing", //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "isInlined\x0a\x09^ true", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: [] }, function ($methodClass){ return function (){ var self=this,$self=this; return true; }; }), $globals.IRInlinedSequence); $core.addClass("IRInliner", $globals.IRVisitor, "Compiler-Inlining"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRInliner.comment="I visit an IR tree, inlining message sends and block closures.\x0a\x0aMessage selectors that can be inlined are answered by `IRSendInliner >> #inlinedSelectors`"; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "assignmentInliner", protocol: "factory", //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself", referencedClasses: ["IRAssignmentInliner"], //>>excludeEnd("ide"); pragmas: [], messageSends: ["translator:", "new", "yourself"] }, function ($methodClass){ return function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$recv($globals.IRAssignmentInliner)._new(); $recv($1)._translator_(self); return $recv($1)._yourself(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addMethod( $core.method({ selector: "flattenedReturn:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRNonLocalReturn"], source: "flattenedReturn: anIRNonLocalReturn\x0a\x09| localReturn |\x0a\x09localReturn := IRReturn new\x0a\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09yourself.\x0a\x09anIRNonLocalReturn dagChildren do: [ :each | localReturn add: each ].\x0a\x09^ localReturn", referencedClasses: ["IRReturn"], //>>excludeEnd("ide"); pragmas: [], messageSends: ["scope:", "new", "scope", "yourself", "do:", "dagChildren", "add:"] }, function ($methodClass){ return function (anIRNonLocalReturn){ var self=this,$self=this; var localReturn; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$recv($globals.IRReturn)._new(); $recv($1)._scope_($recv(anIRNonLocalReturn)._scope()); localReturn=$recv($1)._yourself(); $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $recv(localReturn)._add_(each); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); //>>excludeEnd("ctx"); })); return localReturn; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"flattenedReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addMethod( $core.method({ selector: "nonLocalReturnInliner", protocol: "factory", //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "nonLocalReturnInliner\x0a\x09^ IRNonLocalReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself", referencedClasses: ["IRNonLocalReturnInliner"], //>>excludeEnd("ide"); pragmas: [], messageSends: ["translator:", "new", "yourself"] }, function ($methodClass){ return function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$recv($globals.IRNonLocalReturnInliner)._new(); $recv($1)._translator_(self); return $recv($1)._yourself(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"nonLocalReturnInliner",{})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addMethod( $core.method({ selector: "returnInliner", protocol: "factory", //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself", referencedClasses: ["IRReturnInliner"], //>>excludeEnd("ide"); pragmas: [], messageSends: ["translator:", "new", "yourself"] }, function ($methodClass){ return function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$recv($globals.IRReturnInliner)._new(); $recv($1)._translator_(self); return $recv($1)._yourself(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"returnInliner",{})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addMethod( $core.method({ selector: "sendInliner", protocol: "factory", //>>excludeStart("ide", pragmas.excludeIdeData); args: [], source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself", referencedClasses: ["IRSendInliner"], //>>excludeEnd("ide"); pragmas: [], messageSends: ["translator:", "new", "yourself"] }, function ($methodClass){ return function (){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); var $1; $1=$recv($globals.IRSendInliner)._new(); $recv($1)._translator_(self); return $recv($1)._yourself(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"sendInliner",{})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addMethod( $core.method({ selector: "shouldInlineAssignment:", protocol: "testing", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRAssignment"], source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"] }, function ($methodClass){ return function (anIRAssignment){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); if($core.assert($recv($recv(anIRAssignment)._isInlined())._not())){ if($core.assert($recv([$recv(anIRAssignment)._right() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["right"]=1 //>>excludeEnd("ctx"); ][0])._isSend())){ return $self._shouldInlineSend_($recv(anIRAssignment)._right()); } else { return false; } } else { return false; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addMethod( $core.method({ selector: "shouldInlineReturn:", protocol: "testing", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRReturn"], source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"] }, function ($methodClass){ return function (anIRReturn){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); if($core.assert($recv($recv(anIRReturn)._isInlined())._not())){ if($core.assert($recv([$recv(anIRReturn)._expression() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["expression"]=1 //>>excludeEnd("ctx"); ][0])._isSend())){ return $self._shouldInlineSend_($recv(anIRReturn)._expression()); } else { return false; } } else { return false; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addMethod( $core.method({ selector: "shouldInlineSend:", protocol: "testing", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRSend"], source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]", referencedClasses: ["IRSendInliner"], //>>excludeEnd("ide"); pragmas: [], messageSends: ["and:", "not", "isInlined", "shouldInline:"] }, function ($methodClass){ return function (anIRSend){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); if($core.assert($recv($recv(anIRSend)._isInlined())._not())){ return $recv($globals.IRSendInliner)._shouldInline_(anIRSend); } else { return false; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addMethod( $core.method({ selector: "visitIRAssignment:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRAssignment"], source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"] }, function ($methodClass){ return function (anIRAssignment){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); if($core.assert($self._shouldInlineAssignment_(anIRAssignment))){ return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment); } else { return [( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.call($self,anIRAssignment)) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.supercall = false //>>excludeEnd("ctx"); ][0]; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addMethod( $core.method({ selector: "visitIRNonLocalReturn:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRNonLocalReturn"], source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09anIRNonLocalReturn scope canFlattenNonLocalReturns ifTrue: [\x0a\x09\x09| localReturn |\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := self flattenedReturn: anIRNonLocalReturn.\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ self visitIRReturn: localReturn ].\x0a\x09^ (self shouldInlineReturn: anIRNonLocalReturn)\x0a\x09\x09ifTrue: [ self nonLocalReturnInliner inlineReturn: anIRNonLocalReturn ]\x0a\x09\x09ifFalse: [ super visitIRNonLocalReturn: anIRNonLocalReturn ]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["ifTrue:", "canFlattenNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "flattenedReturn:", "replaceWith:", "visitIRReturn:", "ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "nonLocalReturnInliner", "visitIRNonLocalReturn:"] }, function ($methodClass){ return function (anIRNonLocalReturn){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); if($core.assert($recv([$recv(anIRNonLocalReturn)._scope() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["scope"]=1 //>>excludeEnd("ctx"); ][0])._canFlattenNonLocalReturns())){ var localReturn; $recv($recv([$recv(anIRNonLocalReturn)._scope() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["scope"]=2 //>>excludeEnd("ctx"); ][0])._methodScope())._removeNonLocalReturn_($recv(anIRNonLocalReturn)._scope()); localReturn=$self._flattenedReturn_(anIRNonLocalReturn); $recv(anIRNonLocalReturn)._replaceWith_(localReturn); return $self._visitIRReturn_(localReturn); } if($core.assert($self._shouldInlineReturn_(anIRNonLocalReturn))){ return $recv($self._nonLocalReturnInliner())._inlineReturn_(anIRNonLocalReturn); } else { return [( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.call($self,anIRNonLocalReturn)) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.supercall = false //>>excludeEnd("ctx"); ][0]; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addMethod( $core.method({ selector: "visitIRReturn:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRReturn"], source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"] }, function ($methodClass){ return function (anIRReturn){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); if($core.assert($self._shouldInlineReturn_(anIRReturn))){ return $recv($self._returnInliner())._inlineReturn_(anIRReturn); } else { return [( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.call($self,anIRReturn)) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.supercall = false //>>excludeEnd("ctx"); ][0]; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addMethod( $core.method({ selector: "visitIRSend:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRSend"], source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"] }, function ($methodClass){ return function (anIRSend){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); if($core.assert($self._shouldInlineSend_(anIRSend))){ return $recv($self._sendInliner())._inlineSend_(anIRSend); } else { return [( //>>excludeStart("ctx", pragmas.excludeDebugContexts); $ctx1.supercall = true, //>>excludeEnd("ctx"); ($methodClass.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.call($self,anIRSend)) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.supercall = false //>>excludeEnd("ctx"); ][0]; } //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliner); $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, "Compiler-Inlining"); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance)."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "visitIRInlinedClosure:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRInlinedClosure"], source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAllChildren: anIRInlinedClosure", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAllChildren:"] }, function ($methodClass){ return function (anIRInlinedClosure){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $recv($recv(each)._name())._asVariableName(); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)}); //>>excludeEnd("ctx"); }))); $self._visitAllChildren_(anIRInlinedClosure); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliningJSTranslator); $core.addMethod( $core.method({ selector: "visitIRInlinedIfFalse:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRInlinedIfFalse"], source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '!$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse dagChildren first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfFalse dagChildren last ]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"] }, function ($methodClass){ return function (anIRInlinedIfFalse){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["stream"]=1 //>>excludeEnd("ctx"); ][0])._nextPutIf_then_((function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); [$recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["stream"]=2 //>>excludeEnd("ctx"); ][0])._nextPutAll_("!$core.assert(") //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["nextPutAll:"]=1 //>>excludeEnd("ctx"); ][0]; [$self._visit_($recv([$recv(anIRInlinedIfFalse)._dagChildren() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["dagChildren"]=1 //>>excludeEnd("ctx"); ][0])._first()) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["visit:"]=1 //>>excludeEnd("ctx"); ][0]; return $recv($self._stream())._nextPutAll_(")"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); }),(function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); //>>excludeEnd("ctx"); })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliningJSTranslator); $core.addMethod( $core.method({ selector: "visitIRInlinedIfNil:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRInlinedIfNil"], source: "visitIRInlinedIfNil: anIRInlinedIfNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self visit: anIRInlinedIfNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ' == null || '.\x0a\x09\x09\x09self visit: anIRInlinedIfNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: '.a$nil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNil dagChildren second ]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["nextPutIf:then:", "stream", "visit:", "first", "dagChildren", "nextPutAll:", "second"] }, function ($methodClass){ return function (anIRInlinedIfNil){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["stream"]=1 //>>excludeEnd("ctx"); ][0])._nextPutIf_then_((function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); [$self._visit_([$recv([$recv(anIRInlinedIfNil)._dagChildren() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["dagChildren"]=1 //>>excludeEnd("ctx"); ][0])._first() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["first"]=1 //>>excludeEnd("ctx"); ][0]) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["visit:"]=1 //>>excludeEnd("ctx"); ][0]; [$recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["stream"]=2 //>>excludeEnd("ctx"); ][0])._nextPutAll_(" == null || ") //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["nextPutAll:"]=1 //>>excludeEnd("ctx"); ][0]; [$self._visit_($recv([$recv(anIRInlinedIfNil)._dagChildren() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["dagChildren"]=2 //>>excludeEnd("ctx"); ][0])._first()) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["visit:"]=2 //>>excludeEnd("ctx"); ][0]; return $recv($self._stream())._nextPutAll_(".a$nil"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); }),(function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $self._visit_($recv($recv(anIRInlinedIfNil)._dagChildren())._second()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); //>>excludeEnd("ctx"); })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNil:",{anIRInlinedIfNil:anIRInlinedIfNil})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliningJSTranslator); $core.addMethod( $core.method({ selector: "visitIRInlinedIfNilIfNotNil:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRInlinedIfNilIfNotNil"], source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ' == null || '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: '.a$nil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNilIfNotNil dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfNilIfNotNil dagChildren third ]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["nextPutIf:then:else:", "stream", "visit:", "first", "dagChildren", "nextPutAll:", "second", "third"] }, function ($methodClass){ return function (anIRInlinedIfNilIfNotNil){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["stream"]=1 //>>excludeEnd("ctx"); ][0])._nextPutIf_then_else_((function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); [$self._visit_([$recv([$recv(anIRInlinedIfNilIfNotNil)._dagChildren() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["dagChildren"]=1 //>>excludeEnd("ctx"); ][0])._first() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["first"]=1 //>>excludeEnd("ctx"); ][0]) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["visit:"]=1 //>>excludeEnd("ctx"); ][0]; [$recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["stream"]=2 //>>excludeEnd("ctx"); ][0])._nextPutAll_(" == null || ") //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["nextPutAll:"]=1 //>>excludeEnd("ctx"); ][0]; [$self._visit_($recv([$recv(anIRInlinedIfNilIfNotNil)._dagChildren() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["dagChildren"]=2 //>>excludeEnd("ctx"); ][0])._first()) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["visit:"]=2 //>>excludeEnd("ctx"); ][0]; return $recv($self._stream())._nextPutAll_(".a$nil"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); }),(function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return [$self._visit_($recv([$recv(anIRInlinedIfNilIfNotNil)._dagChildren() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["dagChildren"]=3 //>>excludeEnd("ctx"); ][0])._second()) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["visit:"]=3 //>>excludeEnd("ctx"); ][0]; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); //>>excludeEnd("ctx"); }),(function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); //>>excludeEnd("ctx"); })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliningJSTranslator); $core.addMethod( $core.method({ selector: "visitIRInlinedIfNotNil:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRInlinedIfNotNil"], source: "visitIRInlinedIfNotNil: anIRInlinedIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self visit: anIRInlinedIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ' != null && !'.\x0a\x09\x09\x09self visit: anIRInlinedIfNotNil dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: '.a$nil' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfNotNil dagChildren second ]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["nextPutIf:then:", "stream", "visit:", "first", "dagChildren", "nextPutAll:", "second"] }, function ($methodClass){ return function (anIRInlinedIfNotNil){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["stream"]=1 //>>excludeEnd("ctx"); ][0])._nextPutIf_then_((function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); [$self._visit_([$recv([$recv(anIRInlinedIfNotNil)._dagChildren() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["dagChildren"]=1 //>>excludeEnd("ctx"); ][0])._first() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["first"]=1 //>>excludeEnd("ctx"); ][0]) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["visit:"]=1 //>>excludeEnd("ctx"); ][0]; [$recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["stream"]=2 //>>excludeEnd("ctx"); ][0])._nextPutAll_(" != null && !") //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["nextPutAll:"]=1 //>>excludeEnd("ctx"); ][0]; [$self._visit_($recv([$recv(anIRInlinedIfNotNil)._dagChildren() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["dagChildren"]=2 //>>excludeEnd("ctx"); ][0])._first()) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["visit:"]=2 //>>excludeEnd("ctx"); ][0]; return $recv($self._stream())._nextPutAll_(".a$nil"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); }),(function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $self._visit_($recv($recv(anIRInlinedIfNotNil)._dagChildren())._second()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); //>>excludeEnd("ctx"); })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNotNil:",{anIRInlinedIfNotNil:anIRInlinedIfNotNil})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliningJSTranslator); $core.addMethod( $core.method({ selector: "visitIRInlinedIfTrue:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRInlinedIfTrue"], source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue dagChildren first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrue dagChildren last ]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"] }, function ($methodClass){ return function (anIRInlinedIfTrue){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["stream"]=1 //>>excludeEnd("ctx"); ][0])._nextPutIf_then_((function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); [$recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["stream"]=2 //>>excludeEnd("ctx"); ][0])._nextPutAll_("$core.assert(") //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["nextPutAll:"]=1 //>>excludeEnd("ctx"); ][0]; [$self._visit_($recv([$recv(anIRInlinedIfTrue)._dagChildren() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["dagChildren"]=1 //>>excludeEnd("ctx"); ][0])._first()) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["visit:"]=1 //>>excludeEnd("ctx"); ][0]; return $recv($self._stream())._nextPutAll_(")"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); }),(function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); //>>excludeEnd("ctx"); })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliningJSTranslator); $core.addMethod( $core.method({ selector: "visitIRInlinedIfTrueIfFalse:", protocol: "visiting", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRInlinedIfTrueIfFalse"], source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIf: [\x0a\x09\x09\x09self stream nextPutAll: '$core.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse dagChildren first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09then: [ self visit: anIRInlinedIfTrueIfFalse dagChildren second ]\x0a\x09\x09else: [ self visit: anIRInlinedIfTrueIfFalse dagChildren third ]", referencedClasses: [], //>>excludeEnd("ide"); pragmas: [], messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"] }, function ($methodClass){ return function (anIRInlinedIfTrueIfFalse){ var self=this,$self=this; //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx1) { //>>excludeEnd("ctx"); $recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx1.sendIdx["stream"]=1 //>>excludeEnd("ctx"); ][0])._nextPutIf_then_else_((function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); [$recv([$self._stream() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["stream"]=2 //>>excludeEnd("ctx"); ][0])._nextPutAll_("$core.assert(") //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["nextPutAll:"]=1 //>>excludeEnd("ctx"); ][0]; [$self._visit_($recv([$recv(anIRInlinedIfTrueIfFalse)._dagChildren() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["dagChildren"]=1 //>>excludeEnd("ctx"); ][0])._first()) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["visit:"]=1 //>>excludeEnd("ctx"); ][0]; return $recv($self._stream())._nextPutAll_(")"); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)}); //>>excludeEnd("ctx"); }),(function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return [$self._visit_($recv([$recv(anIRInlinedIfTrueIfFalse)._dagChildren() //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["dagChildren"]=2 //>>excludeEnd("ctx"); ][0])._second()) //>>excludeStart("ctx", pragmas.excludeDebugContexts); ,$ctx2.sendIdx["visit:"]=2 //>>excludeEnd("ctx"); ][0]; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)}); //>>excludeEnd("ctx"); }),(function(){ //>>excludeStart("ctx", pragmas.excludeDebugContexts); return $core.withContext(function($ctx2) { //>>excludeEnd("ctx"); return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third()); //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)}); //>>excludeEnd("ctx"); })); return self; //>>excludeStart("ctx", pragmas.excludeDebugContexts); }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse})}); //>>excludeEnd("ctx"); }; }), $globals.IRInliningJSTranslator); $core.addClass("IRSendInliner", $globals.Object, "Compiler-Inlining"); $core.setSlots($globals.IRSendInliner, ["send", "translator"]); //>>excludeStart("ide", pragmas.excludeIdeData); $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods."; //>>excludeEnd("ide"); $core.addMethod( $core.method({ selector: "and:", protocol: "inlining", //>>excludeStart("ide", pragmas.excludeIdeData); args: ["anIRInstruction"], source: "and: anIRInstruction\x0a\x09self mustBeNiladic