[Vm-dev] VM Maker: VMMakerJS-bf.10.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Oct 10 13:46:58 UTC 2014


Bert Freudenberg uploaded a new version of VMMakerJS to project VM Maker:
http://source.squeak.org/VMMaker/VMMakerJS-bf.10.mcz

==================== Summary ====================

Name: VMMakerJS-bf.10
Author: bf
Time: 7 October 2014, 5:31:22.547 pm
UUID: 20be900f-cb88-4585-bfdd-7e00f6afdd02
Ancestors: VMMakerJS-bf.9

Fix float divide

=============== Diff against VMMakerJS-bf.9 ===============

Item was changed:
  ----- Method: JSCodeGenerator>>generateDivide:on:indent: (in category 'JS translation') -----
  generateDivide: msgNode on: aStream indent: level
  	"Generate the JS code for this message onto the given stream."
  
  	| rcvr arg divisor |
  	rcvr := msgNode receiver.
  	arg := msgNode args first.
+ 	msgNode selector == #/ ifTrue: [
+ 		(#('Matrix2x3Plugin' 'ScratchPlugin' 'FloatArrayPlugin' 'KedamaPlugin' 'KedamaPlugin2' 'FFTPlugin' 'Klatt') includes: self pluginName) ifFalse: [self halt].
- 	(msgNode selector == #/ and: [self pluginName = 'ScratchPlugin']) ifTrue: [
  		self emitJSExpression: rcvr on: aStream.
  		aStream nextPutAll: ' / '.
  		^self emitJSExpression: arg on: aStream].
  	(arg isConstant and:
  	 [UseRightShiftForDivide and:
  	 [(divisor := arg value) isInteger and:
  	 [divisor isPowerOfTwo and:
  	 [divisor > 0 and:
  	 [divisor <= (1 bitShift: 31)]]]]])
  	ifTrue: [
  		"use signed (arithmetic) right shift instead of divide"
  		self emitJSExpression: rcvr on: aStream.
  		aStream nextPutAll: ' >> ', (divisor log: 2) asInteger printString.
  	] ifFalse: [
  		"use float divide and coerce to integer"
  		aStream nextPutAll: 'DIV('.
  		self emitJSExpression: rcvr on: aStream.
  		aStream nextPutAll: ', '.
  		self emitJSExpression: arg on: aStream.
  		aStream nextPutAll: ')'.
  	].
  !



More information about the Vm-dev mailing list