Use fastMalloc to allocate 64KB aligned memory because BREW has neither VirtualAlloc nor mmap. There is no way to allocate aligned memory in BREW.
Created attachment 48154 [details] Patch This is not a space-efficient way to allocate aligned memory. Any suggestion to improve this?
Comment on attachment 48154 [details] Patch I don't understand why m_rawMemoryMap is needed. Isn't the conversion from requested address to real address always the same?
Comment on attachment 48154 [details] Patch I would have called addressAligned alignedAddress, but that's just a nit. To answer Eric's question, the two are different in the case were fastMalloc returns an unaligned address because + addressAligned &= BLOCK_MASK; changes the address. This patch is horribly memory inefficient. It seems to cause JavaScript use about twice as much memory as necessary. I'd recommend finding another strategy to allocate aligned addresses.
Created attachment 57131 [details] Moved the advance logic from Heap::allocate to CollectorBitmap::advanceToNextPossibleFreeCell.
Comment on attachment 57131 [details] Moved the advance logic from Heap::allocate to CollectorBitmap::advanceToNextPossibleFreeCell. sorry, wrong bug.
This patch is no longer necessary as Heap::allocateBlock and Heap::freeBlock are changed to use AlignedMemoryAllocator.