smalltalk.addPackage('Compiler-Inlining', {}); smalltalk.addClass('IRInlinedAssignment', smalltalk.IRAssignment, [], 'Compiler-Inlining'); smalltalk.addMethod( "_accept_", smalltalk.method({ selector: "accept:", fn: function (aVisitor){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(aVisitor)._visitIRInlinedAssignment_(self); return $1; }, self, "accept:", [aVisitor], smalltalk.IRInlinedAssignment)} }), smalltalk.IRInlinedAssignment); smalltalk.addMethod( "_isInlined", smalltalk.method({ selector: "isInlined", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return true; }, self, "isInlined", [], smalltalk.IRInlinedAssignment)} }), smalltalk.IRInlinedAssignment); smalltalk.addClass('IRInlinedClosure', smalltalk.IRClosure, [], 'Compiler-Inlining'); smalltalk.addMethod( "_accept_", smalltalk.method({ selector: "accept:", fn: function (aVisitor){ var self=this; return smalltalk.withContext(function($ctx) { _st(aVisitor)._visitIRInlinedClosure_(self); return self}, self, "accept:", [aVisitor], smalltalk.IRInlinedClosure)} }), smalltalk.IRInlinedClosure); smalltalk.addMethod( "_isInlined", smalltalk.method({ selector: "isInlined", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return true; }, self, "isInlined", [], smalltalk.IRInlinedClosure)} }), smalltalk.IRInlinedClosure); smalltalk.addClass('IRInlinedReturn', smalltalk.IRReturn, [], 'Compiler-Inlining'); smalltalk.addMethod( "_accept_", smalltalk.method({ selector: "accept:", fn: function (aVisitor){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(aVisitor)._visitIRInlinedReturn_(self); return $1; }, self, "accept:", [aVisitor], smalltalk.IRInlinedReturn)} }), smalltalk.IRInlinedReturn); smalltalk.addMethod( "_isInlined", smalltalk.method({ selector: "isInlined", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return true; }, self, "isInlined", [], smalltalk.IRInlinedReturn)} }), smalltalk.IRInlinedReturn); smalltalk.addClass('IRInlinedNonLocalReturn', smalltalk.IRInlinedReturn, [], 'Compiler-Inlining'); smalltalk.addMethod( "_accept_", smalltalk.method({ selector: "accept:", fn: function (aVisitor){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(aVisitor)._visitIRInlinedNonLocalReturn_(self); return $1; }, self, "accept:", [aVisitor], smalltalk.IRInlinedNonLocalReturn)} }), smalltalk.IRInlinedNonLocalReturn); smalltalk.addMethod( "_isInlined", smalltalk.method({ selector: "isInlined", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return true; }, self, "isInlined", [], smalltalk.IRInlinedNonLocalReturn)} }), smalltalk.IRInlinedNonLocalReturn); smalltalk.addClass('IRInlinedSend', smalltalk.IRSend, [], 'Compiler-Inlining'); smalltalk.addMethod( "_accept_", smalltalk.method({ selector: "accept:", fn: function (aVisitor){ var self=this; return smalltalk.withContext(function($ctx) { _st(aVisitor)._visitInlinedSend_(self); return self}, self, "accept:", [aVisitor], smalltalk.IRInlinedSend)} }), smalltalk.IRInlinedSend); smalltalk.addMethod( "_isInlined", smalltalk.method({ selector: "isInlined", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return true; }, self, "isInlined", [], smalltalk.IRInlinedSend)} }), smalltalk.IRInlinedSend); smalltalk.addClass('IRInlinedIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining'); smalltalk.addMethod( "_accept_", smalltalk.method({ selector: "accept:", fn: function (aVisitor){ var self=this; return smalltalk.withContext(function($ctx) { _st(aVisitor)._visitIRInlinedIfFalse_(self); return self}, self, "accept:", [aVisitor], smalltalk.IRInlinedIfFalse)} }), smalltalk.IRInlinedIfFalse); smalltalk.addClass('IRInlinedIfNilIfNotNil', smalltalk.IRInlinedSend, [], 'Compiler-Inlining'); smalltalk.addMethod( "_accept_", smalltalk.method({ selector: "accept:", fn: function (aVisitor){ var self=this; return smalltalk.withContext(function($ctx) { _st(aVisitor)._visitIRInlinedIfNilIfNotNil_(self); return self}, self, "accept:", [aVisitor], smalltalk.IRInlinedIfNilIfNotNil)} }), smalltalk.IRInlinedIfNilIfNotNil); smalltalk.addClass('IRInlinedIfTrue', smalltalk.IRInlinedSend, [], 'Compiler-Inlining'); smalltalk.addMethod( "_accept_", smalltalk.method({ selector: "accept:", fn: function (aVisitor){ var self=this; return smalltalk.withContext(function($ctx) { _st(aVisitor)._visitIRInlinedIfTrue_(self); return self}, self, "accept:", [aVisitor], smalltalk.IRInlinedIfTrue)} }), smalltalk.IRInlinedIfTrue); smalltalk.addClass('IRInlinedIfTrueIfFalse', smalltalk.IRInlinedSend, [], 'Compiler-Inlining'); smalltalk.addMethod( "_accept_", smalltalk.method({ selector: "accept:", fn: function (aVisitor){ var self=this; return smalltalk.withContext(function($ctx) { _st(aVisitor)._visitIRInlinedIfTrueIfFalse_(self); return self}, self, "accept:", [aVisitor], smalltalk.IRInlinedIfTrueIfFalse)} }), smalltalk.IRInlinedIfTrueIfFalse); smalltalk.addClass('IRInlinedSequence', smalltalk.IRBlockSequence, [], 'Compiler-Inlining'); smalltalk.addMethod( "_accept_", smalltalk.method({ selector: "accept:", fn: function (aVisitor){ var self=this; return smalltalk.withContext(function($ctx) { _st(aVisitor)._visitIRInlinedSequence_(self); return self}, self, "accept:", [aVisitor], smalltalk.IRInlinedSequence)} }), smalltalk.IRInlinedSequence); smalltalk.addMethod( "_isInlined", smalltalk.method({ selector: "isInlined", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return true; }, self, "isInlined", [], smalltalk.IRInlinedSequence)} }), smalltalk.IRInlinedSequence); smalltalk.addClass('IRInliner', smalltalk.IRVisitor, [], 'Compiler-Inlining'); smalltalk.addMethod( "_assignmentInliner", smalltalk.method({ selector: "assignmentInliner", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$1; $2=_st((smalltalk.IRAssignmentInliner || IRAssignmentInliner))._new(); _st($2)._translator_(self); $3=_st($2)._yourself(); $1=$3; return $1; }, self, "assignmentInliner", [], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addMethod( "_nonLocalReturnInliner", smalltalk.method({ selector: "nonLocalReturnInliner", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$1; $2=_st((smalltalk.IRNonLocalReturnInliner || IRNonLocalReturnInliner))._new(); _st($2)._translator_(self); $3=_st($2)._yourself(); $1=$3; return $1; }, self, "nonLocalReturnInliner", [], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addMethod( "_returnInliner", smalltalk.method({ selector: "returnInliner", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$1; $2=_st((smalltalk.IRReturnInliner || IRReturnInliner))._new(); _st($2)._translator_(self); $3=_st($2)._yourself(); $1=$3; return $1; }, self, "returnInliner", [], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addMethod( "_sendInliner", smalltalk.method({ selector: "sendInliner", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$1; $2=_st((smalltalk.IRSendInliner || IRSendInliner))._new(); _st($2)._translator_(self); $3=_st($2)._yourself(); $1=$3; return $1; }, self, "sendInliner", [], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addMethod( "_shouldInlineAssignment_", smalltalk.method({ selector: "shouldInlineAssignment:", fn: function (anIRAssignment){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(_st(anIRAssignment)._isInlined())._not())._and_((function(){ return _st(_st(_st(_st(anIRAssignment)._instructions())._last())._isSend())._and_((function(){ return _st(self)._shouldInlineSend_(_st(_st(anIRAssignment)._instructions())._last()); })); })); return $1; }, self, "shouldInlineAssignment:", [anIRAssignment], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addMethod( "_shouldInlineReturn_", smalltalk.method({ selector: "shouldInlineReturn:", fn: function (anIRReturn){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(_st(anIRReturn)._isInlined())._not())._and_((function(){ return _st(_st(_st(_st(anIRReturn)._instructions())._first())._isSend())._and_((function(){ return _st(self)._shouldInlineSend_(_st(_st(anIRReturn)._instructions())._first()); })); })); return $1; }, self, "shouldInlineReturn:", [anIRReturn], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addMethod( "_shouldInlineSend_", smalltalk.method({ selector: "shouldInlineSend:", fn: function (anIRSend){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(_st(_st(anIRSend)._isInlined())._not())._and_((function(){ return _st((smalltalk.IRSendInliner || IRSendInliner))._shouldInline_(anIRSend); })); return $1; }, self, "shouldInlineSend:", [anIRSend], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addMethod( "_transformNonLocalReturn_", smalltalk.method({ selector: "transformNonLocalReturn:", fn: function (anIRNonLocalReturn){ var self=this; return smalltalk.withContext(function($ctx) { var $1,$2,$3,$4; var localReturn; $1=_st(_st(anIRNonLocalReturn)._scope())._canInlineNonLocalReturns(); if(smalltalk.assert($1)){ _st(_st(_st(anIRNonLocalReturn)._scope())._methodScope())._removeNonLocalReturn_(_st(anIRNonLocalReturn)._scope()); $2=_st((smalltalk.IRReturn || IRReturn))._new(); _st($2)._scope_(_st(anIRNonLocalReturn)._scope()); $3=_st($2)._yourself(); localReturn=$3; localReturn; _st(_st(anIRNonLocalReturn)._instructions())._do_((function(each){ return _st(localReturn)._add_(each); })); _st(anIRNonLocalReturn)._replaceWith_(localReturn); return localReturn; }; $4=smalltalk.IRVisitor.fn.prototype._visitIRNonLocalReturn_.apply(_st(self), [anIRNonLocalReturn]); return $4; }, self, "transformNonLocalReturn:", [anIRNonLocalReturn], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addMethod( "_visitIRAssignment_", smalltalk.method({ selector: "visitIRAssignment:", fn: function (anIRAssignment){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$1; $2=_st(self)._shouldInlineAssignment_(anIRAssignment); if(smalltalk.assert($2)){ $1=_st(_st(self)._assignmentInliner())._inlineAssignment_(anIRAssignment); } else { $1=smalltalk.IRVisitor.fn.prototype._visitIRAssignment_.apply(_st(self), [anIRAssignment]); }; return $1; }, self, "visitIRAssignment:", [anIRAssignment], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addMethod( "_visitIRNonLocalReturn_", smalltalk.method({ selector: "visitIRNonLocalReturn:", fn: function (anIRNonLocalReturn){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$1; $2=_st(self)._shouldInlineReturn_(anIRNonLocalReturn); if(smalltalk.assert($2)){ $1=_st(_st(self)._nonLocalReturnInliner())._inlineReturn_(anIRNonLocalReturn); } else { $1=_st(self)._transformNonLocalReturn_(anIRNonLocalReturn); }; return $1; }, self, "visitIRNonLocalReturn:", [anIRNonLocalReturn], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addMethod( "_visitIRReturn_", smalltalk.method({ selector: "visitIRReturn:", fn: function (anIRReturn){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$1; $2=_st(self)._shouldInlineReturn_(anIRReturn); if(smalltalk.assert($2)){ $1=_st(_st(self)._returnInliner())._inlineReturn_(anIRReturn); } else { $1=smalltalk.IRVisitor.fn.prototype._visitIRReturn_.apply(_st(self), [anIRReturn]); }; return $1; }, self, "visitIRReturn:", [anIRReturn], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addMethod( "_visitIRSend_", smalltalk.method({ selector: "visitIRSend:", fn: function (anIRSend){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$1; $2=_st(self)._shouldInlineSend_(anIRSend); if(smalltalk.assert($2)){ $1=_st(_st(self)._sendInliner())._inlineSend_(anIRSend); } else { $1=smalltalk.IRVisitor.fn.prototype._visitIRSend_.apply(_st(self), [anIRSend]); }; return $1; }, self, "visitIRSend:", [anIRSend], smalltalk.IRInliner)} }), smalltalk.IRInliner); smalltalk.addClass('IRInliningJSTranslator', smalltalk.IRJSTranslator, [], 'Compiler-Inlining'); smalltalk.addMethod( "_visitIRInlinedAssignment_", smalltalk.method({ selector: "visitIRInlinedAssignment:", fn: function (anIRInlinedAssignment){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._visit_(_st(_st(anIRInlinedAssignment)._instructions())._last()); return self}, self, "visitIRInlinedAssignment:", [anIRInlinedAssignment], smalltalk.IRInliningJSTranslator)} }), smalltalk.IRInliningJSTranslator); smalltalk.addMethod( "_visitIRInlinedClosure_", smalltalk.method({ selector: "visitIRInlinedClosure:", fn: function (anIRInlinedClosure){ var self=this; return smalltalk.withContext(function($ctx) { _st(_st(anIRInlinedClosure)._instructions())._do_((function(each){ return _st(self)._visit_(each); })); return self}, self, "visitIRInlinedClosure:", [anIRInlinedClosure], smalltalk.IRInliningJSTranslator)} }), smalltalk.IRInliningJSTranslator); smalltalk.addMethod( "_visitIRInlinedIfFalse_", smalltalk.method({ selector: "visitIRInlinedIfFalse:", fn: function (anIRInlinedIfFalse){ var self=this; return smalltalk.withContext(function($ctx) { _st(_st(self)._stream())._nextPutIf_with_((function(){ _st(_st(self)._stream())._nextPutAll_("! smalltalk.assert("); _st(self)._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._first()); return _st(_st(self)._stream())._nextPutAll_(")"); }),(function(){ return _st(self)._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last()); })); return self}, self, "visitIRInlinedIfFalse:", [anIRInlinedIfFalse], smalltalk.IRInliningJSTranslator)} }), smalltalk.IRInliningJSTranslator); smalltalk.addMethod( "_visitIRInlinedIfNil_", smalltalk.method({ selector: "visitIRInlinedIfNil:", fn: function (anIRInlinedIfNil){ var self=this; return smalltalk.withContext(function($ctx) { _st(_st(self)._stream())._nextPutIf_with_((function(){ _st(_st(self)._stream())._nextPutAll_("($receiver = "); _st(self)._visit_(_st(_st(anIRInlinedIfNil)._instructions())._first()); return _st(_st(self)._stream())._nextPutAll_(") == nil || $receiver == undefined"); }),(function(){ return _st(self)._visit_(_st(_st(anIRInlinedIfNil)._instructions())._last()); })); return self}, self, "visitIRInlinedIfNil:", [anIRInlinedIfNil], smalltalk.IRInliningJSTranslator)} }), smalltalk.IRInliningJSTranslator); smalltalk.addMethod( "_visitIRInlinedIfNilIfNotNil_", smalltalk.method({ selector: "visitIRInlinedIfNilIfNotNil:", fn: function (anIRInlinedIfNilIfNotNil){ var self=this; return smalltalk.withContext(function($ctx) { _st(_st(self)._stream())._nextPutIfElse_with_with_((function(){ _st(_st(self)._stream())._nextPutAll_("($receiver = "); _st(self)._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._first()); return _st(_st(self)._stream())._nextPutAll_(") == nil || $receiver == undefined"); }),(function(){ return _st(self)._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._second()); }),(function(){ return _st(self)._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third()); })); return self}, self, "visitIRInlinedIfNilIfNotNil:", [anIRInlinedIfNilIfNotNil], smalltalk.IRInliningJSTranslator)} }), smalltalk.IRInliningJSTranslator); smalltalk.addMethod( "_visitIRInlinedIfTrue_", smalltalk.method({ selector: "visitIRInlinedIfTrue:", fn: function (anIRInlinedIfTrue){ var self=this; return smalltalk.withContext(function($ctx) { _st(_st(self)._stream())._nextPutIf_with_((function(){ _st(_st(self)._stream())._nextPutAll_("smalltalk.assert("); _st(self)._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._first()); return _st(_st(self)._stream())._nextPutAll_(")"); }),(function(){ return _st(self)._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last()); })); return self}, self, "visitIRInlinedIfTrue:", [anIRInlinedIfTrue], smalltalk.IRInliningJSTranslator)} }), smalltalk.IRInliningJSTranslator); smalltalk.addMethod( "_visitIRInlinedIfTrueIfFalse_", smalltalk.method({ selector: "visitIRInlinedIfTrueIfFalse:", fn: function (anIRInlinedIfTrueIfFalse){ var self=this; return smalltalk.withContext(function($ctx) { _st(_st(self)._stream())._nextPutIfElse_with_with_((function(){ _st(_st(self)._stream())._nextPutAll_("smalltalk.assert("); _st(self)._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._first()); return _st(_st(self)._stream())._nextPutAll_(")"); }),(function(){ return _st(self)._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._second()); }),(function(){ return _st(self)._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third()); })); return self}, self, "visitIRInlinedIfTrueIfFalse:", [anIRInlinedIfTrueIfFalse], smalltalk.IRInliningJSTranslator)} }), smalltalk.IRInliningJSTranslator); smalltalk.addMethod( "_visitIRInlinedNonLocalReturn_", smalltalk.method({ selector: "visitIRInlinedNonLocalReturn:", fn: function (anIRInlinedReturn){ var self=this; return smalltalk.withContext(function($ctx) { _st(_st(self)._stream())._nextPutStatementWith_((function(){ return _st(self)._visit_(_st(_st(anIRInlinedReturn)._instructions())._last()); })); _st(_st(self)._stream())._nextPutNonLocalReturnWith_((function(){ })); return self}, self, "visitIRInlinedNonLocalReturn:", [anIRInlinedReturn], smalltalk.IRInliningJSTranslator)} }), smalltalk.IRInliningJSTranslator); smalltalk.addMethod( "_visitIRInlinedReturn_", smalltalk.method({ selector: "visitIRInlinedReturn:", fn: function (anIRInlinedReturn){ var self=this; return smalltalk.withContext(function($ctx) { _st(self)._visit_(_st(_st(anIRInlinedReturn)._instructions())._last()); return self}, self, "visitIRInlinedReturn:", [anIRInlinedReturn], smalltalk.IRInliningJSTranslator)} }), smalltalk.IRInliningJSTranslator); smalltalk.addMethod( "_visitIRInlinedSequence_", smalltalk.method({ selector: "visitIRInlinedSequence:", fn: function (anIRInlinedSequence){ var self=this; return smalltalk.withContext(function($ctx) { _st(_st(anIRInlinedSequence)._instructions())._do_((function(each){ return _st(_st(self)._stream())._nextPutStatementWith_((function(){ return _st(self)._visit_(each); })); })); return self}, self, "visitIRInlinedSequence:", [anIRInlinedSequence], smalltalk.IRInliningJSTranslator)} }), smalltalk.IRInliningJSTranslator); smalltalk.addClass('IRSendInliner', smalltalk.Object, ['send', 'translator'], 'Compiler-Inlining'); smalltalk.addMethod( "_ifFalse_", smalltalk.method({ selector: "ifFalse:", fn: function (anIRInstruction){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._inlinedSend_with_(_st((smalltalk.IRInlinedIfFalse || IRInlinedIfFalse))._new(),anIRInstruction); return $1; }, self, "ifFalse:", [anIRInstruction], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_ifFalse_ifTrue_", smalltalk.method({ selector: "ifFalse:ifTrue:", fn: function (anIRInstruction,anotherIRInstruction){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._perform_withArguments_(smalltalk.symbolFor("ifTrue:ifFalse:"),[anotherIRInstruction,anIRInstruction]); return $1; }, self, "ifFalse:ifTrue:", [anIRInstruction,anotherIRInstruction], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_ifNil_", smalltalk.method({ selector: "ifNil:", fn: function (anIRInstruction){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$4,$5,$1; $2=_st((smalltalk.IRClosure || IRClosure))._new(); _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy()); $3=_st((smalltalk.IRBlockSequence || IRBlockSequence))._new(); _st($3)._add_(_st(_st(_st(self)._send())._instructions())._first()); $4=_st($3)._yourself(); _st($2)._add_($4); $5=_st($2)._yourself(); $1=_st(self)._inlinedSend_with_with_(_st((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil))._new(),anIRInstruction,$5); return $1; }, self, "ifNil:", [anIRInstruction], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_ifNil_ifNotNil_", smalltalk.method({ selector: "ifNil:ifNotNil:", fn: function (anIRInstruction,anotherIRInstruction){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._inlinedSend_with_with_(_st((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil))._new(),anIRInstruction,anotherIRInstruction); return $1; }, self, "ifNil:ifNotNil:", [anIRInstruction,anotherIRInstruction], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_ifNotNil_", smalltalk.method({ selector: "ifNotNil:", fn: function (anIRInstruction){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$4,$5,$1; $2=_st((smalltalk.IRClosure || IRClosure))._new(); _st($2)._scope_(_st(_st(anIRInstruction)._scope())._copy()); $3=_st((smalltalk.IRBlockSequence || IRBlockSequence))._new(); _st($3)._add_(_st(_st(_st(self)._send())._instructions())._first()); $4=_st($3)._yourself(); _st($2)._add_($4); $5=_st($2)._yourself(); $1=_st(self)._inlinedSend_with_with_(_st((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil))._new(),$5,anIRInstruction); return $1; }, self, "ifNotNil:", [anIRInstruction], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_ifNotNil_ifNil_", smalltalk.method({ selector: "ifNotNil:ifNil:", fn: function (anIRInstruction,anotherIRInstruction){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._inlinedSend_with_with_(_st((smalltalk.IRInlinedIfNilIfNotNil || IRInlinedIfNilIfNotNil))._new(),anotherIRInstruction,anIRInstruction); return $1; }, self, "ifNotNil:ifNil:", [anIRInstruction,anotherIRInstruction], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_ifTrue_", smalltalk.method({ selector: "ifTrue:", fn: function (anIRInstruction){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._inlinedSend_with_(_st((smalltalk.IRInlinedIfTrue || IRInlinedIfTrue))._new(),anIRInstruction); return $1; }, self, "ifTrue:", [anIRInstruction], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_ifTrue_ifFalse_", smalltalk.method({ selector: "ifTrue:ifFalse:", fn: function (anIRInstruction,anotherIRInstruction){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st(self)._inlinedSend_with_with_(_st((smalltalk.IRInlinedIfTrueIfFalse || IRInlinedIfTrueIfFalse))._new(),anIRInstruction,anotherIRInstruction); return $1; }, self, "ifTrue:ifFalse:", [anIRInstruction,anotherIRInstruction], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_inlineClosure_", smalltalk.method({ selector: "inlineClosure:", fn: function (anIRClosure){ var self=this; return smalltalk.withContext(function($ctx) { var $1,$2; var inlinedClosure; var sequence; var statements; inlinedClosure=_st(self)._inlinedClosure(); _st(inlinedClosure)._scope_(_st(anIRClosure)._scope()); _st(_st(anIRClosure)._instructions())._do_((function(each){ $1=_st(each)._isSequence(); if(! smalltalk.assert($1)){ return _st(inlinedClosure)._add_(each); }; })); sequence=_st(self)._inlinedSequence(); _st(inlinedClosure)._add_(sequence); statements=_st(_st(_st(anIRClosure)._instructions())._last())._instructions(); _st(statements)._ifNotEmpty_((function(){ _st(_st(statements)._allButLast())._do_((function(each){ return _st(sequence)._add_(each); })); $2=_st(_st(_st(statements)._last())._isReturn())._and_((function(){ return _st(_st(statements)._last())._isBlockReturn(); })); if(smalltalk.assert($2)){ return _st(sequence)._add_(_st(_st(_st(statements)._last())._instructions())._first()); } else { return _st(sequence)._add_(_st(statements)._last()); }; })); return inlinedClosure; }, self, "inlineClosure:", [anIRClosure], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_inlineSend_", smalltalk.method({ selector: "inlineSend:", fn: function (anIRSend){ var self=this; return smalltalk.withContext(function($ctx) { var $1; _st(self)._send_(anIRSend); $1=_st(self)._perform_withArguments_(_st(_st(self)._send())._selector(),_st(_st(_st(self)._send())._instructions())._allButFirst()); return $1; }, self, "inlineSend:", [anIRSend], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_inlinedClosure", smalltalk.method({ selector: "inlinedClosure", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st((smalltalk.IRInlinedClosure || IRInlinedClosure))._new(); return $1; }, self, "inlinedClosure", [], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_inlinedSend_with_", smalltalk.method({ selector: "inlinedSend:with:", fn: function (inlinedSend,anIRInstruction){ var self=this; return smalltalk.withContext(function($ctx) { var $1,$2,$3; var inlinedClosure; $1=_st(anIRInstruction)._isClosure(); if(! smalltalk.assert($1)){ _st(self)._inliningError_("Message argument should be a block"); }; $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0)); if(! smalltalk.assert($2)){ _st(self)._inliningError_("Inlined block should have zero argument"); }; inlinedClosure=_st(_st(self)._translator())._visit_(_st(self)._inlineClosure_(anIRInstruction)); _st(inlinedSend)._add_(_st(_st(_st(self)._send())._instructions())._first()); $3=_st(inlinedSend)._add_(inlinedClosure); _st(_st(self)._send())._replaceWith_(inlinedSend); return inlinedSend; }, self, "inlinedSend:with:", [inlinedSend,anIRInstruction], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_inlinedSend_with_with_", smalltalk.method({ selector: "inlinedSend:with:with:", fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){ var self=this; return smalltalk.withContext(function($ctx) { var $1,$2,$3,$4,$5; var inlinedClosure1; var inlinedClosure2; $1=_st(anIRInstruction)._isClosure(); if(! smalltalk.assert($1)){ _st(self)._inliningError_("Message argument should be a block"); }; $2=_st(_st(_st(anIRInstruction)._arguments())._size()).__eq((0)); if(! smalltalk.assert($2)){ _st(self)._inliningError_("Inlined block should have zero argument"); }; $3=_st(anotherIRInstruction)._isClosure(); if(! smalltalk.assert($3)){ _st(self)._inliningError_("Message argument should be a block"); }; $4=_st(_st(_st(anotherIRInstruction)._arguments())._size()).__eq((0)); if(! smalltalk.assert($4)){ _st(self)._inliningError_("Inlined block should have zero argument"); }; inlinedClosure1=_st(_st(self)._translator())._visit_(_st(self)._inlineClosure_(anIRInstruction)); inlinedClosure2=_st(_st(self)._translator())._visit_(_st(self)._inlineClosure_(anotherIRInstruction)); _st(inlinedSend)._add_(_st(_st(_st(self)._send())._instructions())._first()); _st(inlinedSend)._add_(inlinedClosure1); $5=_st(inlinedSend)._add_(inlinedClosure2); _st(_st(self)._send())._replaceWith_(inlinedSend); return inlinedSend; }, self, "inlinedSend:with:with:", [inlinedSend,anIRInstruction,anotherIRInstruction], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_inlinedSequence", smalltalk.method({ selector: "inlinedSequence", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st((smalltalk.IRInlinedSequence || IRInlinedSequence))._new(); return $1; }, self, "inlinedSequence", [], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_inliningError_", smalltalk.method({ selector: "inliningError:", fn: function (aString){ var self=this; return smalltalk.withContext(function($ctx) { _st((smalltalk.InliningError || InliningError))._signal_(aString); return self}, self, "inliningError:", [aString], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_send", smalltalk.method({ selector: "send", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self["@send"]; }, self, "send", [], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_send_", smalltalk.method({ selector: "send:", fn: function (anIRSend){ var self=this; return smalltalk.withContext(function($ctx) { self["@send"]=anIRSend; return self}, self, "send:", [anIRSend], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_translator", smalltalk.method({ selector: "translator", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self["@translator"]; }, self, "translator", [], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_translator_", smalltalk.method({ selector: "translator:", fn: function (anASTTranslator){ var self=this; return smalltalk.withContext(function($ctx) { self["@translator"]=anASTTranslator; return self}, self, "translator:", [anASTTranslator], smalltalk.IRSendInliner)} }), smalltalk.IRSendInliner); smalltalk.addMethod( "_inlinedSelectors", smalltalk.method({ selector: "inlinedSelectors", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil"]; }, self, "inlinedSelectors", [], smalltalk.IRSendInliner.klass)} }), smalltalk.IRSendInliner.klass); smalltalk.addMethod( "_shouldInline_", smalltalk.method({ selector: "shouldInline:", fn: function (anIRInstruction){ var self=this; return smalltalk.withContext(function($ctx) { var $1,$2; var $early={}; try { $1=_st(_st(self)._inlinedSelectors())._includes_(_st(anIRInstruction)._selector()); if(! smalltalk.assert($1)){ return false; }; _st(_st(_st(anIRInstruction)._instructions())._allButFirst())._do_((function(each){ $2=_st(each)._isClosure(); if(! smalltalk.assert($2)){ throw $early=[false]; }; })); return true; } catch(e) {if(e===$early)return e[0]; throw e} }, self, "shouldInline:", [anIRInstruction], smalltalk.IRSendInliner.klass)} }), smalltalk.IRSendInliner.klass); smalltalk.addClass('IRAssignmentInliner', smalltalk.IRSendInliner, ['assignment'], 'Compiler-Inlining'); smalltalk.addMethod( "_assignment", smalltalk.method({ selector: "assignment", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { return self["@assignment"]; }, self, "assignment", [], smalltalk.IRAssignmentInliner)} }), smalltalk.IRAssignmentInliner); smalltalk.addMethod( "_assignment_", smalltalk.method({ selector: "assignment:", fn: function (aNode){ var self=this; return smalltalk.withContext(function($ctx) { self["@assignment"]=aNode; return self}, self, "assignment:", [aNode], smalltalk.IRAssignmentInliner)} }), smalltalk.IRAssignmentInliner); smalltalk.addMethod( "_inlineAssignment_", smalltalk.method({ selector: "inlineAssignment:", fn: function (anIRAssignment){ var self=this; return smalltalk.withContext(function($ctx) { var inlinedAssignment; _st(self)._assignment_(anIRAssignment); inlinedAssignment=_st((smalltalk.IRInlinedAssignment || IRInlinedAssignment))._new(); _st(_st(anIRAssignment)._instructions())._do_((function(each){ return _st(inlinedAssignment)._add_(each); })); _st(anIRAssignment)._replaceWith_(inlinedAssignment); _st(self)._inlineSend_(_st(_st(inlinedAssignment)._instructions())._last()); return inlinedAssignment; }, self, "inlineAssignment:", [anIRAssignment], smalltalk.IRAssignmentInliner)} }), smalltalk.IRAssignmentInliner); smalltalk.addMethod( "_inlineClosure_", smalltalk.method({ selector: "inlineClosure:", fn: function (anIRClosure){ var self=this; return smalltalk.withContext(function($ctx) { var $1,$2,$3; var inlinedClosure; var statements; inlinedClosure=smalltalk.IRSendInliner.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]); statements=_st(_st(_st(inlinedClosure)._instructions())._last())._instructions(); _st(statements)._ifNotEmpty_((function(){ $1=_st(_st(statements)._last())._canBeAssigned(); if(smalltalk.assert($1)){ $2=_st((smalltalk.IRAssignment || IRAssignment))._new(); _st($2)._add_(_st(_st(_st(self)._assignment())._instructions())._first()); _st($2)._add_(_st(_st(statements)._last())._copy()); $3=_st($2)._yourself(); return _st(_st(statements)._last())._replaceWith_($3); }; })); return inlinedClosure; }, self, "inlineClosure:", [anIRClosure], smalltalk.IRAssignmentInliner)} }), smalltalk.IRAssignmentInliner); smalltalk.addClass('IRNonLocalReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining'); smalltalk.addMethod( "_inlineClosure_", smalltalk.method({ selector: "inlineClosure:", fn: function (anIRClosure){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=smalltalk.IRSendInliner.fn.prototype._inlineCLosure_.apply(_st(self), [anIRClosure]); return $1; }, self, "inlineClosure:", [anIRClosure], smalltalk.IRNonLocalReturnInliner)} }), smalltalk.IRNonLocalReturnInliner); smalltalk.addMethod( "_inlinedReturn", smalltalk.method({ selector: "inlinedReturn", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st((smalltalk.IRInlinedNonLocalReturn || IRInlinedNonLocalReturn))._new(); return $1; }, self, "inlinedReturn", [], smalltalk.IRNonLocalReturnInliner)} }), smalltalk.IRNonLocalReturnInliner); smalltalk.addClass('IRReturnInliner', smalltalk.IRSendInliner, [], 'Compiler-Inlining'); smalltalk.addMethod( "_inlineClosure_", smalltalk.method({ selector: "inlineClosure:", fn: function (anIRClosure){ var self=this; return smalltalk.withContext(function($ctx) { var $1,$2,$3; var closure; var statements; closure=smalltalk.IRSendInliner.fn.prototype._inlineClosure_.apply(_st(self), [anIRClosure]); statements=_st(_st(_st(closure)._instructions())._last())._instructions(); _st(statements)._ifNotEmpty_((function(){ $1=_st(_st(statements)._last())._isReturn(); if(! smalltalk.assert($1)){ $2=_st((smalltalk.IRReturn || IRReturn))._new(); _st($2)._add_(_st(_st(statements)._last())._copy()); $3=_st($2)._yourself(); return _st(_st(statements)._last())._replaceWith_($3); }; })); return closure; }, self, "inlineClosure:", [anIRClosure], smalltalk.IRReturnInliner)} }), smalltalk.IRReturnInliner); smalltalk.addMethod( "_inlineReturn_", smalltalk.method({ selector: "inlineReturn:", fn: function (anIRReturn){ var self=this; return smalltalk.withContext(function($ctx) { var return_; return_=_st(self)._inlinedReturn(); _st(_st(anIRReturn)._instructions())._do_((function(each){ return _st(return_)._add_(each); })); _st(anIRReturn)._replaceWith_(return_); _st(self)._inlineSend_(_st(_st(return_)._instructions())._last()); return return_; }, self, "inlineReturn:", [anIRReturn], smalltalk.IRReturnInliner)} }), smalltalk.IRReturnInliner); smalltalk.addMethod( "_inlinedReturn", smalltalk.method({ selector: "inlinedReturn", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st((smalltalk.IRInlinedReturn || IRInlinedReturn))._new(); return $1; }, self, "inlinedReturn", [], smalltalk.IRReturnInliner)} }), smalltalk.IRReturnInliner); smalltalk.addClass('InliningCodeGenerator', smalltalk.CodeGenerator, [], 'Compiler-Inlining'); smalltalk.addMethod( "_compileNode_", smalltalk.method({ selector: "compileNode:", fn: function (aNode){ var self=this; return smalltalk.withContext(function($ctx) { var $2,$3,$1; var ir; var stream; _st(_st(self)._semanticAnalyzer())._visit_(aNode); ir=_st(_st(self)._translator())._visit_(aNode); _st(_st(self)._inliner())._visit_(ir); $2=_st(self)._irTranslator(); _st($2)._visit_(ir); $3=_st($2)._contents(); $1=$3; return $1; }, self, "compileNode:", [aNode], smalltalk.InliningCodeGenerator)} }), smalltalk.InliningCodeGenerator); smalltalk.addMethod( "_inliner", smalltalk.method({ selector: "inliner", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st((smalltalk.IRInliner || IRInliner))._new(); return $1; }, self, "inliner", [], smalltalk.InliningCodeGenerator)} }), smalltalk.InliningCodeGenerator); smalltalk.addMethod( "_irTranslator", smalltalk.method({ selector: "irTranslator", fn: function (){ var self=this; return smalltalk.withContext(function($ctx) { var $1; $1=_st((smalltalk.IRInliningJSTranslator || IRInliningJSTranslator))._new(); return $1; }, self, "irTranslator", [], smalltalk.InliningCodeGenerator)} }), smalltalk.InliningCodeGenerator);