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

Commit

Permalink
Merge remote-tracking branch 'nodejs/master' into chnext
Browse files Browse the repository at this point in the history
# Conflicts:
#	vcbuild.bat
  • Loading branch information
Jianchun Xu committed Dec 3, 2015
2 parents 26c1f6d + 8677627 commit 7953699
Show file tree
Hide file tree
Showing 110 changed files with 2,760 additions and 3,484 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ Instructions:
All security bugs in node.js are taken seriously and should be reported by
emailing [email protected]. This will be delivered to a subset of the project
team who handle security issues. Please don't disclose security bugs
public until they have been handled by the security team.
publicly until they have been handled by the security team.

Your email will be acknowledged within 24 hours, and you’ll receive a more
detailed response to your email within 48 hours indicating the next steps in
Expand Down
19 changes: 18 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ parser.add_option("--fully-static",
help="Generate an executable without external dynamic libraries. This "
"will not work on OSX when using default compilation environment")

parser.add_option("--enable-vtune-profiling",
action="store_true",
dest="enable_vtune_profiling",
help="Enable profiling support for Intel Vtune profiler to profile"
"JavaScript code executed in nodejs. This feature is only available "
"for ia32, x32 or x64 platform.")


parser.add_option("--link-module",
action="append",
dest="linked_module",
Expand Down Expand Up @@ -690,6 +698,15 @@ def configure_node(o):
o['variables']['node_core_target_name'] = 'node_base'
o['variables']['node_target_type'] = 'static_library'

if target_arch in ('x86', 'x64', 'ia32', 'x32'):
o['variables']['node_enable_v8_vtunejit'] = b(options.enable_vtune_profiling)
elif options.enable_vtune_profiling:
raise Exception(
'vtune profiler for JavaScript is only supported on x86, x32 or x64 '
'platform.')
else:
o['variables']['node_enable_v8_vtunejit'] = 'false'

if flavor in ('solaris', 'mac', 'linux', 'freebsd'):
use_dtrace = not options.without_dtrace
# Don't enable by default on linux and freebsd
Expand Down Expand Up @@ -788,7 +805,7 @@ def configure_v8(o):
o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs.
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'] = 0 if options.without_snapshot else 1
o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true'

def configure_openssl(o):
o['variables']['node_use_openssl'] = b(not options.without_ssl)
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/ast-numbering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ bool AstNumberingVisitor::Renumber(FunctionLiteral* node) {
Scope* scope = node->scope();

if (scope->HasIllegalRedeclaration()) {
scope->VisitIllegalRedeclaration(this);
Visit(scope->GetIllegalRedeclaration());
DisableOptimization(kFunctionWithIllegalRedeclaration);
return Finish(node);
}
Expand Down
3 changes: 1 addition & 2 deletions deps/v8/src/compiler/ast-graph-builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,7 @@ void AstGraphBuilder::CreateGraphBody(bool stack_check) {

// Visit illegal re-declaration and bail out if it exists.
if (scope->HasIllegalRedeclaration()) {
AstEffectContext for_effect(this);
scope->VisitIllegalRedeclaration(this);
VisitForEffect(scope->GetIllegalRedeclaration());
return;
}

Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/compiler/linkage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ int Linkage::FrameStateInputCount(Runtime::FunctionId function) {
switch (function) {
case Runtime::kAllocateInTargetSpace:
case Runtime::kDateField:
case Runtime::kFinalizeClassDefinition: // TODO(conradw): Is it safe?
case Runtime::kDefineClassMethod: // TODO(jarin): Is it safe?
case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it safe?
case Runtime::kDefineSetterPropertyUnchecked: // TODO(jarin): Is it safe?
case Runtime::kFinalizeClassDefinition: // TODO(conradw): Is it safe?
case Runtime::kForInDone:
case Runtime::kForInStep:
case Runtime::kGetOriginalConstructor:
Expand All @@ -244,6 +244,7 @@ int Linkage::FrameStateInputCount(Runtime::FunctionId function) {
case Runtime::kInlineGetCallerJSFunction:
case Runtime::kInlineGetPrototype:
case Runtime::kInlineRegExpExec:
case Runtime::kInlineSubString:
case Runtime::kInlineToObject:
return 1;
case Runtime::kInlineDeoptimizeNow:
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/full-codegen/arm/full-codegen-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void FullCodeGenerator::Generate() {
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
scope()->VisitIllegalRedeclaration(this);
VisitForEffect(scope()->GetIllegalRedeclaration());

} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/full-codegen/arm64/full-codegen-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ void FullCodeGenerator::Generate() {
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
scope()->VisitIllegalRedeclaration(this);
VisitForEffect(scope()->GetIllegalRedeclaration());

} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/full-codegen/ia32/full-codegen-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void FullCodeGenerator::Generate() {
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
scope()->VisitIllegalRedeclaration(this);
VisitForEffect(scope()->GetIllegalRedeclaration());

} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/full-codegen/mips/full-codegen-mips.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ void FullCodeGenerator::Generate() {
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
scope()->VisitIllegalRedeclaration(this);
VisitForEffect(scope()->GetIllegalRedeclaration());

} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/full-codegen/mips64/full-codegen-mips64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ void FullCodeGenerator::Generate() {
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
scope()->VisitIllegalRedeclaration(this);
VisitForEffect(scope()->GetIllegalRedeclaration());

} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/full-codegen/ppc/full-codegen-ppc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ void FullCodeGenerator::Generate() {
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
scope()->VisitIllegalRedeclaration(this);
VisitForEffect(scope()->GetIllegalRedeclaration());

} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/full-codegen/x64/full-codegen-x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void FullCodeGenerator::Generate() {
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
scope()->VisitIllegalRedeclaration(this);
VisitForEffect(scope()->GetIllegalRedeclaration());

} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/full-codegen/x87/full-codegen-x87.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void FullCodeGenerator::Generate() {
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
scope()->VisitIllegalRedeclaration(this);
VisitForEffect(scope()->GetIllegalRedeclaration());

} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
Expand Down
9 changes: 7 additions & 2 deletions deps/v8/src/isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1279,9 +1279,14 @@ void Isolate::ComputeLocation(MessageLocation* target) {
Object* script = fun->shared()->script();
if (script->IsScript() &&
!(Script::cast(script)->source()->IsUndefined())) {
int pos = frame->LookupCode()->SourcePosition(frame->pc());
// Compute the location from the function and the reloc info.
Handle<Script> casted_script(Script::cast(script));
// Compute the location from the function and the relocation info of the
// baseline code. For optimized code this will use the deoptimization
// information to get canonical location information.
List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
it.frame()->Summarize(&frames);
FrameSummary& summary = frames.last();
int pos = summary.code()->SourcePosition(summary.pc());
*target = MessageLocation(casted_script, pos, pos + 1, handle(fun));
}
}
Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/scopes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,9 @@ void Scope::SetIllegalRedeclaration(Expression* expression) {
}


void Scope::VisitIllegalRedeclaration(AstVisitor* visitor) {
Expression* Scope::GetIllegalRedeclaration() {
DCHECK(HasIllegalRedeclaration());
illegal_redecl_->Accept(visitor);
return illegal_redecl_;
}


Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/scopes.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ class Scope: public ZoneObject {
// the additional requests will be silently ignored.
void SetIllegalRedeclaration(Expression* expression);

// Visit the illegal redeclaration expression. Do not call if the
// Retrieve the illegal redeclaration expression. Do not call if the
// scope doesn't have an illegal redeclaration node.
void VisitIllegalRedeclaration(AstVisitor* visitor);
Expression* GetIllegalRedeclaration();

// Check if the scope has (at least) one illegal redeclaration.
bool HasIllegalRedeclaration() const { return illegal_redecl_ != NULL; }
Expand Down
11 changes: 11 additions & 0 deletions deps/v8/test/message/regress/regress-4266.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

(function() {
try {
[].foo();
} catch (e) {
throw e;
}
})();
10 changes: 10 additions & 0 deletions deps/v8/test/message/regress/regress-4266.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2015 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

*%(basename)s:9: TypeError: [].foo is not a function
throw e;
^
TypeError: [].foo is not a function
at *%(basename)s:7:8
at *%(basename)s:11:3
17 changes: 17 additions & 0 deletions deps/v8/test/mjsunit/regress/regress-4266.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --turbo-filter=test --allow-natives-syntax

function test() {
try {
[].foo();
} catch (e) {
return e.message;
}
}

assertEquals("[].foo is not a function", test());
%OptimizeFunctionOnNextCall(test);
assertEquals("[].foo is not a function", test());
4 changes: 3 additions & 1 deletion doc/api/buffer.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,8 @@ to `false`.
* Number, Default: 50

How many bytes will be returned when `buffer.inspect()` is called. This can
be overridden by user modules.
be overridden by user modules. See [util.inspect()][] for more details on
`buffer.inspect()` behavior.

Note that this is a property on the buffer module returned by
`require('buffer')`, not on the Buffer global, or a buffer instance.
Expand Down Expand Up @@ -933,3 +934,4 @@ has actively observed undue memory retention in their applications.

[`buf1.compare(buf2)`]: #buffer_buf_compare_otherbuffer
[Array#indexOf()]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
[util.inspect()]: util.html#util_util_inspect_object_options
3 changes: 1 addition & 2 deletions doc/api/child_process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ leaner than [`child_process.exec()`][]. It has the same options.
This is a special case of the [`child_process.spawn()`][] functionality for
spawning Node.js processes. In addition to having all the methods in a normal
ChildProcess instance, the returned object has a communication channel built-in.
See [`child.send(message, [sendHandle])`][] for details.
See [`ChildProcess#send()`][] for details.

These child Node.js processes are still whole new instances of V8. Assume at
least 30ms startup and 10mb memory for each new Node.js. That is, you cannot
Expand Down Expand Up @@ -779,5 +779,4 @@ process has exited.
[spawn]: #child_process_child_process_spawn_command_args_options
[`child_process.exec()`]: #child_process_child_process_exec_command_options_callback
[`child_process.spawn()`]: #child_process_child_process_spawn_command_args_options
[`child.send(message, [sendHandle])`]: #child_process_child_send_message_sendhandle_callback
[`child_process.spawnSync()`]: #child_process_child_process_spawnsync_command_args_options
2 changes: 1 addition & 1 deletion doc/api/cluster.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -650,4 +650,4 @@ the worker's unique id is the easiest way to find the worker.
[Child Process module]: child_process.html#child_process_child_process_fork_modulepath_args_options
[ChildProcess.send()]: child_process.html#child_process_child_send_message_sendhandle_callback
[child_process event: 'exit']: child_process.html#child_process_event_exit
[child_process event: 'message']: child_process.html#child_process_event_message.
[child_process event: 'message']: child_process.html#child_process_event_message
10 changes: 9 additions & 1 deletion doc/api/crypto.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,16 @@ Asynchronous PBKDF2 function. Applies the selected HMAC digest function
salt and number of iterations. The callback gets two arguments:
`(err, derivedKey)`.

The number of iterations passed to pbkdf2 should be as high as possible, the
higher the number, the more secure it will be, but will take a longer amount of
time to complete.

Chosen salts should also be unique. It is recommended that the salts are random
and their length is greater than 16 bytes. See [NIST SP 800-132] for details.

Example:

crypto.pbkdf2('secret', 'salt', 4096, 64, 'sha256', function(err, key) {
crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', function(err, key) {
if (err)
throw err;
console.log(key.toString('hex')); // 'c5e478d...1469e50'
Expand Down Expand Up @@ -789,6 +796,7 @@ See the reference for other recommendations and details.
[RFC 3526]: http://www.rfc-editor.org/rfc/rfc3526.txt
[crypto.pbkdf2]: #crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback
[EVP_BytesToKey]: https://www.openssl.org/docs/crypto/EVP_BytesToKey.html
[NIST SP 800-132]: http://csrc.nist.gov/publications/nistpubs/800-132/nist-sp800-132.pdf
[NIST SP 800-131A]: http://csrc.nist.gov/publications/nistpubs/800-131A/sp800-131A.pdf
[initialization vector]: http://en.wikipedia.org/wiki/Initialization_vector
[Caveats]: #crypto_caveats
Expand Down
9 changes: 5 additions & 4 deletions doc/api/errors.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,10 @@ of argument validation.

<!--type=misc-->

A JavaScript "exception" is a value that is thrown as a result of an invalid operation or
as the target of a `throw` statement. While it is not required that these values inherit from
`Error`, all exceptions thrown by Node.js or the JavaScript runtime *will* be instances of Error.
A JavaScript exception is a value that is thrown as a result of an invalid operation or
as the target of a `throw` statement. While it is not required that these values are instances of
`Error` or classes which inherit from `Error`, all exceptions thrown by Node.js or the JavaScript
runtime *will* be instances of Error.

Some exceptions are *unrecoverable* at the JavaScript layer. These exceptions will always bring
down the process. These are usually failed `assert()` checks or `abort()` calls in the C++ layer.
Expand Down Expand Up @@ -469,7 +470,7 @@ often a sign that a connected socket was not `.end()`'d appropriately.

[Error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
[below]: #errors_error_propagation_and_interception
[fs.readFileSync]: fs.html#fs_fs_readfilesync_filename_options
[fs.readFileSync]: fs.html#fs_fs_readfilesync_file_options
[stream-based]: stream.html
[event emitter-based]: events.html#events_class_events_eventemitter
[domains]: domain.html
Expand Down
14 changes: 11 additions & 3 deletions doc/api/fs.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ start at 0. The `encoding` can be any one of those accepted by [Buffer][].

If `fd` is specified, `ReadStream` will ignore the `path` argument and will use
the specified file descriptor. This means that no `open` event will be emitted.
Note that `fd` should be blocking; non-blocking `fd`s should be passed to
`net.Socket`.

If `autoClose` is false, then the file descriptor won't be closed, even if
there's an error. It is your responsibility to close it and make sure
Expand Down Expand Up @@ -341,7 +343,8 @@ default mode `w`. The `defaultEncoding` can be any one of those accepted by [Buf

Like `ReadStream` above, if `fd` is specified, `WriteStream` will ignore the
`path` argument and will use the specified file descriptor. This means that no
`open` event will be emitted.
`open` event will be emitted. Note that `fd` should be blocking; non-blocking
`fd`s should be passed to `net.Socket`.

If `options` is a string, then it specifies the encoding.

Expand All @@ -364,11 +367,11 @@ non-existent.

## fs.existsSync(path)

Stability: 0 - Deprecated: Use [fs.statSync][] or [fs.accessSync][] instead.

Synchronous version of [`fs.exists`][].
Returns `true` if the file exists, `false` otherwise.

Stability: 0 - Deprecated: Use [fs.statSync][] or [fs.accessSync][] instead.

## fs.fchmod(fd, mode, callback)

Asynchronous fchmod(2). No arguments other than a possible exception
Expand Down Expand Up @@ -526,6 +529,11 @@ created. On POSIX systems, `path` is considered to exist even if it is a symlink
to a non-existent file. The exclusive flag may or may not work with network file
systems.

`flags` can also be a number as documented by open(2); commonly used constants
are available from `require('constants')`. On Windows, flags are translated to
their equivalent ones where applicable, e.g. `O_WRONLY` to `FILE_GENERIC_WRITE`,
or `O_EXCL|O_CREAT` to `CREATE_NEW`, as accepted by CreateFileW.

On Linux, positional writes don't work when the file is opened in append mode.
The kernel ignores the position argument and always appends the data to
the end of the file.
Expand Down
7 changes: 2 additions & 5 deletions doc/api/http.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ HTTP API is very low-level. It deals with stream handling and message
parsing only. It parses a message into headers and body but it does not
parse the actual headers or the body.

Defined headers that allow multiple values are concatenated with a `,`
character, except for the `set-cookie` and `cookie` headers which are
represented as an array of values. Headers such as `content-length`
which can only have a single value are parsed accordingly, and only a
single value is represented on the parsed object.
See [message.headers][] for details on how duplicate headers are handled.

The raw headers as they were received are retained in the `rawHeaders`
property, which is an array of `[key, value, key2, value2, ...]`. For
Expand Down Expand Up @@ -1083,6 +1079,7 @@ There are a few special headers that should be noted.
* Sending an Authorization header will override using the `auth` option
to compute basic authentication.

[message.headers][]: #http_message_headers
[constructor options]: #http_new_agent_options
[`destroy()`]: #http_agent_destroy
['checkContinue']: #http_event_checkcontinue
Expand Down
Loading

0 comments on commit 7953699

Please sign in to comment.