Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
meta: merge node/master into node-chakracore/master
Browse files Browse the repository at this point in the history
Merge 83d44be as of 2018-03-30
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: chakrabot <chakrabot@users.noreply.github.com>
  • Loading branch information
chakrabot committed Mar 31, 2018
2 parents 1fc5478 + 83d44be commit 1bbf743
Show file tree
Hide file tree
Showing 24 changed files with 559 additions and 298 deletions.
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V9.md#9.10.0">9.10.0</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V9.md#9.10.1">9.10.1</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V9.md#9.10.0">9.10.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V9.md#9.9.0">9.9.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V9.md#9.8.0">9.8.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V9.md#9.7.1">9.7.1</a><br/>
Expand All @@ -47,7 +48,8 @@ release.
<a href="doc/changelogs/CHANGELOG_V9.md#9.0.0">9.0.0</a><br/>
</td>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V8.md#8.11.0">8.11.0</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V8.md#8.11.1">8.11.1</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V8.md#8.11.0">8.11.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V8.md#8.10.0">8.10.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V8.md#8.9.4">8.9.4</a><br/>
<a href="doc/changelogs/CHANGELOG_V8.md#8.9.3">8.9.3</a><br/>
Expand All @@ -71,7 +73,8 @@ release.
<a href="doc/changelogs/CHANGELOG_V8.md#8.0.0">8.0.0</a><br/>
</td>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V6.md#6.14.0">6.14.0</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V6.md#6.14.1">6.14.1</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V6.md#6.14.0">6.14.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V6.md#6.13.1">6.13.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V6.md#6.13.0">6.13.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V6.md#6.12.3">6.12.3</a><br/>
Expand Down Expand Up @@ -109,7 +112,8 @@ release.
<a href="doc/changelogs/CHANGELOG_V6.md#6.0.0">6.0.0</a><br/>
</td>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V4.md#4.9.0">4.9.0</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V4.md#4.9.1">4.9.1</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V4.md#4.9.0">4.9.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V4.md#4.8.7">4.8.7</a><br/>
<a href="doc/changelogs/CHANGELOG_V4.md#4.8.6">4.8.6</a><br/>
<a href="doc/changelogs/CHANGELOG_V4.md#4.8.5">4.8.5</a><br/>
Expand Down
11 changes: 7 additions & 4 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,8 @@ changes:
description: Removed the deprecated `raw` and `raws` encodings.
-->

`Buffer` instances are commonly used to represent sequences of encoded characters
such as UTF-8, UCS2, Base64, or even Hex-encoded data. It is possible to
convert back and forth between `Buffer` instances and ordinary JavaScript strings
by using an explicit character encoding.
When string data is stored in or extracted out of a `Buffer` instance, a
character encoding may be specified.

```js
const buf = Buffer.from('hello world', 'ascii');
Expand All @@ -161,6 +159,11 @@ console.log(buf.toString('hex'));
// Prints: 68656c6c6f20776f726c64
console.log(buf.toString('base64'));
// Prints: aGVsbG8gd29ybGQ=

console.log(Buffer.from('fhqwhgads', 'ascii'));
// Prints: <Buffer 66 68 71 77 68 67 61 64 73>
console.log(Buffer.from('fhqwhgads', 'ucs2'));
// Prints: <Buffer 66 00 68 00 71 00 77 00 68 00 67 00 61 00 64 00 73 00>
```

