diff --git a/lib/buffer.js b/lib/buffer.js index e20b3d5eb5..6eabc6f0b5 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -91,12 +91,8 @@ function Buffer (subject, encoding, offset) { // Are we slicing? if (typeof offset === 'number') { this.length = encoding; - Object.defineProperty(this, "parent", { enumerable: false, - value: subject, - writable: false }); - Object.defineProperty(this, "offset", { enumerable: false, - value: offset, - writable: false }); + this.parent = subject; + this.offset = offset; } else { // Find the length switch (type = typeof subject) { @@ -120,22 +116,14 @@ function Buffer (subject, encoding, offset) { if (length > Buffer.poolSize) { // Big buffer, just alloc one. - var parent = new SlowBuffer(subject, encoding); - Object.defineProperty(this, "parent", { enumerable: false, - value: parent, - writable: false }); - Object.defineProperty(this, "offset", { enumerable: false, - value: 0, - writable: false }); + this.parent = new SlowBuffer(subject, encoding); + this.offset = 0; + } else { // Small buffer. if (!pool || pool.length - pool.used < length) allocPool(); - Object.defineProperty(this, "parent", { enumerable: false, - value: pool, - writable: false }); - Object.defineProperty(this, "offset", { enumerable: false, - value: pool.used, - writable: false }); + this.parent = pool; + this.offset = pool.used; pool.used += length; // Do we need to write stuff?