aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-04-15 12:57:53 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-04-15 12:58:07 -0700
commit8b8affee0732239c81320fc09b19d0cbf33800bf (patch)
treef691251c22a04b0aa3fb7ce3d46707ed219da051 /src
parent8fb65c7a3e5f9c0d25f35a1401c98f7c32a744e5 (diff)
stop using __proto__ as an optimization, it actually makes things slower
Diffstat (limited to 'src')
-rw-r--r--src/library_fs.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/library_fs.js b/src/library_fs.js
index 3d0036ee..d53210f9 100644
--- a/src/library_fs.js
+++ b/src/library_fs.js
@@ -394,16 +394,12 @@ mergeInto(LibraryManager.library, {
}
});
}
- if (stream.__proto__) {
- // reuse the object
- stream.__proto__ = FS.FSStream.prototype;
- } else {
- var newStream = new FS.FSStream();
- for (var p in stream) {
- newStream[p] = stream[p];
- }
- stream = newStream;
+ // clone it, so we can return an instance of FSStream
+ var newStream = new FS.FSStream();
+ for (var p in stream) {
+ newStream[p] = stream[p];
}
+ stream = newStream;
var fd = FS.nextfd(fd_start, fd_end);
stream.fd = fd;
FS.streams[fd] = stream;