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

Commit

Permalink
Merge 'nodejs/master' into chakracore-master
Browse files Browse the repository at this point in the history
Sync nodejs/master at 6510eb5 as of 2016-07-16

PR-URL: #98
Reviewed-By: Jianchun Xu <Jianchun.Xu@microsoft.com>
  • Loading branch information
kunalspathak committed Jul 19, 2016
2 parents 784edee + 6510eb5 commit 581e929
Show file tree
Hide file tree
Showing 752 changed files with 11,668 additions and 12,244 deletions.
4 changes: 2 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lib/internal/v8_prof_polyfill.js
lib/punycode.js
test/addons/??_*/
test/fixtures
test/**/node_modules
test/disabled
test/tmp*/
tools/doc/node_modules
tools/eslint
node_modules
65 changes: 33 additions & 32 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ env:
rules:
# Possible Errors
# http://eslint.org/docs/rules/#possible-errors
comma-dangle: [2, "only-multiline"]
comma-dangle: [2, only-multiline]
no-control-regex: 2
no-debugger: 2
no-dupe-args: 2
Expand All @@ -14,7 +14,7 @@ rules:
no-empty-character-class: 2
no-ex-assign: 2
no-extra-boolean-cast: 2
no-extra-parens: [2, "functions"]
no-extra-parens: [2, functions]
no-extra-semi: 2
no-func-assign: 2
no-invalid-regexp: 2
Expand All @@ -38,46 +38,47 @@ rules:

# Strict Mode
# http://eslint.org/docs/rules/#strict-mode
strict: [2, "global"]
strict: [2, global]

# Variables
# http://eslint.org/docs/rules/#variables
no-delete-var: 2
no-undef: 2
no-unused-vars: [2, {"args": "none"}]
no-unused-vars: [2, {args: none}]

# Node.js and CommonJS
# http://eslint.org/docs/rules/#nodejs-and-commonjs
no-mixed-requires: 2
no-new-require: 2
no-path-concat: 2
no-restricted-modules: [2, "sys", "_linklist"]
no-restricted-modules: [2, sys, _linklist]

# Stylistic Issues
# http://eslint.org/docs/rules/#stylistic-issues
brace-style: [2, 1tbs, {allowSingleLine: true}]
comma-spacing: 2
eol-last: 2
indent: [2, 2, {SwitchCase: 1}]
key-spacing: [2, {mode: "minimum"}]
key-spacing: [2, {mode: minimum}]
keyword-spacing: 2
linebreak-style: [1, "unix"]
linebreak-style: [1, unix]
max-len: [2, 80, 2]
new-parens: 2
no-mixed-spaces-and-tabs: 2
no-multiple-empty-lines: [2, {max: 2}]
no-trailing-spaces: 2
quotes: [2, "single", "avoid-escape"]
quotes: [2, single, avoid-escape]
semi: 2
space-before-blocks: [2, "always"]
space-before-function-paren: [2, "never"]
space-in-parens: [2, "never"]
space-before-blocks: [2, always]
space-before-function-paren: [2, never]
space-in-parens: [2, never]
space-infix-ops: 2
space-unary-ops: 2

# ECMAScript 6
# http://eslint.org/docs/rules/#ecmascript-6
arrow-parens: [2, "always"]
arrow-spacing: [2, {"before": true, "after": true}]
arrow-parens: [2, always]
arrow-spacing: [2, {before: true, after: true}]
constructor-super: 2
no-class-assign: 2
no-confusing-arrow: 2
Expand All @@ -92,27 +93,27 @@ rules:
align-function-arguments: 2
align-multiline-assignment: 2
assert-fail-single-argument: 2
new-with-error: [2, "Error", "RangeError", "TypeError", "SyntaxError", "ReferenceError"]
new-with-error: [2, Error, RangeError, TypeError, SyntaxError, ReferenceError]
no-deepEqual: 2
no-definegetter-definesetter: 2

