Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@glimmer/program

Package Overview
Dependencies
Maintainers
10
Versions
243
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glimmer/program - npm Package Compare versions

Comparing version 0.28.3 to 0.29.0

157

dist/amd/es5/glimmer-program.js

@@ -25,10 +25,23 @@ define('@glimmer/program', ['exports', '@glimmer/encoder'], function (exports, _glimmer_encoder) { 'use strict';

this.floats = [];
this.negatives = [];
}
WriteOnlyConstants.prototype.float = function float(_float) {
return this.floats.push(_float);
var index = this.floats.indexOf(_float);
if (index > -1) {
return index;
}
return this.floats.push(_float) - 1;
};
WriteOnlyConstants.prototype.negative = function negative(_negative) {
return this.negatives.push(_negative);
};
WriteOnlyConstants.prototype.string = function string(value) {
return this.strings.push(value);
var index = this.strings.indexOf(value);
if (index > -1) {
return index;
}
return this.strings.push(value) - 1;
};

@@ -45,7 +58,15 @@

WriteOnlyConstants.prototype.array = function array(values) {
return this.arrays.push(values);
var index = this.arrays.indexOf(values);
if (index > -1) {
return index;
}
return this.arrays.push(values) - 1;
};
WriteOnlyConstants.prototype.table = function table(t) {
return this.tables.push(t);
var index = this.tables.indexOf(t);
if (index > -1) {
return index;
}
return this.tables.push(t) - 1;
};

@@ -59,3 +80,7 @@

WriteOnlyConstants.prototype.serializable = function serializable(value) {
return this.serializables.push(value);
var index = this.serializables.indexOf(value);
if (index > -1) {
return index;
}
return this.serializables.push(value) - 1;
};

@@ -70,3 +95,4 @@

serializables: this.serializables,
floats: this.floats
floats: this.floats,
negatives: this.negatives
};

@@ -89,2 +115,3 @@ };

