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

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


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

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

Name: VMMakerJS-bf.6
Author: bf
Time: 6 October 2014, 7:51:38.88 pm
UUID: 5a894215-89a3-4405-9136-eafdf08fb0a2
Ancestors: VMMakerJS-bf.5

Fix bitshift.

=============== Diff against VMMakerJS-bf.5 ===============

Item was changed:
  ----- Method: JSPluginCodeGenerator>>emitJSHeaderOn: (in category 'JS code generator') -----
  emitJSHeaderOn: aStream
  	"Write a JS file header onto the given stream."
  
  	aStream nextPutAll: '/* '.
  	aStream nextPutAll: (VMMaker headerNotice copyReplaceAll: ' C ' with: ' JS ').
  	aStream nextPutAll: ' */';cr.
  	aStream nextPutAll: (self fileHeaderVersionStampForSourceClass: vmClass).
  	aStream nextPutAll: '
  module("users.bert.SqueakJS.plugins.', pluginName, '").requires("users.bert.SqueakJS.vm").toRun(function() {
  
  var VM_PROXY_MAJOR = ', InterpreterPrimitives vmProxyMajorVersion, ';
  var VM_PROXY_MINOR = ', InterpreterPrimitives vmProxyMinorVersion, ';
  
  /*** Functions ***/
  function CLASSOF(obj) { return typeof obj === "number" ? interpreterProxy.classSmallInteger() : obj.sqClass }
  function SIZEOF(obj) { return obj.pointers ? obj.pointers.length : obj.words ? obj.words.length : obj.bytes ? obj.bytes.length : 0 }
  function BYTESIZEOF(obj) { return obj.bytes ? obj.bytes.length : obj.words ? obj.words.length * 4 : 0 }
  function DIV(a, b) { return Math.floor(a / b) | 0; }   // integer division
  function MOD(a, b) { return a - DIV(a, b) * b | 0; }   // signed modulus
  function SHL(a, b) { return b > 31 ? 0 : a << b; }     // fix JS shift
  function SHR(a, b) { return b > 31 ? 0 : a >>> b; }    // fix JS shift
+ function SHIFT(a, b) { return b < 0 ? (b < -31 ? 0 : a >>> (0-b) ) : (b > 31 ? 0 : a << b); }
- function SHIFT(a, b) { return b < 0 ? (b < -31 ? 0 : a >>> (0-b) ) : (b > 31 ? 0 : b << a); }
  
  '.!



More information about the Vm-dev mailing list