Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: use bitmap in readable state #49745

Merged
merged 10 commits into from
Sep 24, 2023
Prev Previous commit
Next Next commit
fixup! dont let copilot generate code
  • Loading branch information
benjamingr committed Sep 21, 2023
commit e2d09e3921c5ab6a97493474beb46989586a2f78
8 changes: 4 additions & 4 deletions lib/internal/streams/readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ const kDataEmitted = 1 << 18;
function makeBitMapDescriptor(bit) {
return {
enumerable: true,
get() { return (this.flags & bit) !== 0; },
get() { return (this.state & bit) !== 0; },
set(value) {
if (value) this.flags |= bit;
else this.flags &= ~bit;
if (value) this.state |= bit;
else this.state &= ~bit;
},
};
}
Expand Down Expand Up @@ -148,10 +148,10 @@ function ReadableState(options, stream, isDuplex) {
// Bit map field to store ReadableState more effciently with 1 bit per field
// instead of a V8 slot per field.
this.state = 0;

// Object stream flag. Used to make read(n) ignore n and to
// make all the buffer merging and length checks go away.
this.objectMode = !!(options && options.objectMode);
throw ("get", this.__proto__.objectMode)

if (isDuplex)
this.objectMode = this.objectMode ||
Expand Down
Loading