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 fecc64d as of 2018-02-22
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
  • Loading branch information
chakrabot committed Feb 22, 2018
2 parents f295207 + fecc64d commit ddad39c
Show file tree
Hide file tree
Showing 82 changed files with 1,619 additions and 967 deletions.
14 changes: 12 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ module.exports = {
'accessor-pairs': 'error',
'array-callback-return': 'error',
'dot-location': ['error', 'property'],
'dot-notation': 'error',
eqeqeq: ['error', 'smart'],
'no-fallthrough': 'error',
'no-global-assign': 'error',
Expand Down Expand Up @@ -111,6 +112,7 @@ module.exports = {
],
'no-return-await': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-throw-literal': 'error',
'no-unused-labels': 'error',
'no-useless-call': 'error',
Expand All @@ -128,6 +130,7 @@ module.exports = {
// http://eslint.org/docs/rules/#variables
'no-delete-var': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-unused-vars': ['error', { args: 'none' }],
'no-use-before-define': ['error', {
classes: true,
Expand Down Expand Up @@ -163,7 +166,7 @@ module.exports = {
ObjectExpression: 'first',
SwitchCase: 1,
}],
'key-spacing': ['error', { mode: 'minimum' }],
'key-spacing': ['error', { mode: 'strict' }],
'keyword-spacing': 'error',
'linebreak-style': ['error', 'unix'],
'max-len': ['error', {
Expand All @@ -180,6 +183,10 @@ module.exports = {
/* eslint-disable max-len, quotes */
'no-restricted-syntax': [
'error',
{
selector: "CallExpression[callee.object.name='assert'][callee.property.name='doesNotThrow']",
message: "Please replace `assert.doesNotThrow()` and add a comment next to the code instead."
},
{
selector: `CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.1.type='Literal']:not([arguments.1.regex])`,
message: 'use a regular expression for second argument of assert.throws()',
Expand All @@ -204,10 +211,13 @@ module.exports = {
/* eslint-enable max-len, quotes */
'no-tabs': 'error',
'no-trailing-spaces': 'error',
'no-unsafe-finally': 'error',
'no-whitespace-before-property': 'error',
'object-curly-spacing': ['error', 'always'],
'one-var': ['error', { initialized: 'never' }],
'one-var-declaration-per-line': 'error',
'operator-linebreak': ['error', 'after'],
quotes: ['error', 'single', 'avoid-escape'],
quotes: ['error', 'single', { avoidEscape: true }],
semi: 'error',
'semi-spacing': 'error',
'space-before-blocks': ['error', 'always'],
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V9.md#9.5.0">9.5.0</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V9.md#9.6.0">9.6.0</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V9.md#9.5.0">9.5.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V9.md#9.4.0">9.4.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V9.md#9.3.0">9.3.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V9.md#9.2.1">9.2.1</a><br/>
Expand Down
4 changes: 2 additions & 2 deletions benchmark/http/_chunky_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const common = require('../common.js');
const net = require('net');

const bench = common.createBenchmark(main, {
len: [1, 4, 8, 16, 32, 64, 128],
n: [5, 50, 500, 2000],
len: [1, 4, 8, 16, 32, 64, 128],
n: [5, 50, 500, 2000],
type: ['send'],
});

Expand Down
6 changes: 3 additions & 3 deletions benchmark/tls/tls-connect.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
var fs = require('fs'),
path = require('path'),
tls = require('tls');
const fs = require('fs');
const path = require('path');
const tls = require('tls');

const common = require('../common.js');
const bench = common.createBenchmark(main, {
Expand Down
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.3',
'v8_embedder_string': '-node.4',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
Expand Down
7 changes: 4 additions & 3 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,7 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
uint64_t virtual_memory_limit) {
set_max_semi_space_size_in_kb(
i::Heap::ComputeMaxSemiSpaceSize(physical_memory));
set_max_old_space_size(
static_cast<int>(i::Heap::ComputeMaxOldGenerationSize(physical_memory)));
set_max_old_space_size(i::Heap::ComputeMaxOldGenerationSize(physical_memory));
set_max_zone_pool_size(i::AccountingAllocator::kMaxPoolSize);

if (virtual_memory_limit > 0 && i::kRequiresCodeRange) {
Expand All @@ -927,7 +926,9 @@ void ResourceConstraints::ConfigureDefaults(uint64_t physical_memory,
void SetResourceConstraints(i::Isolate* isolate,
const ResourceConstraints& constraints) {
size_t semi_space_size = constraints.max_semi_space_size_in_kb();
int old_space_size = constraints.max_old_space_size();
size_t old_space_size =
static_cast<size_t>(
static_cast<unsigned int>(constraints.max_old_space_size()));
size_t code_range_size = constraints.code_range_size();
size_t max_pool_size = constraints.max_zone_pool_size();
if (semi_space_size != 0 || old_space_size != 0 || code_range_size != 0) {
Expand Down
18 changes: 10 additions & 8 deletions deps/v8/src/flag-definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,15 @@ struct MaybeBoolFlag {
#define DEFINE_INT(nam, def, cmt) FLAG(INT, int, nam, def, cmt)
#define DEFINE_UINT(nam, def, cmt) FLAG(UINT, unsigned int, nam, def, cmt)
#define DEFINE_FLOAT(nam, def, cmt) FLAG(FLOAT, double, nam, def, cmt)
#define DEFINE_SIZE_T(nam, def, cmt) FLAG(SIZE_T, size_t, nam, def, cmt)
#define DEFINE_STRING(nam, def, cmt) FLAG(STRING, const char*, nam, def, cmt)
#define DEFINE_ARGS(nam, cmt) \
FLAG(ARGS, JSArguments, nam, {0 COMMA nullptr}, cmt)

#define DEFINE_ALIAS_BOOL(alias, nam) FLAG_ALIAS(BOOL, bool, alias, nam)
#define DEFINE_ALIAS_INT(alias, nam) FLAG_ALIAS(INT, int, alias, nam)
#define DEFINE_ALIAS_FLOAT(alias, nam) FLAG_ALIAS(FLOAT, double, alias, nam)
#define DEFINE_ALIAS_SIZE_T(alias, nam) FLAG_ALIAS(SIZE_T, size_t, alias, nam)
#define DEFINE_ALIAS_STRING(alias, nam) \
FLAG_ALIAS(STRING, const char*, alias, nam)
#define DEFINE_ALIAS_ARGS(alias, nam) FLAG_ALIAS(ARGS, JSArguments, alias, nam)
Expand Down Expand Up @@ -580,18 +582,18 @@ DEFINE_INT(generic_ic_threshold, 30,
DEFINE_INT(self_opt_count, 130, "call count before self-optimization")

// Garbage collections flags.
DEFINE_INT(min_semi_space_size, 0,
"min size of a semi-space (in MBytes), the new space consists of two"
"semi-spaces")
DEFINE_INT(max_semi_space_size, 0,
"max size of a semi-space (in MBytes), the new space consists of two"
"semi-spaces")
DEFINE_SIZE_T(min_semi_space_size, 0,
"min size of a semi-space (in MBytes), the new space consists of "
"two semi-spaces")
DEFINE_SIZE_T(max_semi_space_size, 0,
"max size of a semi-space (in MBytes), the new space consists of "
"two semi-spaces")
DEFINE_INT(semi_space_growth_factor, 2, "factor by which to grow the new space")
DEFINE_BOOL(experimental_new_space_growth_heuristic, false,
"Grow the new space based on the percentage of survivors instead "
"of their absolute value.")
DEFINE_INT(max_old_space_size, 0, "max size of the old space (in Mbytes)")
DEFINE_INT(initial_old_space_size, 0, "initial old space size (in Mbytes)")
DEFINE_SIZE_T(max_old_space_size, 0, "max size of the old space (in Mbytes)")
DEFINE_SIZE_T(initial_old_space_size, 0, "initial old space size (in Mbytes)")
DEFINE_BOOL(gc_global, false, "always perform global GCs")
DEFINE_INT(gc_interval, -1, "garbage collect after <n> allocations")
DEFINE_INT(retain_maps_for_n_gc, 2,
Expand Down
67 changes: 52 additions & 15 deletions deps/v8/src/flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "src/flags.h"

#include <cctype>
#include <cerrno>
#include <cstdlib>
#include <sstream>

Expand Down Expand Up @@ -39,6 +40,7 @@ struct Flag {
TYPE_INT,
TYPE_UINT,
TYPE_FLOAT,
TYPE_SIZE_T,
TYPE_STRING,
TYPE_ARGS
};
Expand Down Expand Up @@ -81,6 +83,11 @@ struct Flag {
return reinterpret_cast<double*>(valptr_);
}

size_t* size_t_variable() const {
DCHECK(type_ == TYPE_SIZE_T);
return reinterpret_cast<size_t*>(valptr_);
}

const char* string_value() const {
DCHECK(type_ == TYPE_STRING);
return *reinterpret_cast<const char**>(valptr_);
Expand Down Expand Up @@ -119,6 +126,11 @@ struct Flag {
return *reinterpret_cast<const double*>(defptr_);
}

size_t size_t_default() const {
DCHECK(type_ == TYPE_SIZE_T);
return *reinterpret_cast<const size_t*>(defptr_);
}

const char* string_default() const {
DCHECK(type_ == TYPE_STRING);
return *reinterpret_cast<const char* const *>(defptr_);
Expand All @@ -142,6 +154,8 @@ struct Flag {
return *uint_variable() == uint_default();
case TYPE_FLOAT:
return *float_variable() == float_default();
case TYPE_SIZE_T:
return *size_t_variable() == size_t_default();
case TYPE_STRING: {
const char* str1 = string_value();
const char* str2 = string_default();
Expand Down Expand Up @@ -173,6 +187,9 @@ struct Flag {
case TYPE_FLOAT:
*float_variable() = float_default();
break;
case TYPE_SIZE_T:
*size_t_variable() = size_t_default();
break;
case TYPE_STRING:
set_string_value(string_default(), false);
break;
Expand Down Expand Up @@ -201,6 +218,8 @@ static const char* Type2String(Flag::FlagType type) {
case Flag::TYPE_UINT:
return "uint";
case Flag::TYPE_FLOAT: return "float";
case Flag::TYPE_SIZE_T:
return "size_t";
case Flag::TYPE_STRING: return "string";
case Flag::TYPE_ARGS: return "arguments";
}
Expand All @@ -227,6 +246,9 @@ std::ostream& operator<<(std::ostream& os, const Flag& flag) { // NOLINT
case Flag::TYPE_FLOAT:
os << *flag.float_variable();
break;
case Flag::TYPE_SIZE_T:
os << *flag.size_t_variable();
break;
case Flag::TYPE_STRING: {
const char* str = flag.string_value();
os << (str ? str : "nullptr");
Expand Down Expand Up @@ -358,6 +380,27 @@ static Flag* FindFlag(const char* name) {
return nullptr;
}

template <typename T>
bool TryParseUnsigned(Flag* flag, const char* arg, const char* value,
char** endp, T* out_val) {
// We do not use strtoul because it accepts negative numbers.
// Rejects values >= 2**63 when T is 64 bits wide but that
// seems like an acceptable trade-off.
uint64_t max = static_cast<uint64_t>(std::numeric_limits<T>::max());
errno = 0;
int64_t val = static_cast<int64_t>(strtoll(value, endp, 10));
if (val < 0 || static_cast<uint64_t>(val) > max || errno != 0) {
PrintF(stderr,
"Error: Value for flag %s of type %s is out of bounds "
"[0-%" PRIu64
"]\n"
"Try --help for options\n",
arg, Type2String(flag->type()), max);
return false;
}
*out_val = static_cast<T>(val);
return true;
}

// static
int FlagList::SetFlagsFromCommandLine(int* argc,
Expand Down Expand Up @@ -422,27 +465,21 @@ int FlagList::SetFlagsFromCommandLine(int* argc,
case Flag::TYPE_INT:
*flag->int_variable() = static_cast<int>(strtol(value, &endp, 10));
break;
case Flag::TYPE_UINT: {
// We do not use strtoul because it accepts negative numbers.
int64_t val = static_cast<int64_t>(strtoll(value, &endp, 10));
if (val < 0 || val > std::numeric_limits<unsigned int>::max()) {
PrintF(stderr,
"Error: Value for flag %s of type %s is out of bounds "
"[0-%" PRIu64
"]\n"
"Try --help for options\n",
arg, Type2String(flag->type()),
static_cast<uint64_t>(
std::numeric_limits<unsigned int>::max()));
case Flag::TYPE_UINT:
if (!TryParseUnsigned(flag, arg, value, &endp,
flag->uint_variable())) {
return_code = j;
break;
}
*flag->uint_variable() = static_cast<unsigned int>(val);
break;
}
case Flag::TYPE_FLOAT:
*flag->float_variable() = strtod(value, &endp);
break;
case Flag::TYPE_SIZE_T:
if (!TryParseUnsigned(flag, arg, value, &endp,
flag->size_t_variable())) {
return_code = j;
}
break;
case Flag::TYPE_STRING:
flag->set_string_value(value ? StrDup(value) : nullptr, true);
break;
Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/heap/heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5095,8 +5095,8 @@ bool Heap::ConfigureHeap(size_t max_semi_space_size_in_kb,

// The new space size must be a power of two to support single-bit testing
// for containment.
max_semi_space_size_ = base::bits::RoundUpToPowerOfTwo32(
static_cast<uint32_t>(max_semi_space_size_));
max_semi_space_size_ = static_cast<size_t>(base::bits::RoundUpToPowerOfTwo64(
static_cast<uint64_t>(max_semi_space_size_)));

if (max_semi_space_size_ == kMaxSemiSpaceSizeInKB * KB) {
// Start with at least 1*MB semi-space on machines with a lot of memory.
Expand Down
26 changes: 13 additions & 13 deletions deps/v8/src/heap/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -626,15 +626,15 @@ class Heap {
#endif

// Semi-space size needs to be a multiple of page size.
static const int kMinSemiSpaceSizeInKB =
static const size_t kMinSemiSpaceSizeInKB =
1 * kPointerMultiplier * ((1 << kPageSizeBits) / KB);
static const int kMaxSemiSpaceSizeInKB =
static const size_t kMaxSemiSpaceSizeInKB =
16 * kPointerMultiplier * ((1 << kPageSizeBits) / KB);

// The old space size has to be a multiple of Page::kPageSize.
// Sizes are in MB.
static const int kMinOldGenerationSize = 128 * kPointerMultiplier;
static const int kMaxOldGenerationSize = 1024 * kPointerMultiplier;
static const size_t kMinOldGenerationSize = 128 * kPointerMultiplier;
static const size_t kMaxOldGenerationSize = 1024 * kPointerMultiplier;

static const int kTraceRingBufferSize = 512;
static const int kStacktraceBufferSize = 512;
Expand Down Expand Up @@ -1372,10 +1372,10 @@ class Heap {
size_t MaxOldGenerationSize() { return max_old_generation_size_; }

static size_t ComputeMaxOldGenerationSize(uint64_t physical_memory) {
const int old_space_physical_memory_factor = 4;
int computed_size =
static_cast<int>(physical_memory / i::MB /
old_space_physical_memory_factor * kPointerMultiplier);
const size_t old_space_physical_memory_factor = 4;
size_t computed_size = static_cast<size_t>(
physical_memory / i::MB / old_space_physical_memory_factor *
kPointerMultiplier);
return Max(Min(computed_size, kMaxOldGenerationSize),
kMinOldGenerationSize);
}
Expand All @@ -1387,11 +1387,11 @@ class Heap {
uint64_t capped_physical_memory =
Max(Min(physical_memory, max_physical_memory), min_physical_memory);
// linearly scale max semi-space size: (X-A)/(B-A)*(D-C)+C
int semi_space_size_in_kb =
static_cast<int>(((capped_physical_memory - min_physical_memory) *
(kMaxSemiSpaceSizeInKB - kMinSemiSpaceSizeInKB)) /
(max_physical_memory - min_physical_memory) +
kMinSemiSpaceSizeInKB);
size_t semi_space_size_in_kb =
static_cast<size_t>(((capped_physical_memory - min_physical_memory) *
(kMaxSemiSpaceSizeInKB - kMinSemiSpaceSizeInKB)) /
(max_physical_memory - min_physical_memory) +
kMinSemiSpaceSizeInKB);
return RoundUp(semi_space_size_in_kb, (1 << kPageSizeBits) / KB);
}

Expand Down
1 change: 1 addition & 0 deletions doc/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rules:
no-var: error
prefer-const: error
prefer-rest-params: error
prefer-template: error

# Stylistic Issues
no-multiple-empty-lines: [error, {max: 1, maxEOF: 0, maxBOF: 0}]
Loading

0 comments on commit ddad39c

Please sign in to comment.