Sha256: 5dc8cda8d22821522a8500d1577da4fb0906912d8e49ff40ac2a755a9433817f
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
class InstructionEncoder { constructor(buffer) { this.buffer = buffer; this.typePos = 0; this.size = 0; } encode(type, machine) { if (type > 255 /* TYPE_SIZE */) { throw new Error(`Opcode type over 8-bits. Got ${type}.`); } this.buffer.push(type | machine | arguments.length - 2 << 8 /* ARG_SHIFT */); this.typePos = this.buffer.length - 1; for (let i = 2; i < arguments.length; i++) { let op = arguments[i]; if (typeof op === 'number' && op > 65535 /* MAX_SIZE */) { throw new Error(`Operand over 16-bits. Got ${op}.`); } this.buffer.push(op); } this.size = this.buffer.length; } patch(position, target) { if (this.buffer[position + 1] === -1) { this.buffer[position + 1] = target; } else { throw new Error('Trying to patch operand in populated slot instead of a reserved slot.'); } } patchWith(position, target, operand) { if (this.buffer[position + 1] === -1) { this.buffer[position + 1] = target; this.buffer[position + 2] = operand; } else { throw new Error('Trying to patch operand in populated slot instead of a reserved slot.'); } } } export { InstructionEncoder };
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.6.0.0 | dist/es/@glimmer/encoder.js |
discourse-ember-source-3.5.1.1 | dist/es/@glimmer/encoder.js |
discourse-ember-source-3.5.1.0 | dist/dist/es/@glimmer/encoder.js |