this.floats = pool.floats;
this.negatives = pool.negatives;
this.resolved = this.handles.map(function () {

@@ -98,7 +125,11 @@ return UNRESOLVED;

RuntimeConstants.prototype.getFloat = function getFloat(value) {
return this.floats[value - 1];
return this.floats[value];
};
RuntimeConstants.prototype.getNegative = function getNegative(value) {
return this.negatives[value - 1];
};
RuntimeConstants.prototype.getString = function getString(value) {
return this.strings[value - 1];
return this.strings[value];
};

@@ -117,7 +148,7 @@

RuntimeConstants.prototype.getArray = function getArray(value) {
return this.arrays[value - 1];
return this.arrays[value];
};
RuntimeConstants.prototype.getSymbolTable = function getSymbolTable(value) {
return this.tables[value - 1];
return this.tables[value];
};

@@ -136,3 +167,3 @@

RuntimeConstants.prototype.getSerializable = function getSerializable(s) {
return this.serializables[s - 1];
return this.serializables[s];
};

@@ -157,2 +188,4 @@

_this.serializables = pool.serializables;
_this.floats = pool.floats;
_this.negatives = pool.negatives;
_this.resolved = _this.handles.map(function () {

@@ -167,4 +200,12 @@ return UNRESOLVED;

Constants.prototype.getFloat = function getFloat(value) {
return this.floats[value - 1];
};
Constants.prototype.getNegative = function getNegative(value) {
return this.negatives[value - 1];
};
Constants.prototype.getString = function getString(value) {
return this.strings[value - 1];
return this.strings[value];
};

@@ -183,7 +224,7 @@

Constants.prototype.getArray = function getArray(value) {
return this.arrays[value - 1];
return this.arrays[value];
};
Constants.prototype.getSymbolTable = function getSymbolTable(value) {
return this.tables[value - 1];
return this.tables[value];
};

@@ -202,3 +243,3 @@

Constants.prototype.getSerializable = function getSerializable(s) {
return this.serializables[s - 1];
return this.serializables[s];
};

@@ -294,18 +335,49 @@

var STATE_OFFSET = 3;
/**
* The Heap is responsible for dynamically allocating
* memory in which we read/write the VM's instructions
* from/to. When we malloc we pass out a VMHandle, which
* is used as an indirect way of accessing the memory during
* execution of the VM. Internally we track the different
* regions of the memory in an int array known as the table.
*
* The table has the following layout:
*
* | ... | table entry |
* | ... | hp | size | scope size | state |
* | ... | 0 | 122 | 3 | 0 |
* handle ^ | | ^ region state (allocated, freed, purged)
* region size ^ |
* number of symbols ^
*
* With this information we effectively have the ability to
* control when we want to free memory. That being said you
* can not free during execution as raw address are only
* valid during the execution. This means you cannot close
* over them as you will have a bad memory access exception.
*/
var Heap = function () {
function Heap() {
function Heap(serializedHeap) {
_classCallCheck$1(this, Heap);
this.heap = [];
this.offset = 0;
this.handle = 0;
/**
* layout:
*
* - pointer into heap
* - size
* - scope size
* - freed (0 or 1)
*/
this.table = [];
if (serializedHeap) {
var buffer = serializedHeap.buffer,
table = serializedHeap.table,
handle = serializedHeap.handle;
this.heap = new Uint16Array(buffer);
this.table = table;
this.offset = this.heap.length;
this.handle = handle;
} else {
if (typeof Uint16Array !== 'undefined') {
this.heap = new Uint16Array(0x100000);
} else {
// FIXME remove once we drop IE9
this.heap = new Array(0x100000);
}
this.table = [];
}
}

@@ -369,3 +441,11 @@

};
/**
* The heap uses the [Mark-Compact Algorithm](https://en.wikipedia.org/wiki/Mark-compact_algorithm) to shift
* reachable memory to the bottom of the heap and freeable
* memory to the top of the heap. When we have shifted all
* the reachable memory to the top of the heap, we move the
* offset to the next free position.
*/
Heap.prototype.compact = function compact() {

@@ -401,4 +481,10 @@ var compactedSize = 0;

Heap.prototype.toArray = function toArray() {
return this.heap.slice();
Heap.prototype.capture = function capture() {
// Only called in eager mode
var buffer = slice(this.heap, 0, this.offset);
return {
handle: this.handle,
table: this.table,
buffer: buffer
};
};

@@ -454,2 +540,15 @@

}(WriteOnlyProgram);
function slice(arr, start, end) {
if (arr instanceof Uint16Array) {
if (arr.slice !== undefined) {
return arr.slice(start, end).buffer;
}
var ret = new Uint16Array(end);
for (; start < end; start++) {
ret[start] = arr[start];
}
return ret.buffer;
}
return null;
}

@@ -470,2 +569,2 @@ exports.WriteOnlyConstants = WriteOnlyConstants;

//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2xpbW1lci1wcm9ncmFtLmpzIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9AZ2xpbW1lci9wcm9ncmFtL2xpYi9jb25zdGFudHMudHMiLCIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9AZ2xpbW1lci9wcm9ncmFtL2xpYi9vcGNvZGUudHMiLCIuLi8uLi8uLi8u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7In0=

69

dist/commonjs/es2017/lib/constants.js

@@ -17,8 +17,20 @@ "use strict";

this.floats = [];
this.negatives = [];
}
float(float) {
return this.floats.push(float);
let index = this.floats.indexOf(float);
if (index > -1) {
return index;
}
return this.floats.push(float) - 1;
}
negative(negative) {
return this.negatives.push(negative);
}
string(value) {
return this.strings.push(value);
let index = this.strings.indexOf(value);
if (index > -1) {
return index;
}
return this.strings.push(value) - 1;
}

@@ -33,6 +45,14 @@ stringArray(strings) {

array(values) {
return this.arrays.push(values);
let index = this.arrays.indexOf(values);
if (index > -1) {
return index;
}
return this.arrays.push(values) - 1;
}
table(t) {
return this.tables.push(t);
let index = this.tables.indexOf(t);
if (index > -1) {
return index;
}
return this.tables.push(t) - 1;
}

@@ -44,3 +64,7 @@ handle(handle) {

serializable(value) {
return this.serializables.push(value);
let index = this.serializables.indexOf(value);
if (index > -1) {
return index;
}
return this.serializables.push(value) - 1;
}

@@ -54,3 +78,4 @@ toPool() {

serializables: this.serializables,
floats: this.floats
floats: this.floats,
negatives: this.negatives
};

@@ -69,2 +94,3 @@ }

this.floats = pool.floats;
this.negatives = pool.negatives;
this.resolved = this.handles.map(() => UNRESOLVED);

@@ -74,6 +100,9 @@ }

getFloat(value) {
return this.floats[value - 1];
return this.floats[value];
}
getNegative(value) {
return this.negatives[value - 1];
}
getString(value) {
return this.strings[value - 1];
return this.strings[value];
}

@@ -90,6 +119,6 @@ getStringArray(value) {

getArray(value) {
return this.arrays[value - 1];
return this.arrays[value];
}
getSymbolTable(value) {
return this.tables[value - 1];
return this.tables[value];
}

@@ -106,3 +135,3 @@ resolveHandle(s) {

getSerializable(s) {
return this.serializables[s - 1];
return this.serializables[s];
}

@@ -121,2 +150,4 @@ }

this.serializables = pool.serializables;
this.floats = pool.floats;
this.negatives = pool.negatives;
this.resolved = this.handles.map(() => UNRESOLVED);

@@ -126,4 +157,10 @@ }

// `0` means NULL
getFloat(value) {
return this.floats[value - 1];
}
getNegative(value) {
return this.negatives[value - 1];
}
getString(value) {
return this.strings[value - 1];
return this.strings[value];
}

@@ -140,6 +177,6 @@ getStringArray(value) {

getArray(value) {
return this.arrays[value - 1];
return this.arrays[value];
}
getSymbolTable(value) {
return this.tables[value - 1];
return this.tables[value];
}

@@ -156,3 +193,3 @@ resolveHandle(s) {

getSerializable(s) {
return this.serializables[s - 1];
return this.serializables[s];
}

@@ -174,2 +211,2 @@ }

exports.LazyConstants = LazyConstants;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcGFja2FnZXMvQGdsaW1tZXIvcHJvZ3JhbS9saWIvY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBR0EsTUFBTSxBQUFVLGFBQUcsQUFBRSxBQUFDLEFBa0J0QixBQUFNOztrQkFDSixBQUFpQjtBQUVQO2FBQU8sVUFBYSxBQUFFLEFBQUMsQUFDdkI7YUFBTSxTQUFlLEFBQUUsQUFBQyxBQUN4QjthQUFNLFNBQWtCLEFBQUUsQUFBQyxBQUMzQjthQUFPLFVBQWEsQUFBRSxBQUFDLEFBQ3ZCO2FBQWEsZ0JBQWEsQUFBRSxBQUFDLEFBQzdCO2FBQVEsV0FBYSxBQUFFLEFBQUMsQUFDeEI7YUFBTSxTQUFhLEFBQUUsQUFBQyxBQStDbEMsQUFBQztBQTdDQyxBQUFLO1VBQUMsQUFBYSxPQUNqQixBQUFNO2VBQUMsQUFBSSxLQUFDLEFBQU0sT0FBQyxBQUFJLEtBQUMsQUFBSyxBQUFDLEFBQUMsQUFDakMsQUFBQztBQUVELEFBQU07V0FBQyxBQUFhLE9BQ2xCLEFBQU07ZUFBQyxBQUFJLEtBQUMsQUFBTyxRQUFDLEFBQUksS0FBQyxBQUFLLEFBQUMsQUFBQyxBQUNsQyxBQUFDO0FBRUQsQUFBVztn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gVDtcbiAgfVxufVxuXG5leHBvcnQgY2xhc3MgTGF6eUNvbnN0YW50cyBleHRlbmRzIENvbnN0YW50czxPcGFxdWU+IHtcbiAgcHJpdmF0ZSBvdGhlcnM6IE9wYXF1ZVtdID0gW107XG5cbiAgZ2V0T3RoZXI8VD4odmFsdWU6IG51bWJlcik6IFQge1xuICAgIHJldHVybiB0aGlzLm90aGVyc1t2YWx1ZSAtIDFdIGFzIFQ7XG4gIH1cblxuICBvdGhlcihvdGhlcjogT3BhcXVlKTogbnVtYmVyIHtcbiAgICByZXR1cm4gdGhpcy5vdGhlcnMucHVzaChvdGhlcik7XG4gIH1cbn1cbiJdfQ==

@@ -23,16 +23,44 @@ 'use strict';

const STATE_OFFSET = 3;
/**
* The Heap is responsible for dynamically allocating
* memory in which we read/write the VM's instructions
* from/to. When we malloc we pass out a VMHandle, which
* is used as an indirect way of accessing the memory during
* execution of the VM. Internally we track the different
* regions of the memory in an int array known as the table.
*
* The table has the following layout:
*
* | ... | table entry |
* | ... | hp | size | scope size | state |
* | ... | 0 | 122 | 3 | 0 |
* handle ^ | | ^ region state (allocated, freed, purged)
* region size ^ |
* number of symbols ^
*
* With this information we effectively have the ability to
* control when we want to free memory. That being said you
* can not free during execution as raw address are only
* valid during the execution. This means you cannot close
* over them as you will have a bad memory access exception.
*/
class Heap {
constructor() {
this.heap = [];
constructor(serializedHeap) {
this.offset = 0;
this.handle = 0;
/**
* layout:
*
* - pointer into heap
* - size
* - scope size
* - freed (0 or 1)
*/
this.table = [];
if (serializedHeap) {
let { buffer, table, handle } = serializedHeap;
this.heap = new Uint16Array(buffer);
this.table = table;
this.offset = this.heap.length;
this.handle = handle;
} else {
if (typeof Uint16Array !== 'undefined') {
this.heap = new Uint16Array(0x100000);
} else {
// FIXME remove once we drop IE9
this.heap = new Array(0x100000);
}
this.table = [];
}
}

@@ -87,2 +115,9 @@ push(item) {

}
/**
* The heap uses the [Mark-Compact Algorithm](https://en.wikipedia.org/wiki/Mark-compact_algorithm) to shift
* reachable memory to the bottom of the heap and freeable
* memory to the top of the heap. When we have shifted all
* the reachable memory to the top of the heap, we move the
* offset to the next free position.
*/
compact() {

@@ -114,4 +149,10 @@ let compactedSize = 0;

}
toArray() {
return this.heap.slice();
capture() {
// Only called in eager mode
let buffer = slice(this.heap, 0, this.offset);
return {
handle: this.handle,
table: this.table,
buffer: buffer
};
}

@@ -146,2 +187,15 @@ }

exports.Program = Program;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3JhbS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL0BnbGltbWVyL3Byb2dyYW0vbGliL3Byb2dyYW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUdBLEFBQU8sQUFBYSxBQUFrQixBQUFvQixBQUFNLEFBQWEsQUFBQzs7QUFDOUUsQUFBTyxBQUFFLEFBQU0sQUFBRSxBQUFNLEFBQVUsQUFBQzs7QUFHbEMsSUFBSyxBQUtKO0FBTEQsV0FBSyxBQUFjLGdCQUNqQjtzREFBUyxBQUNUO2tEQUFLLEFBQ0w7bURBQU0sQUFDTjtvREFBTyxBQUNULEFBQUM7R0FMSSxBQUFjLG1CQUFkLEFBQWMsaUJBS2xCO0FBRUQsTUFBTSxBQUFVLGFBQUcsQUFBQyxBQUFDO0FBQ3JCLE1BQU0sQUFBVyxjQUFHLEFBQUMsQUFBQztBQUN0QixNQUFNLEFBQWdCLG1CQUFHLEFBQUMsQUFBQztBQUMzQixNQUFNLEFBQVksZUFBRyxBQUFDLEFBQUMsQUFFdkIsQUFBTTs7a0JBQ0k7YUFBSSxPQUFhLEFBQUUsQUFBQyxBQUNwQjthQUFNLFNBQUcsQUFBQyxBQUFDLEFBQ1g7YUFBTSxTQUFHLEFBQUMsQUFBQyxBQUVuQixBQU9HO0FBQ0s7Ozs7Ozs7O2FBQUss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bnN0YW50cyA9IG5ldyBXcml0ZU9ubHlDb25zdGFudHMoKSwgcHVibGljIGhlYXAgPSBuZXcgSGVhcCgpKSB7XG4gICAgdGhpcy5fb3Bjb2RlID0gbmV3IE9wY29kZSh0aGlzLmhlYXApO1xuICB9XG5cbiAgb3Bjb2RlKG9mZnNldDogbnVtYmVyKTogT3Bjb2RlIHtcbiAgICB0aGlzLl9vcGNvZGUub2Zmc2V0ID0gb2Zmc2V0O1xuICAgIHJldHVybiB0aGlzLl9vcGNvZGU7XG4gIH1cbn1cblxuZXhwb3J0IGNsYXNzIFJ1bnRpbWVQcm9ncmFtPFNwZWNpZmllcj4ge1xuICBba2V5OiBudW1iZXJdOiBuZXZlcjtcblxuICBwcml2YXRlIF9vcGNvZGU6IE9wY29kZTtcblxuICBjb25zdHJ1Y3RvcihwdWJsaWMgY29uc3RhbnRzOiBSdW50aW1lQ29uc3RhbnRzPFNwZWNpZmllcj4sIHB1YmxpYyBoZWFwOiBIZWFwKSB7XG4gICAgdGhpcy5fb3Bjb2RlID0gbmV3IE9wY29kZSh0aGlzLmhlYXApO1xuICB9XG5cbiAgb3Bjb2RlKG9mZnNldDogbnVtYmVyKTogT3Bjb2RlIHtcbiAgICB0aGlzLl9vcGNvZGUub2Zmc2V0ID0gb2Zmc2V0O1xuICAgIHJldHVybiB0aGlzLl9vcGNvZGU7XG4gIH1cbn1cblxuZXhwb3J0IGNsYXNzIFByb2dyYW08U3BlY2lmaWVyPiBleHRlbmRzIFdyaXRlT25seVByb2dyYW0ge1xuICBwdWJsaWMgY29uc3RhbnRzOiBDb25zdGFudHM8U3BlY2lmaWVyPjtcbn1cbiJdfQ==
function slice(arr, start, end) {
if (arr instanceof Uint16Array) {
if (arr.slice !== undefined) {
return arr.slice(start, end).buffer;
}
let ret = new Uint16Array(end);
for (; start < end; start++) {
ret[start] = arr[start];
}
return ret.buffer;
}
return null;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaW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10 +46,23 @@ "use strict";

this.floats = [];
this.negatives = [];
}
WriteOnlyConstants.prototype.float = function float(_float) {
return this.floats.push(_float);
var index = this.floats.indexOf(_float);
if (index > -1) {
return index;
}
return this.floats.push(_float) - 1;
};
WriteOnlyConstants.prototype.negative = function negative(_negative) {
return this.negatives.push(_negative);
};
WriteOnlyConstants.prototype.string = function string(value) {
return this.strings.push(value);
var index = this.strings.indexOf(value);
if (index > -1) {
return index;
}
return this.strings.push(value) - 1;
};

@@ -66,7 +79,15 @@

WriteOnlyConstants.prototype.array = function array(values) {
return this.arrays.push(values);
var index = this.arrays.indexOf(values);
if (index > -1) {
return index;
}
return this.arrays.push(values) - 1;
};
WriteOnlyConstants.prototype.table = function table(t) {
return this.tables.push(t);
var index = this.tables.indexOf(t);
if (index > -1) {
return index;
}
return this.tables.push(t) - 1;
};

@@ -80,3 +101,7 @@

WriteOnlyConstants.prototype.serializable = function serializable(value) {
return this.serializables.push(value);
var index = this.serializables.indexOf(value);
if (index > -1) {
return index;
}
return this.serializables.push(value) - 1;
};

@@ -91,3 +116,4 @@

serializables: this.serializables,
floats: this.floats
floats: this.floats,
negatives: this.negatives
};

@@ -111,2 +137,3 @@ };

this.floats = pool.floats;
this.negatives = pool.negatives;
this.resolved = this.handles.map(function () {

@@ -120,7 +147,11 @@ return UNRESOLVED;

RuntimeConstants.prototype.getFloat = function getFloat(value) {
return this.floats[value - 1];
return this.floats[value];
};
RuntimeConstants.prototype.getNegative = function getNegative(value) {
return this.negatives[value - 1];
};
RuntimeConstants.prototype.getString = function getString(value) {
return this.strings[value - 1];
return this.strings[value];
};

@@ -139,7 +170,7 @@

RuntimeConstants.prototype.getArray = function getArray(value) {
return this.arrays[value - 1];
return this.arrays[value];
};
RuntimeConstants.prototype.getSymbolTable = function getSymbolTable(value) {
return this.tables[value - 1];
return this.tables[value];
};

@@ -158,3 +189,3 @@

RuntimeConstants.prototype.getSerializable = function getSerializable(s) {
return this.serializables[s - 1];
return this.serializables[s];
};

@@ -179,2 +210,4 @@

_this.serializables = pool.serializables;
_this.floats = pool.floats;
_this.negatives = pool.negatives;
_this.resolved = _this.handles.map(function () {

@@ -189,4 +222,12 @@ return UNRESOLVED;

Constants.prototype.getFloat = function getFloat(value) {
return this.floats[value - 1];
};
Constants.prototype.getNegative = function getNegative(value) {
return this.negatives[value - 1];
};
Constants.prototype.getString = function getString(value) {
return this.strings[value - 1];
return this.strings[value];
};

@@ -205,7 +246,7 @@

Constants.prototype.getArray = function getArray(value) {
return this.arrays[value - 1];
return this.arrays[value];
};
Constants.prototype.getSymbolTable = function getSymbolTable(value) {
return this.tables[value - 1];
return this.tables[value];
};

@@ -224,3 +265,3 @@

Constants.prototype.getSerializable = function getSerializable(s) {
return this.serializables[s - 1];
return this.serializables[s];
};

@@ -255,2 +296,2 @@

exports.LazyConstants = LazyConstants;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcGFja2FnZXMvQGdsaW1tZXIvcHJvZ3JhbS9saWIvY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFHQSxJQUFNLEFBQVUsYUFBRyxBQUFFLEFBQUMsQUFrQnRCLEFBQU07O0lBQU47a0NBQ0UsQUFBaUI7OEJBRVA7OzthQUFPLFVBQWEsQUFBRSxBQUFDLEFBQ3ZCO2FBQU0sU0FBZSxBQUFFLEFBQUMsQUFDeEI7YUFBTSxTQUFrQixBQUFFLEFBQUMsQUFDM0I7YUFBTyxVQUFhLEFBQUUsQUFBQyxBQUN2QjthQUFhLGdCQUFhLEFBQUUsQUFBQyxBQUM3QjthQUFRLFdBQWEsQUFBRSxBQUFDLEFBQ3hCO2FBQU0sU0FBYSxBQUFFLEFBQUMsQUEr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JvbFRhYmxlPFQgZXh0ZW5kcyBTeW1ib2xUYWJsZT4odmFsdWU6IG51bWJlcik6IFQge1xuICAgIHJldHVybiB0aGlzLnRhYmxlc1t2YWx1ZV0gYXMgVDtcbiAgfVxuXG4gIHJlc29sdmVIYW5kbGU8VD4oczogbnVtYmVyKTogVCB7XG4gICAgbGV0IGluZGV4ID0gcyAtIDE7XG4gICAgbGV0IHJlc29sdmVkID0gdGhpcy5yZXNvbHZlZFtpbmRleF07XG5cbiAgICBpZiAocmVzb2x2ZWQgPT09IFVOUkVTT0xWRUQpIHtcbiAgICAgIGxldCBoYW5kbGUgPSB0aGlzLmhhbmRsZXNbaW5kZXhdO1xuICAgICAgcmVzb2x2ZWQgPSB0aGlzLnJlc29sdmVkW2luZGV4XSA9IHRoaXMucmVzb2x2ZXIucmVzb2x2ZShoYW5kbGUpO1xuICAgIH1cblxuICAgIHJldHVybiByZXNvbHZlZCBhcyBUO1xuICB9XG5cbiAgZ2V0U2VyaWFsaXphYmxlPFQ+KHM6IG51bWJlcik6IFQge1xuICAgIHJldHVybiB0aGlzLnNlcmlhbGl6YWJsZXNbc10gYXMgVDtcbiAgfVxufVxuXG5leHBvcnQgY2xhc3MgTGF6eUNvbnN0YW50cyBleHRlbmRzIENvbnN0YW50czxPcGFxdWU+IHtcbiAgcHJpdmF0ZSBvdGhlcnM6IE9wYXF1ZVtdID0gW107XG5cbiAgZ2V0T3RoZXI8VD4odmFsdWU6IG51bWJlcik6IFQge1xuICAgIHJldHVybiB0aGlzLm90aGVyc1t2YWx1ZSAtIDFdIGFzIFQ7XG4gIH1cblxuICBvdGhlcihvdGhlcjogT3BhcXVlKTogbnVtYmVyIHtcbiAgICByZXR1cm4gdGhpcy5vdGhlcnMucHVzaChvdGhlcik7XG4gIH1cbn1cbiJdfQ==

@@ -49,18 +49,49 @@ "use strict";

var STATE_OFFSET = 3;
/**
* The Heap is responsible for dynamically allocating
* memory in which we read/write the VM's instructions
* from/to. When we malloc we pass out a VMHandle, which
* is used as an indirect way of accessing the memory during
* execution of the VM. Internally we track the different
* regions of the memory in an int array known as the table.
*
* The table has the following layout:
*
* | ... | table entry |
* | ... | hp | size | scope size | state |
* | ... | 0 | 122 | 3 | 0 |
* handle ^ | | ^ region state (allocated, freed, purged)
* region size ^ |
* number of symbols ^
*
* With this information we effectively have the ability to
* control when we want to free memory. That being said you
* can not free during execution as raw address are only
* valid during the execution. This means you cannot close
* over them as you will have a bad memory access exception.
*/
var Heap = exports.Heap = function () {
function Heap() {
function Heap(serializedHeap) {
_classCallCheck(this, Heap);
this.heap = [];
this.offset = 0;
this.handle = 0;
/**
* layout:
*
* - pointer into heap
* - size
* - scope size
* - freed (0 or 1)
*/
this.table = [];
if (serializedHeap) {
var buffer = serializedHeap.buffer,
table = serializedHeap.table,
handle = serializedHeap.handle;
this.heap = new Uint16Array(buffer);
this.table = table;
this.offset = this.heap.length;
this.handle = handle;
} else {
if (typeof Uint16Array !== 'undefined') {
this.heap = new Uint16Array(0x100000);
} else {
// FIXME remove once we drop IE9
this.heap = new Array(0x100000);
}
this.table = [];
}
}

@@ -127,2 +158,9 @@

};
/**
* The heap uses the [Mark-Compact Algorithm](https://en.wikipedia.org/wiki/Mark-compact_algorithm) to shift
* reachable memory to the bottom of the heap and freeable
* memory to the top of the heap. When we have shifted all
* the reachable memory to the top of the heap, we move the
* offset to the next free position.
*/

@@ -159,4 +197,10 @@ Heap.prototype.compact = function compact() {

Heap.prototype.toArray = function toArray() {
return this.heap.slice();
Heap.prototype.capture = function capture() {
// Only called in eager mode
var buffer = slice(this.heap, 0, this.offset);
return {
handle: this.handle,
table: this.table,
buffer: buffer
};
};

@@ -212,2 +256,15 @@

}(WriteOnlyProgram);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3JhbS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL0BnbGltbWVyL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2RlO1xuICB9XG59XG5cbmV4cG9ydCBjbGFzcyBSdW50aW1lUHJvZ3JhbTxTcGVjaWZpZXI+IHtcbiAgW2tleTogbnVtYmVyXTogbmV2ZXI7XG5cbiAgcHJpdmF0ZSBfb3Bjb2RlOiBPcGNvZGU7XG5cbiAgY29uc3RydWN0b3IocHVibGljIGNvbnN0YW50czogUnVudGltZUNvbnN0YW50czxTcGVjaWZpZXI+LCBwdWJsaWMgaGVhcDogSGVhcCkge1xuICAgIHRoaXMuX29wY29kZSA9IG5ldyBPcGNvZGUodGhpcy5oZWFwKTtcbiAgfVxuXG4gIG9wY29kZShvZmZzZXQ6IG51bWJlcik6IE9wY29kZSB7XG4gICAgdGhpcy5fb3Bjb2RlLm9mZnNldCA9IG9mZnNldDtcbiAgICByZXR1cm4gdGhpcy5fb3Bjb2RlO1xuICB9XG59XG5cbmV4cG9ydCBjbGFzcyBQcm9ncmFtPFNwZWNpZmllcj4gZXh0ZW5kcyBXcml0ZU9ubHlQcm9ncmFtIHtcbiAgcHVibGljIGNvbnN0YW50czogQ29uc3RhbnRzPFNwZWNpZmllcj47XG59XG4iXX0=
function slice(arr, start, end) {
if (arr instanceof Uint16Array) {
if (arr.slice !== undefined) {
return arr.slice(start, end).buffer;
}
var ret = new Uint16Array(end);
for (; start < end; start++) {
ret[start] = arr[start];
}
return ret.buffer;
}
return null;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3JhbS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL0BnbGltbWVyL3Byb2dyYW0vbGliL3Byb2dyYW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUdBLEFBQU8sQUFBYSxBQUFrQixBQUFvQixBQUFNLEFBQWEsQUFBQzs7QUFDOUUsQUFBTyxBQUFFLEFBQU0sQUFBRSxBQUFNLEFBQV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UnVudGltZUNvbnN0YW50czxTcGVjaWZpZXI+LCBwdWJsaWMgaGVhcDogSGVhcCkge1xuICAgIHRoaXMuX29wY29kZSA9IG5ldyBPcGNvZGUodGhpcy5oZWFwKTtcbiAgfVxuXG4gIG9wY29kZShvZmZzZXQ6IG51bWJlcik6IE9wY29kZSB7XG4gICAgdGhpcy5fb3Bjb2RlLm9mZnNldCA9IG9mZnNldDtcbiAgICByZXR1cm4gdGhpcy5fb3Bjb2RlO1xuICB9XG59XG5cbmV4cG9ydCBjbGFzcyBQcm9ncmFtPFNwZWNpZmllcj4gZXh0ZW5kcyBXcml0ZU9ubHlQcm9ncmFtIHtcbiAgcHVibGljIGNvbnN0YW50czogQ29uc3RhbnRzPFNwZWNpZmllcj47XG59XG5cbmZ1bmN0aW9uIHNsaWNlKGFycjogVWludDE2QXJyYXkgfCBudW1iZXJbXSwgc3RhcnQ6IG51bWJlciwgZW5kOiBudW1iZXIpIHtcbiAgaWYgKGFyciBpbnN0YW5jZW9mIFVpbnQxNkFycmF5KSB7XG4gICAgaWYgKGFyci5zbGljZSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICByZXR1cm4gYXJyLnNsaWNlKHN0YXJ0LCBlbmQpLmJ1ZmZlcjtcbiAgICB9XG5cbiAgICBsZXQgcmV0ID0gbmV3IFVpbnQxNkFycmF5KGVuZCk7XG5cbiAgICBmb3IgKDsgc3RhcnQgPCBlbmQ7IHN0YXJ0KyspIHtcbiAgICAgIHJldFtzdGFydF0gID0gYXJyW3N0YXJ0XTtcbiAgICB9XG5cbiAgICByZXR1cm4gcmV0LmJ1ZmZlcjtcbiAgfVxuXG4gIHJldHVybiBudWxsO1xufVxuIl19

@@ -12,8 +12,20 @@ const UNRESOLVED = {};

this.floats = [];
this.negatives = [];
}
float(float) {
return this.floats.push(float);
let index = this.floats.indexOf(float);
if (index > -1) {
return index;
}
return this.floats.push(float) - 1;
}
negative(negative) {
return this.negatives.push(negative);
}
string(value) {
return this.strings.push(value);
let index = this.strings.indexOf(value);
if (index > -1) {
return index;
}
return this.strings.push(value) - 1;
}

@@ -28,6 +40,14 @@ stringArray(strings) {

array(values) {
return this.arrays.push(values);
let index = this.arrays.indexOf(values);
if (index > -1) {
return index;
}
return this.arrays.push(values) - 1;
}
table(t) {
return this.tables.push(t);
let index = this.tables.indexOf(t);
if (index > -1) {
return index;
}
return this.tables.push(t) - 1;
}

@@ -39,3 +59,7 @@ handle(handle) {

serializable(value) {
return this.serializables.push(value);
let index = this.serializables.indexOf(value);
if (index > -1) {
return index;
}
return this.serializables.push(value) - 1;
}

@@ -49,3 +73,4 @@ toPool() {

serializables: this.serializables,
floats: this.floats
floats: this.floats,
negatives: this.negatives
};

@@ -63,2 +88,3 @@ }

this.floats = pool.floats;
this.negatives = pool.negatives;
this.resolved = this.handles.map(() => UNRESOLVED);

@@ -68,6 +94,9 @@ }

getFloat(value) {
return this.floats[value - 1];
return this.floats[value];
}
getNegative(value) {
return this.negatives[value - 1];
}
getString(value) {
return this.strings[value - 1];
return this.strings[value];
}

@@ -84,6 +113,6 @@ getStringArray(value) {

getArray(value) {
return this.arrays[value - 1];
return this.arrays[value];
}
getSymbolTable(value) {
return this.tables[value - 1];
return this.tables[value];
}

@@ -100,3 +129,3 @@ resolveHandle(s) {

getSerializable(s) {
return this.serializables[s - 1];
return this.serializables[s];
}

@@ -114,2 +143,4 @@ }

this.serializables = pool.serializables;
this.floats = pool.floats;
this.negatives = pool.negatives;
this.resolved = this.handles.map(() => UNRESOLVED);

@@ -119,4 +150,10 @@ }

// `0` means NULL
getFloat(value) {
return this.floats[value - 1];
}
getNegative(value) {
return this.negatives[value - 1];
}
getString(value) {
return this.strings[value - 1];
return this.strings[value];
}

@@ -133,6 +170,6 @@ getStringArray(value) {

getArray(value) {
return this.arrays[value - 1];
return this.arrays[value];
}
getSymbolTable(value) {
return this.tables[value - 1];
return this.tables[value];
}

@@ -149,3 +186,3 @@ resolveHandle(s) {

getSerializable(s) {
return this.serializables[s - 1];
return this.serializ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GlzLm90aGVycy5wdXNoKG90aGVyKTtcbiAgfVxufVxuIl19

@@ -15,16 +15,44 @@

const STATE_OFFSET = 3;
/**
* The Heap is responsible for dynamically allocating
* memory in which we read/write the VM's instructions
* from/to. When we malloc we pass out a VMHandle, which
* is used as an indirect way of accessing the memory during
* execution of the VM. Internally we track the different
* regions of the memory in an int array known as the table.
*
* The table has the following layout:
*
* | ... | table entry |
* | ... | hp | size | scope size | state |
* | ... | 0 | 122 | 3 | 0 |
* handle ^ | | ^ region state (allocated, freed, purged)
* region size ^ |
* number of symbols ^
*
* With this information we effectively have the ability to
* control when we want to free memory. That being said you
* can not free during execution as raw address are only
* valid during the execution. This means you cannot close
* over them as you will have a bad memory access exception.
*/
export class Heap {
constructor() {
this.heap = [];
constructor(serializedHeap) {
this.offset = 0;
this.handle = 0;
/**
* layout:
*
* - pointer into heap
* - size
* - scope size
* - freed (0 or 1)
*/
this.table = [];
if (serializedHeap) {
let { buffer, table, handle } = serializedHeap;
this.heap = new Uint16Array(buffer);
this.table = table;
this.offset = this.heap.length;
this.handle = handle;
} else {
if (typeof Uint16Array !== 'undefined') {
this.heap = new Uint16Array(0x100000);
} else {
// FIXME remove once we drop IE9
this.heap = new Array(0x100000);
}
this.table = [];
}
}

@@ -79,2 +107,9 @@ push(item) {

}
/**
* The heap uses the [Mark-Compact Algorithm](https://en.wikipedia.org/wiki/Mark-compact_algorithm) to shift
* reachable memory to the bottom of the heap and freeable
* memory to the top of the heap. When we have shifted all
* the reachable memory to the top of the heap, we move the
* offset to the next free position.
*/
compact() {

@@ -106,4 +141,10 @@ let compactedSize = 0;

}
toArray() {
return this.heap.slice();
capture() {
// Only called in eager mode
let buffer = slice(this.heap, 0, this.offset);
return {
handle: this.handle,
table: this.table,
buffer: buffer
};
}

@@ -134,2 +175,15 @@ }

export class Program extends WriteOnlyProgram {}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3JhbS5qcyIsIn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Bba2V5OiBudW1iZXJdOiBuZXZlcjtcblxuICBwcml2YXRlIF9vcGNvZGU6IE9wY29kZTtcblxuICBjb25zdHJ1Y3RvcihwdWJsaWMgY29uc3RhbnRzOiBSdW50aW1lQ29uc3RhbnRzPFNwZWNpZmllcj4sIHB1YmxpYyBoZWFwOiBIZWFwKSB7XG4gICAgdGhpcy5fb3Bjb2RlID0gbmV3IE9wY29kZSh0aGlzLmhlYXApO1xuICB9XG5cbiAgb3Bjb2RlKG9mZnNldDogbnVtYmVyKTogT3Bjb2RlIHtcbiAgICB0aGlzLl9vcGNvZGUub2Zmc2V0ID0gb2Zmc2V0O1xuICAgIHJldHVybiB0aGlzLl9vcGNvZGU7XG4gIH1cbn1cblxuZXhwb3J0IGNsYXNzIFByb2dyYW08U3BlY2lmaWVyPiBleHRlbmRzIFdyaXRlT25seVByb2dyYW0ge1xuICBwdWJsaWMgY29uc3RhbnRzOiBDb25zdGFudHM8U3BlY2lmaWVyPjtcbn1cbiJdfQ==
function slice(arr, start, end) {
if (arr instanceof Uint16Array) {
if (arr.slice !== undefined) {
return arr.slice(start, end).buffer;
}
let ret = new Uint16Array(end);
for (; start < end; start++) {
ret[start] = arr[start];
}
return ret.buffer;
}
return null;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3JhbS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL0BnbGltbWVyL3Byb2dyYW0vbGliL3Byb2dyYW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUdBLEFBQU8sU0FBYSxBQUFrQixBQUFvQiwwQkFBTSxBQUFhLEFBQUM7QUFDOUUsQUFBTyxTQUFFLEFBQU0sQUFBRSxjQUFNLEFBQVUsQUFBQztBQUVsQyxJQUFLLEFBS0o7QUFMRCxXQUFLLEFBQWM7QUFDakIsc0RBQVM7QUFDVCxrREFBSztB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gb2Zmc2V0O1xuICAgIHJldHVybiB0aGlzLl9vcGNvZGU7XG4gIH1cbn1cblxuZXhwb3J0IGNsYXNzIFByb2dyYW08U3BlY2lmaWVyPiBleHRlbmRzIFdyaXRlT25seVByb2dyYW0ge1xuICBwdWJsaWMgY29uc3RhbnRzOiBDb25zdGFudHM8U3BlY2lmaWVyPjtcbn1cblxuZnVuY3Rpb24gc2xpY2UoYXJyOiBVaW50MTZBcnJheSB8IG51bWJlcltdLCBzdGFydDogbnVtYmVyLCBlbmQ6IG51bWJlcikge1xuICBpZiAoYXJyIGluc3RhbmNlb2YgVWludDE2QXJyYXkpIHtcbiAgICBpZiAoYXJyLnNsaWNlICE9PSB1bmRlZmluZWQpIHtcbiAgICAgIHJldHVybiBhcnIuc2xpY2Uoc3RhcnQsIGVuZCkuYnVmZmVyO1xuICAgIH1cblxuICAgIGxldCByZXQgPSBuZXcgVWludDE2QXJyYXkoZW5kKTtcblxuICAgIGZvciAoOyBzdGFydCA8IGVuZDsgc3RhcnQrKykge1xuICAgICAgcmV0W3N0YXJ0XSAgPSBhcnJbc3RhcnRdO1xuICAgIH1cblxuICAgIHJldHVybiByZXQuYnVmZmVyO1xuICB9XG5cbiAgcmV0dXJuIG51bGw7XG59XG4iXX0=

@@ -23,10 +23,23 @@ function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }

this.floats = [];
this.negatives = [];
}
WriteOnlyConstants.prototype.float = function float(_float) {
return this.floats.push(_float);
var index = this.floats.indexOf(_float);
if (index > -1) {
return index;
}
return this.floats.push(_float) - 1;
};
WriteOnlyConstants.prototype.negative = function negative(_negative) {
return this.negatives.push(_negative);
};
WriteOnlyConstants.prototype.string = function string(value) {
return this.strings.push(value);
var index = this.strings.indexOf(value);
if (index > -1) {
return index;
}
return this.strings.push(value) - 1;
};

@@ -43,7 +56,15 @@

WriteOnlyConstants.prototype.array = function array(values) {
return this.arrays.push(values);
var index = this.arrays.indexOf(values);
if (index > -1) {
return index;
}
return this.arrays.push(values) - 1;
};
WriteOnlyConstants.prototype.table = function table(t) {
return this.tables.push(t);
var index = this.tables.indexOf(t);
if (index > -1) {
return index;
}
return this.tables.push(t) - 1;
};

@@ -57,3 +78,7 @@

WriteOnlyConstants.prototype.serializable = function serializable(value) {
return this.serializables.push(value);
var index = this.serializables.indexOf(value);
if (index > -1) {
return index;
}
return this.serializables.push(value) - 1;
};

@@ -68,3 +93,4 @@

serializables: this.serializables,
floats: this.floats
floats: this.floats,
negatives: this.negatives
};

@@ -89,2 +115,3 @@ };

this.floats = pool.floats;
this.negatives = pool.negatives;
this.resolved = this.handles.map(function () {

@@ -98,7 +125,11 @@ return UNRESOLVED;

RuntimeConstants.prototype.getFloat = function getFloat(value) {
return this.floats[value - 1];
return this.floats[value];
};
RuntimeConstants.prototype.getNegative = function getNegative(value) {
return this.negatives[value - 1];
};
RuntimeConstants.prototype.getString = function getString(value) {
return this.strings[value - 1];
return this.strings[value];
};

@@ -117,7 +148,7 @@

RuntimeConstants.prototype.getArray = function getArray(value) {
return this.arrays[value - 1];
return this.arrays[value];
};
RuntimeConstants.prototype.getSymbolTable = function getSymbolTable(value) {
return this.tables[value - 1];
return this.tables[value];
};

@@ -136,3 +167,3 @@

RuntimeConstants.prototype.getSerializable = function getSerializable(s) {
return this.serializables[s - 1];
return this.serializables[s];
};

@@ -157,2 +188,4 @@

_this.serializables = pool.serializables;
_this.floats = pool.floats;
_this.negatives = pool.negatives;
_this.resolved = _this.handles.map(function () {

@@ -167,4 +200,12 @@ return UNRESOLVED;

Constants.prototype.getFloat = function getFloat(value) {
return this.floats[value - 1];
};
Constants.prototype.getNegative = function getNegative(value) {
return this.negatives[value - 1];
};
Constants.prototype.getString = function getString(value) {
return this.strings[value - 1];
return this.strings[value];
};

@@ -183,7 +224,7 @@

Constants.prototype.getArray = function getArray(value) {
return this.arrays[value - 1];
return this.arrays[value];
};
Constants.prototype.getSymbolTable = function getSymbolTable(value) {
return this.tables[value - 1];
return this.tables[value];
};

@@ -202,3 +243,3 @@

Constants.prototype.getSerializable = function getSerializable(s) {
return this.serializables[s - 1];
return this.serializables[s];
};

@@ -233,2 +274,2 @@

export { LazyConstants };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcGFja2FnZXMvQGdsaW1tZXIvcHJvZ3JhbS9saWIvY29uc3RhbnRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBR0EsSUFBTSxBQUFVLGFBQUcsQUFBRSxBQUFDLEFBa0J0QixBQUFNOztJQUFOOztBQUNFLEFBQWlCOztBQUVQO2FBQU8sVUFBYSxBQUFFLEFBQUMsQUFDdkI7YUFBTSxTQUFlLEFBQUUsQUFBQyxBQUN4QjthQUFNLFNBQWtCLEFBQUUsQUFBQyxBQUMzQjthQUFPLFVBQWEsQUFBRSxBQUFDLEFBQ3ZCO2FBQWEsZ0JBQWEsQUFBRSxBQUFDLEFBQzdCO2FBQVEsV0FBYSxBQUFFLEFBQUMsQUFDeEI7YUFBTSxTQUFhLEFBQUUsQUFBQyxBQStDbEMsQUFBQztBQTdDQyxBQUFLOzt3REFBQyxBQUFhLFFBQ2pCLEFBQU07ZUFBQyxBQUFJLEtBQUMsQUFBTSxPQUFDLEFBQUksS0FBQyxBQUFLLEFBQUMsQUFBQyxBQUNqQyxBQUFDO0FBRUQsQUFBTTs7MERBQUMsQUFBYSxPQUNsQixBQUFNO2VBQUMsQUFBSSxLQUFDLEFBQU8sUUFBQyxBQUFJLEtBQUMsQUFBSyxBQUFDLEFBQUMsQUFDbEMsQUFBQztBQUVELEFBQVc7O29FQUFDLEFBQWlCLFNBQ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JuIHJlc29sdmVkIGFzIFQ7XG4gIH1cblxuICBnZXRTZXJpYWxpemFibGU8VD4oczogbnVtYmVyKTogVCB7XG4gICAgcmV0dXJuIHRoaXMuc2VyaWFsaXphYmxlc1tzXSBhcyBUO1xuICB9XG59XG5cbmV4cG9ydCBjbGFzcyBMYXp5Q29uc3RhbnRzIGV4dGVuZHMgQ29uc3RhbnRzPE9wYXF1ZT4ge1xuICBwcml2YXRlIG90aGVyczogT3BhcXVlW10gPSBbXTtcblxuICBnZXRPdGhlcjxUPih2YWx1ZTogbnVtYmVyKTogVCB7XG4gICAgcmV0dXJuIHRoaXMub3RoZXJzW3ZhbHVlIC0gMV0gYXMgVDtcbiAgfVxuXG4gIG90aGVyKG90aGVyOiBPcGFxdWUpOiBudW1iZXIge1xuICAgIHJldHVybiB0aGlzLm90aGVycy5wdXNoKG90aGVyKTtcbiAgfVxufVxuIl19

@@ -22,18 +22,49 @@ function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }

var STATE_OFFSET = 3;
/**
* The Heap is responsible for dynamically allocating
* memory in which we read/write the VM's instructions
* from/to. When we malloc we pass out a VMHandle, which
* is used as an indirect way of accessing the memory during
* execution of the VM. Internally we track the different
* regions of the memory in an int array known as the table.
*
* The table has the following layout:
*
* | ... | table entry |
* | ... | hp | size | scope size | state |
* | ... | 0 | 122 | 3 | 0 |
* handle ^ | | ^ region state (allocated, freed, purged)
* region size ^ |
* number of symbols ^
*
* With this information we effectively have the ability to
* control when we want to free memory. That being said you
* can not free during execution as raw address are only
* valid during the execution. This means you cannot close
* over them as you will have a bad memory access exception.
*/
export var Heap = function () {
function Heap() {
function Heap(serializedHeap) {
_classCallCheck(this, Heap);
this.heap = [];
this.offset = 0;
this.handle = 0;
/**
* layout:
*
* - pointer into heap
* - size
* - scope size
* - freed (0 or 1)
*/
this.table = [];
if (serializedHeap) {
var buffer = serializedHeap.buffer,
table = serializedHeap.table,
handle = serializedHeap.handle;
this.heap = new Uint16Array(buffer);
this.table = table;
this.offset = this.heap.length;
this.handle = handle;
} else {
if (typeof Uint16Array !== 'undefined') {
this.heap = new Uint16Array(0x100000);
} else {
// FIXME remove once we drop IE9
this.heap = new Array(0x100000);
}
this.table = [];
}
}

@@ -100,3 +131,11 @@

};
/**
* The heap uses the [Mark-Compact Algorithm](https://en.wikipedia.org/wiki/Mark-compact_algorithm) to shift
* reachable memory to the bottom of the heap and freeable
* memory to the top of the heap. When we have shifted all
* the reachable memory to the top of the heap, we move the
* offset to the next free position.
*/
Heap.prototype.compact = function compact() {

@@ -132,4 +171,10 @@ var compactedSize = 0;

Heap.prototype.toArray = function toArray() {
return this.heap.slice();
Heap.prototype.capture = function capture() {
// Only called in eager mode
var buffer = slice(this.heap, 0, this.offset);
return {
handle: this.handle,
table: this.table,
buffer: buffer
};
};

@@ -185,2 +230,15 @@

}(WriteOnlyProgram);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3JhbS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL0BnbGltbWVyL3Byb2dyYW0vbGliL3Byb2dyYW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFHQSxBQUFPLFNBQWEsQUFBa0IsQUFBb0IsMEJBQU0sQUFBYSxBQUFDO0FBQzlFLEFBQU8sU0FBRSxBQUFNLEFBQUUsY0FBTSxBQUFVLEFBQUM7QUFHbEMsSUFBSyxBQUtKO0FBTEQsV0FBSyxBQUFjLGdCQUNqQjtzREFBUyxBQUNUO2tEQUFLLEFBQ0w7bURBQU0sQUFDTjtvREFBTyxBQUNULEFBQUM7R0FMSSxBQUFjLG1CQUFkLEFBQWMsaUJB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R1cm4gdGhpcy5fb3Bjb2RlO1xuICB9XG59XG5cbmV4cG9ydCBjbGFzcyBQcm9ncmFtPFNwZWNpZmllcj4gZXh0ZW5kcyBXcml0ZU9ubHlQcm9ncmFtIHtcbiAgcHVibGljIGNvbnN0YW50czogQ29uc3RhbnRzPFNwZWNpZmllcj47XG59XG4iXX0=
function slice(arr, start, end) {
if (arr instanceof Uint16Array) {
if (arr.slice !== undefined) {
return arr.slice(start, end).buffer;
}
var ret = new Uint16Array(end);
for (; start < end; start++) {
ret[start] = arr[start];
}
return ret.buffer;
}
return null;
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3JhbS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3BhY2thZ2VzL0BnbGltbWVyL3Byb2dyYW0vbGliL3Byb2dyYW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFHQSxBQUFPLFNBQWEsQUFBa0IsQUFBb0IsMEJBQU0sQUFBYSxBQUFDO0FBQzlFLEFBQU8sU0FBRSxBQUFNLEFBQUUsY0FBTSxBQUFVLEFBQUM7QUFFbEMsSUFBSyxBQUtKO0FBTEQsV0FBSyxBQUFjLGdCQUNqQjtzREFBUyxBQUNUO2tEQUFLLEFBQ0w7bURBQU0sQUFDTjtvREFBTyxBQUNULEFBQUM7R0FMSSxBQUFjLG1CQUFkLEFBQWMsaUJBS2xCO0FBRUQsSUFBTSxBQUFVLGFBQUcsQUFBQyxBQUFDO0FBQ3JCLElBQU0sQUFBVyxjQUFHLEFBQUMsQUFBQztBQUN0QixJQUFNLEFBQWdCLG1CQUFHLEFBQUMsQUFBQztBQUMzQixJQUFNLEFBQVksZUFBRyxBQUFDLEFBQUM7QUFFdkIsQUFzQkc7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQ0gsQUFBTSxXQU1KO2tCQUF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ltdLCBzdGFydDogbnVtYmVyLCBlbmQ6IG51bWJlcikge1xuICBpZiAoYXJyIGluc3RhbmNlb2YgVWludDE2QXJyYXkpIHtcbiAgICBpZiAoYXJyLnNsaWNlICE9PSB1bmRlZmluZWQpIHtcbiAgICAgIHJldHVybiBhcnIuc2xpY2Uoc3RhcnQsIGVuZCkuYnVmZmVyO1xuICAgIH1cblxuICAgIGxldCByZXQgPSBuZXcgVWludDE2QXJyYXkoZW5kKTtcblxuICAgIGZvciAoOyBzdGFydCA8IGVuZDsgc3RhcnQrKykge1xuICAgICAgcmV0W3N0YXJ0XSAgPSBhcnJbc3RhcnRdO1xuICAgIH1cblxuICAgIHJldHVybiByZXQuYnVmZmVyO1xuICB9XG5cbiAgcmV0dXJuIG51bGw7XG59XG4iXX0=

@@ -1,3 +0,2 @@

import { Opaque, SymbolTable, RuntimeResolver } from "@glimmer/interfaces";
import { CompileTimeConstants } from "@glimmer/opcode-compiler";
import { Opaque, SymbolTable, RuntimeResolver, CompileTimeConstants } from "@glimmer/interfaces";
export interface ConstantPool {

@@ -10,2 +9,3 @@ strings: string[];

floats: number[];
negatives: number[];
}

@@ -17,2 +17,3 @@ export declare const enum PrimitiveType {

BOOLEAN_OR_VOID = 3,
NEGATIVE = 4,
}

@@ -27,3 +28,5 @@ export declare class WriteOnlyConstants implements CompileTimeConstants {

protected floats: number[];
protected negatives: number[];
float(float: number): number;
negative(negative: number): number;
string(value: string): number;

@@ -46,4 +49,6 @@ stringArray(strings: string[]): number;

protected floats: number[];
protected negatives: number[];
constructor(resolver: RuntimeResolver<Specifier>, pool: ConstantPool);
getFloat(value: number): number;
getNegative(value: number): number;
getString(value: number): string;

@@ -59,2 +64,4 @@ getStringArray(value: number): string[];

constructor(resolver: RuntimeResolver<Specifier>, pool?: ConstantPool);
getFloat(value: number): number;
getNegative(value: number): number;
getString(value: number): string;

@@ -61,0 +68,0 @@ getStringArray(value: number): string[];

@@ -1,18 +0,37 @@

import { VMHandle } from "@glimmer/interfaces";
import { CompileTimeProgram, VMHandle } from "@glimmer/interfaces";
import { Constants, WriteOnlyConstants, RuntimeConstants } from './constants';
import { Opcode } from './opcode';
import { CompileTimeProgram } from "@glimmer/opcode-compiler";
/**
* The Heap is responsible for dynamically allocating
* memory in which we read/write the VM's instructions
* from/to. When we malloc we pass out a VMHandle, which
* is used as an indirect way of accessing the memory during
* execution of the VM. Internally we track the different
* regions of the memory in an int array known as the table.
*
* The table has the following layout:
*
* | ... | table entry |
* | ... | hp | size | scope size | state |
* | ... | 0 | 122 | 3 | 0 |
* handle ^ | | ^ region state (allocated, freed, purged)
* region size ^ |
* number of symbols ^
*
* With this information we effectively have the ability to
* control when we want to free memory. That being said you
* can not free during execution as raw address are only
* valid during the execution. This means you cannot close
* over them as you will have a bad memory access exception.
*/
export declare class Heap {
private heap;
private table;
private offset;
private handle;
/**
* layout:
*
* - pointer into heap
* - size
* - scope size
* - freed (0 or 1)
*/
private table;
constructor(serializedHeap?: {
buffer: ArrayBuffer;
table: number[];
handle: number;
});
push(item: number): void;

@@ -29,4 +48,15 @@ getbyaddr(address: number): number;

free(handle: VMHandle): void;
/**
* The heap uses the [Mark-Compact Algorithm](https://en.wikipedia.org/wiki/Mark-compact_algorithm) to shift
* reachable memory to the bottom of the heap and freeable
* memory to the top of the heap. When we have shifted all
* the reachable memory to the top of the heap, we move the
* offset to the next free position.
*/
compact(): void;
toArray(): number[];
capture(): {
handle: number;
table: number[];
buffer: ArrayBuffer;
};
}

@@ -33,0 +63,0 @@ export declare class WriteOnlyProgram implements CompileTimeProgram {

{
"name": "@glimmer/program",
"version": "0.28.3",
"version": "0.29.0",
"repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/program",
"dependencies": {
"@glimmer/util": "^0.28.3",
"@glimmer/interfaces": "^0.28.3",
"@glimmer/encoder": "^0.28.3"
"@glimmer/util": "^0.29.0",
"@glimmer/interfaces": "^0.29.0",
"@glimmer/encoder": "^0.29.0"
},

@@ -10,0 +10,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc