summaryrefslogtreecommitdiff
path: root/src/string_bytes.cc
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2013-04-17 16:26:15 -0700
committerTrevor Norris <trev.norris@gmail.com>2013-06-18 15:39:13 -0700
commit3a2f273bd73bc94a6e93f342d629106a9f022f2d (patch)
tree37d9c0b71bfb29d5a1c293cd88ea4f88aaba8810 /src/string_bytes.cc
parent252cdfa43be38b99228b3caee373dccbb6e94e9c (diff)
downloadandroid-node-v8-3a2f273bd73bc94a6e93f342d629106a9f022f2d.tar.gz
android-node-v8-3a2f273bd73bc94a6e93f342d629106a9f022f2d.tar.bz2
android-node-v8-3a2f273bd73bc94a6e93f342d629106a9f022f2d.zip
buffer: use smalloc as backing data store
Memory allocations are now done through smalloc. The Buffer cc class has been removed completely, but for backwards compatibility have left the namespace as Buffer. The .parent attribute is only set if the Buffer is a slice of an allocation. Which is then set to the alloc object (not a Buffer). The .offset attribute is now a ReadOnly set to 0, for backwards compatibility. I'd like to remove it in the future (pre v1.0). A few alterations have been made to how arguments are either coerced or thrown. All primitives will now be coerced to their respective values, and (most) all out of range index requests will throw. The indexes that are coerced were left for backwards compatibility. For example: Buffer slice operates more like Array slice, and coerces instead of throwing out of range indexes. This may change in the future. The reason for wanting to throw for out of range indexes is because giving js access to raw memory has high potential risk. To mitigate that it's easier to make sure the developer is always quickly alerted to the fact that their code is attempting to access beyond memory bounds. Because SlowBuffer will be deprecated, and simply returns a new Buffer instance, all tests on SlowBuffer have been removed. Heapdumps will now show usage under "smalloc" instead of "Buffer". ParseArrayIndex was added to node_internals to support proper uint argument checking/coercion for external array data indexes. SlabAllocator had to be updated since handle_ no longer exists.
Diffstat (limited to 'src/string_bytes.cc')
-rw-r--r--src/string_bytes.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string_bytes.cc b/src/string_bytes.cc
index db6bb8e5e6..db810037d9 100644
--- a/src/string_bytes.cc
+++ b/src/string_bytes.cc
@@ -624,7 +624,7 @@ Local<Value> StringBytes::Encode(const char* buf,
Local<String> val;
switch (encoding) {
case BUFFER:
- return scope.Close(Buffer::New(buf, buflen)->handle_);
+ return scope.Close(Buffer::New(buf, buflen));
case ASCII:
if (contains_non_ascii(buf, buflen)) {