# Global scoped method and vars
globals:
DTRACE_HTTP_CLIENT_REQUEST : false
LTTNG_HTTP_CLIENT_REQUEST : false
COUNTER_HTTP_CLIENT_REQUEST : false
DTRACE_HTTP_CLIENT_RESPONSE : false
LTTNG_HTTP_CLIENT_RESPONSE : false
COUNTER_HTTP_CLIENT_RESPONSE : false
DTRACE_HTTP_SERVER_REQUEST : false
LTTNG_HTTP_SERVER_REQUEST : false
COUNTER_HTTP_SERVER_REQUEST : false
DTRACE_HTTP_SERVER_RESPONSE : false
LTTNG_HTTP_SERVER_RESPONSE : false
COUNTER_HTTP_SERVER_RESPONSE : false
DTRACE_NET_STREAM_END : false
LTTNG_NET_STREAM_END : false
COUNTER_NET_SERVER_CONNECTION_CLOSE : false
DTRACE_NET_SERVER_CONNECTION : false
LTTNG_NET_SERVER_CONNECTION : false
COUNTER_NET_SERVER_CONNECTION : false
COUNTER_HTTP_CLIENT_REQUEST: false
COUNTER_HTTP_CLIENT_RESPONSE: false
COUNTER_HTTP_SERVER_REQUEST: false
COUNTER_HTTP_SERVER_RESPONSE: false
COUNTER_NET_SERVER_CONNECTION: false
COUNTER_NET_SERVER_CONNECTION_CLOSE: false
DTRACE_HTTP_CLIENT_REQUEST: false
DTRACE_HTTP_CLIENT_RESPONSE: false
DTRACE_HTTP_SERVER_REQUEST: false
DTRACE_HTTP_SERVER_RESPONSE: false
DTRACE_NET_SERVER_CONNECTION: false
DTRACE_NET_STREAM_END: false
LTTNG_HTTP_CLIENT_REQUEST: false
LTTNG_HTTP_CLIENT_RESPONSE: false
LTTNG_HTTP_SERVER_REQUEST: false
LTTNG_HTTP_SERVER_RESPONSE: false
LTTNG_NET_SERVER_CONNECTION: false
LTTNG_NET_STREAM_END: false
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ $ ./configure && make -j8 test
Make sure the linter is happy and that all tests pass. Please, do not submit
patches that fail either check.

Running `make test` will run the linter as well unless one or more tests fail.
If you want to run the linter without running tests, use `make lint`.

If you are updating tests and just want to run a single test to check it, you
can use this syntax to run it exactly as the test harness would:

Expand Down
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ cctest: all

v8:
tools/make-v8.sh v8
$(MAKE) -C deps/v8 $(V8_ARCH) $(V8_BUILD_OPTIONS)
$(MAKE) -C deps/v8 $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)

test: all
$(MAKE) build-addons
Expand Down Expand Up @@ -246,22 +246,22 @@ test-timers-clean:


ifneq ("","$(wildcard deps/v8/tools/run-tests.py)")
test-v8:
test-v8: v8
# note: performs full test unless QUICKCHECK is specified
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
--mode=$(BUILDTYPE_LOWER) $(V8_TEST_OPTIONS) $(QUICKCHECK_ARG) \
--no-presubmit \
--shell-dir=$(PWD)/deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) \
$(TAP_V8)

test-v8-intl:
test-v8-intl: v8
# note: performs full test unless QUICKCHECK is specified
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
--mode=$(BUILDTYPE_LOWER) --no-presubmit $(QUICKCHECK_ARG) \
--shell-dir=deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) intl \
$(TAP_V8_INTL)

test-v8-benchmarks:
test-v8-benchmarks: v8
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) --mode=$(BUILDTYPE_LOWER) \
--download-data $(QUICKCHECK_ARG) --no-presubmit \
--shell-dir=deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) benchmarks \
Expand Down Expand Up @@ -678,13 +678,11 @@ bench-idle:
$(NODE) benchmark/idle_clients.js &

jslint:
$(NODE) tools/jslint.js -J benchmark lib src test tools/doc \
tools/eslint-rules tools/jslint.js
$(NODE) tools/jslint.js -J benchmark lib src test tools

