mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Avoid slow linear growth of Queues used in the JIT (534168, r=dvander).
This commit is contained in:
parent
e3cb70404e
commit
7a543ac5b0
@ -66,10 +66,11 @@ class Queue {
|
||||
|
||||
public:
|
||||
void ensure(unsigned size) {
|
||||
if (_max > size)
|
||||
return;
|
||||
if (!_max)
|
||||
_max = 16;
|
||||
while (_max < size)
|
||||
_max <<= 1;
|
||||
_max = 8;
|
||||
_max = JS_MAX(_max * 2, size);
|
||||
if (alloc) {
|
||||
T* tmp = new (*alloc) T[_max];
|
||||
memcpy(tmp, _data, _len * sizeof(T));
|
||||
|
Loading…
Reference in New Issue
Block a user