The character encodings currently supported by Node.js include:
Expand Down
13 changes: 13 additions & 0 deletions doc/changelogs/CHANGELOG_V4.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</tr>
<tr>
<td valign="top">
<a href="#4.9.1">4.9.1</a><br/>
<a href="#4.9.0">4.9.0</a><br/>
<a href="#4.8.7">4.8.7</a><br/>
<a href="#4.8.6">4.8.6</a><br/>
Expand Down Expand Up @@ -71,6 +72,18 @@
[Node.js Long Term Support Plan](https://github.com/nodejs/LTS) and
will be supported actively until April 2017 and maintained until April 2018.

<a id="4.9.1"></a>
## 2018-03-29, Version 4.9.1 'Argon' (Maintenance), @MylesBorins

### Notable Changes

No additional commits.

Due to incorrect staging of the upgrade to the GCC 4.9.X compiler, the latest releases for PPC little
endian were built using GCC 4.9.X instead of GCC 4.8.X. This caused an ABI breakage on PPCLE based
environments. This has been fixed in our infrastructure and we are doing this release to ensure that
the hosted binaries are adhering to our platform support contract.

<a id="4.9.0"></a>
## 2018-03-28, Version 4.9.0 'Argon' (Maintenance), @MylesBorins

Expand Down
13 changes: 13 additions & 0 deletions doc/changelogs/CHANGELOG_V6.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</tr>
<tr>
<td valign="top">
<a href="#6.14.1">6.14.1</a><br/>
<a href="#6.14.0">6.14.0</a><br/>
<a href="#6.13.1">6.13.1</a><br/>
<a href="#6.13.0">6.13.0</a><br/>
Expand Down Expand Up @@ -67,6 +68,18 @@
[Node.js Long Term Support Plan](https://github.com/nodejs/LTS) and
will be supported actively until April 2018 and maintained until April 2019.

<a id="6.14.1"></a>
## 2018-03-29, Version 6.14.1 'Boron' (LTS), @MylesBorins

### Notable Changes

No additional commits.

Due to incorrect staging of the upgrade to the GCC 4.9.X compiler, the latest releases for PPC little
endian were built using GCC 4.9.X instead of GCC 4.8.X. This caused an ABI breakage on PPCLE based
environments. This has been fixed in our infrastructure and we are doing this release to ensure that
the hosted binaries are adhering to our platform support contract.

<a id="6.14.0"></a>
## 2018-03-28, Version 6.14.0 'Boron' (LTS), @MylesBorins

Expand Down
19 changes: 19 additions & 0 deletions doc/changelogs/CHANGELOG_V8.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Node.js 8 ChangeLog

<!--lint disable prohibited-strings-->
Expand All @@ -10,6 +11,7 @@
</tr>
<tr>
<td valign="top">
<a href="#8.11.1">8.11.1</a><br/>
<a href="#8.11.0">8.11.0</a><br/>
<a href="#8.10.0">8.10.0</a><br/>
<a href="#8.9.4">8.9.4</a><br/>
Expand Down Expand Up @@ -53,6 +55,23 @@
[Node.js Long Term Support Plan](https://github.com/nodejs/LTS) and
will be supported actively until April 2019 and maintained until December 2019.

<a id="8.11.1"></a>
## 2018-03-29, Version 8.11.1 'Carbon' (LTS), @MylesBorins

### Notable Changes

No additional commits.

Due to incorrect staging of the upgrade to the GCC 4.9.X compiler, the latest releases for PPC little
endian were built using GCC 4.9.X instead of GCC 4.8.X. This caused an ABI breakage on PPCLE based
environments. This has been fixed in our infrastructure and we are doing this release to ensure that
the hosted binaries are adhering to our platform support contract.

Note that Node.js versions 10.X and later will be built with version 4.9.X or later of the GCC compiler,
and it is possible that Node.js version 8.X may be built on the 4.9.X compiler at a later
time as the stated [minimum compiler requirement](https://github.com/nodejs/node/blob/v8.x/BUILDING.md)
for Node.js version 8.X is 4.9.4.

<a id="8.11.0"></a>
## 2018-03-28, Version 8.11.0 'Carbon' (LTS), @MylesBorins

Expand Down
18 changes: 18 additions & 0 deletions doc/changelogs/CHANGELOG_V9.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</tr>
<tr>
<td>
<a href="#9.10.1">9.10.1</a><br/>
<a href="#9.10.0">9.10.0</a><br/>
<a href="#9.9.0">9.9.0</a><br/>
<a href="#9.8.0">9.8.0</a><br/>
Expand Down Expand Up @@ -38,6 +39,23 @@
* [io.js](CHANGELOG_IOJS.md)
* [Archive](CHANGELOG_ARCHIVE.md)

<a id="9.10.1"></a>
## 2018-03-29, Version 9.10.1 (Current), @MylesBorins

### Notable Changes

No additional commits.

Due to incorrect staging of the upgrade to the GCC 4.9.X compiler, the latest releases for PPC little
endian were built using GCC 4.9.X instead of GCC 4.8.X. This caused an ABI breakage on PPCLE based
environments. This has been fixed in our infrastructure and we are doing this release to ensure that
the hosted binaries are adhering to our platform support contract.

Note that Node.js versions 10.X and later will be built with version 4.9.X or later of the GCC compiler,
and it is possible that Node.js version 9.X may be built on the 4.9.X compiler at a later
time as the stated [minimum compiler requirement](https://github.com/nodejs/node/blob/v8.x/BUILDING.md)
for Node.js version 9.X is 4.9.4.

<a id="9.10.0"></a>
## 2018-03-28, Version 9.10.0 (Current), @MylesBorins prepared by @targos

Expand Down
15 changes: 12 additions & 3 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ function chunkInvalid(state, chunk) {
// 'readable' event will be triggered.
function needMoreData(state) {
return !state.ended &&
(state.needReadable ||
state.length < state.highWaterMark ||
(state.length < state.highWaterMark ||
state.length === 0);
}

Expand Down Expand Up @@ -536,7 +535,17 @@ function emitReadable_(stream) {
if (!state.destroyed && (state.length || state.ended)) {
stream.emit('readable');
}
state.needReadable = !state.flowing && !state.ended;

// The stream needs another readable event if
// 1. It is not flowing, as the flow mechanism will take
// care of it.
// 2. It is not ended.
// 3. It is below the highWaterMark, so we can schedule
// another readable later.
state.needReadable =
!state.flowing &&
!state.ended &&
state.length <= state.highWaterMark;
flow(stream);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function makeSyncWrite(fd) {
if (enc !== 'buffer')
chunk = Buffer.from(chunk, enc);

this._bytesDispatched += chunk.length;
this._handle.bytesWritten += chunk.length;

const ctx = {};
writeBuffer(fd, chunk, 0, chunk.length, null, undefined, ctx);
Expand Down
28 changes: 20 additions & 8 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ function normalizeArgs(args) {
// called when creating new Socket, or when re-using a closed Socket
function initSocketHandle(self) {
self._undestroy();
self._bytesDispatched = 0;
self._sockname = null;

// Handle creation may be deferred to bind() or connect() time.
Expand All @@ -222,7 +221,8 @@ function initSocketHandle(self) {
}


const BYTES_READ = Symbol('bytesRead');
const kBytesRead = Symbol('kBytesRead');
const kBytesWritten = Symbol('kBytesWritten');


function Socket(options) {
Expand Down Expand Up @@ -278,6 +278,11 @@ function Socket(options) {

this._writev = null;
this._write = makeSyncWrite(fd);
// makeSyncWrite adjusts this value like the original handle would, so
// we need to let it do that by turning it into a writable, own property.
Object.defineProperty(this._handle, 'bytesWritten', {
value: 0, writable: true
});
}
} else {
// these will be set once there is a connection
Expand Down Expand Up @@ -316,7 +321,8 @@ function Socket(options) {
this._server = null;

// Used after `.destroy()`
this[BYTES_READ] = 0;
this[kBytesRead] = 0;
this[kBytesWritten] = 0;
}
util.inherits(Socket, stream.Duplex);

Expand Down Expand Up @@ -588,8 +594,9 @@ Socket.prototype._destroy = function(exception, cb) {
if (this !== process.stderr)
debug('close handle');
var isException = exception ? true : false;
// `bytesRead` should be accessible after `.destroy()`
this[BYTES_READ] = this._handle.bytesRead;
// `bytesRead` and `kBytesWritten` should be accessible after `.destroy()`
this[kBytesRead] = this._handle.bytesRead;
this[kBytesWritten] = this._handle.bytesWritten;

this._handle.close(() => {
debug('emit close');
Expand Down Expand Up @@ -689,7 +696,7 @@ function protoGetter(name, callback) {
}

protoGetter('bytesRead', function bytesRead() {
return this._handle ? this._handle.bytesRead : this[BYTES_READ];
return this._handle ? this._handle.bytesRead : this[kBytesRead];
});

protoGetter('remoteAddress', function remoteAddress() {
Expand Down Expand Up @@ -761,8 +768,6 @@ Socket.prototype._writeGeneric = function(writev, data, encoding, cb) {
// Bail out if handle.write* returned an error
if (ret) return ret;

this._bytesDispatched += req.bytes;

if (!req.async) {
cb();
return;
Expand All @@ -782,6 +787,13 @@ Socket.prototype._write = function(data, encoding, cb) {
this._writeGeneric(false, data, encoding, cb);
};


// Legacy alias. Having this is probably being overly cautious, but it doesn't
// really hurt anyone either. This can probably be removed safely if desired.
protoGetter('_bytesDispatched', function _bytesDispatched() {
return this._handle ? this._handle.bytesWritten : this[kBytesWritten];
});

protoGetter('bytesWritten', function bytesWritten() {
var bytes = this._bytesDispatched;
const state = this._writableState;
Expand Down
13 changes: 8 additions & 5 deletions src/async_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@ void AsyncWrap::EmitBefore(Environment* env, double async_id) {
}


void AsyncWrap::EmitTraceEventAfter() {
switch (provider_type()) {
void AsyncWrap::EmitTraceEventAfter(ProviderType type, double async_id) {
switch (type) {
#define V(PROVIDER) \
case PROVIDER_ ## PROVIDER: \
TRACE_EVENT_NESTABLE_ASYNC_END0( \
TRACING_CATEGORY_NODE1(async_hooks), \
#PROVIDER "_CALLBACK", static_cast<int64_t>(get_async_id())); \
#PROVIDER "_CALLBACK", static_cast<int64_t>(async_id)); \
break;
NODE_ASYNC_PROVIDER_TYPES(V)
#undef V
Expand Down Expand Up @@ -314,7 +314,7 @@ static void PromiseHook(PromiseHookType type, Local<Promise> promise,
wrap->EmitTraceEventBefore();
AsyncWrap::EmitBefore(wrap->env(), wrap->get_async_id());
} else if (type == PromiseHookType::kAfter) {
wrap->EmitTraceEventAfter();
wrap->EmitTraceEventAfter(wrap->provider_type(), wrap->get_async_id());
AsyncWrap::EmitAfter(wrap->env(), wrap->get_async_id());
if (env->execution_async_id() == wrap->get_async_id()) {
// This condition might not be true if async_hooks was enabled during
Expand Down Expand Up @@ -701,11 +701,14 @@ MaybeLocal<Value> AsyncWrap::MakeCallback(const Local<Function> cb,
Local<Value>* argv) {
EmitTraceEventBefore();

ProviderType provider = provider_type();
async_context context { get_async_id(), get_trigger_async_id() };
MaybeLocal<Value> ret = InternalMakeCallback(
env(), object(), cb, argc, argv, context);

EmitTraceEventAfter();
// This is a static call with cached values because the `this` object may
// no longer be alive at this point.
EmitTraceEventAfter(provider, context.async_id);

return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion src/async_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class AsyncWrap : public BaseObject {
static void EmitPromiseResolve(Environment* env, double async_id);

void EmitTraceEventBefore();
void EmitTraceEventAfter();
static void EmitTraceEventAfter(ProviderType type, double async_id);
void EmitTraceEventDestroy();


Expand Down
Loading

0 comments on commit 1bbf743

Please sign in to comment.