jslint-ci:
$(NODE) tools/jslint.js $(PARALLEL_ARGS) -f tap -o test-eslint.tap \
benchmark lib src test tools/doc \
tools/eslint-rules tools/jslint.js
benchmark lib src test tools

CPPLINT_EXCLUDE ?=
CPPLINT_EXCLUDE += src/node_root_certs.h
Expand Down
3 changes: 1 addition & 2 deletions benchmark/child_process/child-process-read-ipc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';
if (process.argv[2] === 'child')
{
if (process.argv[2] === 'child') {
const len = +process.argv[3];
const msg = `"${'.'.repeat(len)}"`;
while (true) {
Expand Down
5 changes: 0 additions & 5 deletions benchmark/dgram/array-vs-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ var dgram = require('dgram');

function server() {
var sent = 0;
var received = 0;
var socket = dgram.createSocket('udp4');

var onsend = type === 'concat' ? onsendConcat : onsendMulti;
Expand Down Expand Up @@ -71,9 +70,5 @@ function server() {
}, dur * 1000);
});

socket.on('message', function(buf, rinfo) {
received++;
});

socket.bind(PORT);
}
4 changes: 0 additions & 4 deletions benchmark/http/_chunky_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ function main(conf) {
}
}

var success = 0;
var failure = 0;
var min = 10;
var size = 0;
var mod = 317;
Expand All @@ -69,14 +67,12 @@ function main(conf) {
if ((d.length === pattern.length && d === pattern) ||
(d.length > pattern.length &&
d.slice(0, pattern.length) === pattern)) {
success += 1;
did = true;
} else {
pattern = 'HTTP/1.1 ';
if ((d.length === pattern.length && d === pattern) ||
(d.length > pattern.length &&
d.slice(0, pattern.length) === pattern)) {
failure += 1;
did = true;
}
}
Expand Down
2 changes: 0 additions & 2 deletions benchmark/static_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var port = 12346;
var n = 700;
var bytes = 1024 * 5;

var requests = 0;
var responses = 0;

var body = 'C'.repeat(bytes);
Expand Down Expand Up @@ -37,6 +36,5 @@ server.listen(port, function() {
});
});
req.id = i;
requests++;
}
});
15 changes: 13 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ parser.add_option('--release-urlbase',
'`sourceUrl` and `headersUrl`. When compiling a release build, this '
'will default to https://nodejs.org/download/release/')

parser.add_option('--enable-d8',
action='store_true',
dest='enable_d8',
help=optparse.SUPPRESS_HELP) # Unsupported, undocumented.

parser.add_option('--v8-options',
action='store',
dest='v8_options',
Expand Down Expand Up @@ -843,8 +848,6 @@ def configure_node(o):

o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)
o['variables']['node_shared'] = b(options.shared)
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8)
o['variables']['node_module_version'] = int(getmoduleversion.get_version())

if options.linked_module:
Expand Down Expand Up @@ -892,6 +895,14 @@ def configure_v8(o):
o['variables']['v8_optimized_debug'] = 0 # Compile with -O0 in debug builds.
o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables.
o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true'
o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform)
o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8)
o['variables']['node_enable_d8'] = b(options.enable_d8)
if options.enable_d8:
o['variables']['test_isolation_mode'] = 'noop' # Needed by d8.gyp.
if options.without_bundled_v8 and options.enable_d8:
raise Exception('--enable-d8 is incompatible with --without-bundled-v8.')


def configure_openssl(o):
o['variables']['node_use_openssl'] = b(not options.without_ssl)
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 5
#define V8_MINOR_VERSION 1
#define V8_BUILD_NUMBER 281
#define V8_PATCH_LEVEL 69
#define V8_PATCH_LEVEL 75

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
9 changes: 9 additions & 0 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -3241,6 +3241,7 @@ class PropertyCallbackInfo {

typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info);

enum class ConstructorBehavior { kThrow, kAllow };

/**
* A JavaScript function object (ECMA-262, 15.3).
Expand All @@ -3255,6 +3256,11 @@ class V8_EXPORT Function : public Object {
FunctionCallback callback,
Local<Value> data = Local<Value>(),
int length = 0);
static MaybeLocal<Function> New(Local<Context> context,
FunctionCallback callback,
Local<Value> data,
int length,
ConstructorBehavior behavior);
static V8_DEPRECATE_SOON(
"Use maybe version",
Local<Function> New(Isolate* isolate, FunctionCallback callback,
Expand Down Expand Up @@ -4478,6 +4484,9 @@ class V8_EXPORT FunctionTemplate : public Template {
Isolate* isolate, FunctionCallback callback = 0,
Local<Value> data = Local<Value>(),
Local<Signature> signature = Local<Signature>(), int length = 0);
static Local<FunctionTemplate> New(
Isolate* isolate, FunctionCallback callback, Local<Value> data,
Local<Signature> signature, int length, ConstructorBehavior behavior);

/**
* Creates a function template with a fast handler. If a fast handler is set,
Expand Down
30 changes: 24 additions & 6 deletions deps/v8/src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1153,14 +1153,26 @@ Local<FunctionTemplate> FunctionTemplate::New(Isolate* isolate,
v8::Local<Value> data,
v8::Local<Signature> signature,
int length) {
return New(
isolate, callback, data, signature, length, ConstructorBehavior::kAllow);
}

Local<FunctionTemplate> FunctionTemplate::New(Isolate* isolate,
FunctionCallback callback,
v8::Local<Value> data,
v8::Local<Signature> signature,
int length,
ConstructorBehavior behavior) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
// Changes to the environment cannot be captured in the snapshot. Expect no
// function templates when the isolate is created for serialization.
DCHECK(!i_isolate->serializer_enabled());
LOG_API(i_isolate, "FunctionTemplate::New");
ENTER_V8(i_isolate);
return FunctionTemplateNew(i_isolate, callback, nullptr, data, signature,
length, false);
auto tmpl = FunctionTemplateNew(i_isolate, callback, nullptr, data, signature,
length, false);
if (behavior == ConstructorBehavior::kThrow) tmpl->RemovePrototype();
return tmpl;
}


Expand Down Expand Up @@ -4449,15 +4461,21 @@ Local<v8::Value> Object::CallAsConstructor(int argc,
MaybeLocal<Function> Function::New(Local<Context> context,
FunctionCallback callback, Local<Value> data,
int length) {
return New(context, callback, data, length, ConstructorBehavior::kAllow);
}

MaybeLocal<Function> Function::New(Local<Context> context,
FunctionCallback callback, Local<Value> data,
int length, ConstructorBehavior behavior) {
i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate();
LOG_API(isolate, "Function::New");
ENTER_V8(isolate);
return FunctionTemplateNew(isolate, callback, nullptr, data,
Local<Signature>(), length, true)
->GetFunction(context);
auto tmpl = FunctionTemplateNew(isolate, callback, nullptr, data,
Local<Signature>(), length, true);
if (behavior == ConstructorBehavior::kThrow) tmpl->RemovePrototype();
return tmpl->GetFunction(context);
}


Local<Function> Function::New(Isolate* v8_isolate, FunctionCallback callback,
Local<Value> data, int length) {
return Function::New(v8_isolate->GetCurrentContext(), callback, data, length)
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/compiler/js-create-lowering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,9 @@ Reduction JSCreateLowering::ReduceNewArray(Node* node, Node* length,
PretenureFlag pretenure = site->GetPretenureMode();
ElementsKind elements_kind = site->GetElementsKind();
DCHECK(IsFastElementsKind(elements_kind));
if (NodeProperties::GetType(length)->Max() > 0) {
elements_kind = GetHoleyElementsKind(elements_kind);
}
dependencies()->AssumeTenuringDecision(site);
dependencies()->AssumeTransitionStable(site);

Expand Down
Loading

0 comments on commit 581e929

Please sign in to comment.