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

Commit

Permalink
Merge branch 'nodejs/master' into chakracore-master
Browse files Browse the repository at this point in the history
Sync to nodejs/master (2016-05-05) at 330ea76

PR-URL: #69
Reviewed-By: Jianchun Xu <Jianchun.Xu@microsoft.com>
  • Loading branch information
kunalspathak committed May 11, 2016
2 parents c7129ab + a4f94b4 commit ca75446
Show file tree
Hide file tree
Showing 1,794 changed files with 581,232 additions and 32,579 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Expand Up @@ -85,6 +85,7 @@ rules:
prefer-const: 2

# Custom rules in tools/eslint-rules
align-function-arguments: 2
align-multiline-assignment: 2
assert-fail-single-argument: 2
new-with-error: [2, "Error", "RangeError", "TypeError", "SyntaxError", "ReferenceError"]
Expand Down
57 changes: 26 additions & 31 deletions BUILDING.md
Expand Up @@ -9,16 +9,25 @@ If you consistently can reproduce a test failure, search for it in the
file a new issue.


### Unix / Macintosh
### Unix / OS X

Prerequisites:

* `gcc` and `g++` 4.8 or newer, or
* `clang` and `clang++` 3.4 or newer
* Python 2.6 or 2.7
* GNU Make 3.81 or newer

On OS X, you will also need:
* [Xcode](https://developer.apple.com/xcode/download/)
* You also need to install the `Command Line Tools` via Xcode. You can find
this under the menu `Xcode -> Preferences -> Downloads`
* This step will install `gcc` and the related toolchain containing `make`

On FreeBSD and OpenBSD, you may also need:
* libexecinfo (FreeBSD and OpenBSD only)


```text
$ ./configure
$ make
Expand Down Expand Up @@ -108,29 +117,14 @@ $ make

### `Intl` (ECMA-402) support:

[Intl](https://github.com/nodejs/node/wiki/Intl) support is not
enabled by default.


#### "small" (English only) support

This option will build with "small" (English only) support, but
the full `Intl` (ECMA-402) APIs. With `--download=all` it will
download the ICU library as needed.

##### Unix / Macintosh:
[Intl](https://github.com/nodejs/node/wiki/Intl) support is
enabled by default, with English data only.

```text
$ ./configure --with-intl=small-icu --download=all
```

##### Windows:

```text
> vcbuild small-icu download-all
```
#### Default: `small-icu` (English only) support

The `small-icu` mode builds with English-only data. You can add full
By default, only English data is included, but
the full `Intl` (ECMA-402) APIs. It does not need to download
any dependencies to function. You can add full
data at runtime.

*Note:* more docs are on
Expand All @@ -139,9 +133,10 @@ data at runtime.
#### Build with full ICU support (all locales supported by ICU):

With the `--download=all`, this may download ICU if you don't have an
ICU in `deps/icu`.
ICU in `deps/icu`. (The embedded `small-icu` included in the default
Node.js source does not include all locales.)

##### Unix / Macintosh:
##### Unix / OS X:

```text
$ ./configure --with-intl=full-icu --download=all
Expand All @@ -155,22 +150,22 @@ $ ./configure --with-intl=full-icu --download=all

#### Building without Intl support

The `Intl` object will not be available. This is the default at
present, so this option is not normally needed.
The `Intl` object will not be available, nor some other APIs such as
`String.normalize`.

##### Unix / Macintosh:
##### Unix / OS X:

```text
$ ./configure --with-intl=none
$ ./configure --without-intl
```

##### Windows:

```text
> vcbuild intl-none
> vcbuild without-intl
```

#### Use existing installed ICU (Unix / Macintosh only):
#### Use existing installed ICU (Unix / OS X only):

```text
$ pkg-config --modversion icu-i18n && ./configure --with-intl=system-icu
Expand All @@ -186,7 +181,7 @@ You can find other ICU releases at
Download the file named something like `icu4c-**##.#**-src.tgz` (or
`.zip`).

##### Unix / Macintosh
##### Unix / OS X

```text
# from an already-unpacked ICU:
Expand Down
226 changes: 165 additions & 61 deletions CHANGELOG.md

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions Makefile
Expand Up @@ -114,10 +114,10 @@ v8:
tools/make-v8.sh v8
$(MAKE) -C deps/v8 $(V8_ARCH) $(V8_BUILD_OPTIONS)

test: | cctest # Depends on 'all'.
$(PYTHON) tools/test.py --mode=release message parallel sequential -J
$(MAKE) jslint
$(MAKE) cpplint
test: | build-addons cctest # Both targets depend on 'all'.
$(PYTHON) tools/test.py --mode=release -J \
addon doctool message parallel sequential
$(MAKE) lint

test-parallel: all
$(PYTHON) tools/test.py --mode=release parallel -J
Expand All @@ -141,7 +141,10 @@ ADDONS_BINDING_GYPS := \
$(wildcard test/addons/*/binding.gyp))

# Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale.
test/addons/.buildstamp: $(ADDONS_BINDING_GYPS) | test/addons/.docbuildstamp
test/addons/.buildstamp: $(ADDONS_BINDING_GYPS) \
deps/uv/include/*.h deps/v8/include/*.h \
src/node.h src/node_buffer.h src/node_object_wrap.h \
| test/addons/.docbuildstamp
# Cannot use $(wildcard test/addons/*/) here, it's evaluated before
# embedded addons have been generated from the documentation.
for dirname in test/addons/*/; do \
Expand Down Expand Up @@ -173,7 +176,7 @@ test-all-valgrind: test-build
test-ci: | build-addons
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=release --flaky-tests=$(FLAKY_TESTS) \
$(TEST_CI_ARGS) addons message parallel sequential
$(TEST_CI_ARGS) addons doctool message parallel sequential

test-release: test-build
$(PYTHON) tools/test.py --mode=release
Expand Down Expand Up @@ -455,6 +458,7 @@ $(TARBALL): release-only $(NODE_EXE) doc
rm -rf $(TARNAME)/.{editorconfig,git*,mailmap}
rm -rf $(TARNAME)/tools/{eslint,eslint-rules,osx-pkg.pmdoc,pkgsrc}
rm -rf $(TARNAME)/tools/{osx-*,license-builder.sh,cpplint.py}
rm -rf $(TARNAME)/test*.tap
find $(TARNAME)/ -name ".eslint*" -maxdepth 2 | xargs rm
find $(TARNAME)/ -type l | xargs rm # annoying on windows
tar -cf $(TARNAME).tar $(TARNAME)
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-c2s-cork.js
Expand Up @@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Writer.prototype.prependListener = function() {};

function server() {
var writer = new Writer();
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-c2s.js
Expand Up @@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Writer.prototype.prependListener = function() {};


function Reader() {
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-pipe.js
Expand Up @@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Writer.prototype.prependListener = function() {};


function Reader() {
Expand Down
1 change: 1 addition & 0 deletions benchmark/net/net-s2c.js
Expand Up @@ -62,6 +62,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Writer.prototype.prependListener = function() {};


function Reader() {
Expand Down
44 changes: 44 additions & 0 deletions benchmark/util/inspect-proxy.js
@@ -0,0 +1,44 @@
'use strict';

const util = require('util');
const common = require('../common.js');

const bench = common.createBenchmark(main, {
v: [1, 2],
n: [1e6]
});

function twoDifferentProxies(n) {
// This one should be slower between we're looking up multiple proxies.
const proxyA = new Proxy({}, {get: () => {}});
const proxyB = new Proxy({}, {get: () => {}});
bench.start();
for (var i = 0; i < n; i += 1)
util.inspect({a: proxyA, b: proxyB}, {showProxy: true});
bench.end(n);
}

function oneProxy(n) {
// This one should be a bit faster because of the internal caching.
const proxy = new Proxy({}, {get: () => {}});
bench.start();
for (var i = 0; i < n; i += 1)
util.inspect({a: proxy, b: proxy}, {showProxy: true});
bench.end(n);
}

function main(conf) {
const n = conf.n | 0;
const v = conf.v | 0;

switch (v) {
case 1:
oneProxy(n);
break;
case 2:
twoDifferentProxies(n);
break;
default:
throw new Error('Should not get to here');
}
}
7 changes: 6 additions & 1 deletion common.gypi
Expand Up @@ -363,7 +363,12 @@
},
'target_conditions': [
['_type!="static_library"', {
'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
'xcode_settings': {
'OTHER_LDFLAGS': [
'-Wl,-no_pie',
'-Wl,-search_paths_first',
],
},
}],
],
'conditions': [
Expand Down
62 changes: 49 additions & 13 deletions configure
Expand Up @@ -303,20 +303,28 @@ parser.add_option('--with-etw',
intl_optgroup.add_option('--with-intl',
action='store',
dest='with_intl',
default='none',
default='small-icu',
choices=valid_intl_modes,
help='Intl mode (valid choices: {0}) [default: %default]'.format(
', '.join(valid_intl_modes)))

intl_optgroup.add_option('--without-intl',
action='store_const',
dest='with_intl',
const='none',
help='Disable Intl, same as --with-intl=none')

intl_optgroup.add_option('--with-icu-path',
action='store',
dest='with_icu_path',
help='Path to icu.gyp (ICU i18n, Chromium version only.)')

icu_default_locales='root,en'

intl_optgroup.add_option('--with-icu-locales',
action='store',
dest='with_icu_locales',
default='root,en',
default=icu_default_locales,
help='Comma-separated list of locales for "small-icu". "root" is assumed. '
'[default: %default]')

Expand Down Expand Up @@ -889,7 +897,7 @@ do_not_edit = '# Do not edit. Generated by the configure script.\n'

def glob_to_var(dir_base, dir_sub, patch_dir):
list = []
dir_all = os.path.join(dir_base, dir_sub)
dir_all = '%s/%s' % (dir_base, dir_sub)
files = os.walk(dir_all)
for ent in files:
(path, dirs, files) = ent
Expand All @@ -909,8 +917,8 @@ def glob_to_var(dir_base, dir_sub, patch_dir):
def configure_intl(o):
icus = [
{
'url': 'https://ssl.icu-project.org/files/icu4c/56.1/icu4c-56_1-src.zip',
'md5': '61d71888f14bf00cc3e8a6f2c087d367',
'url': 'https://ssl.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.zip',
'md5': 'f797503ecaebf1d38920013dc7893066',
},
]
def icu_download(path):
Expand Down Expand Up @@ -977,6 +985,7 @@ def configure_intl(o):
locs = set(options.with_icu_locales.split(','))
locs.add('root') # must have root
o['variables']['icu_locales'] = string.join(locs,',')
# We will check a bit later if we can use the canned deps/icu-small
elif with_intl == 'full-icu':
# full ICU
o['variables']['v8_enable_i18n_support'] = 1
Expand All @@ -1003,15 +1012,42 @@ def configure_intl(o):
# this is just the 'deps' dir. Used for unpacking.
icu_parent_path = os.path.join(root_dir, 'deps')

# The full path to the ICU source directory.
icu_full_path = os.path.join(icu_parent_path, 'icu')
# The full path to the ICU source directory. Should not include './'.
icu_full_path = 'deps/icu'

# icu-tmp is used to download and unpack the ICU tarball.
icu_tmp_path = os.path.join(icu_parent_path, 'icu-tmp')

# canned ICU. see tools/icu/README.md to update.
canned_icu_dir = 'deps/icu-small'

# We can use 'deps/icu-small' - pre-canned ICU *iff*
# - with_intl == small-icu (the default!)
# - with_icu_locales == 'root,en' (the default!)
# - deps/icu-small exists!
# - with_icu_source is unset (i.e. no other ICU was specified)
# (Note that this is the *DEFAULT CASE*.)
#
# This is *roughly* equivalent to
# $ configure --with-intl=small-icu --with-icu-source=deps/icu-small
# .. Except that we avoid copying icu-small over to deps/icu.
# In this default case, deps/icu is ignored, although make clean will
# still harmlessly remove deps/icu.

# are we using default locales?
using_default_locales = ( options.with_icu_locales == icu_default_locales )

# make sure the canned ICU really exists
canned_icu_available = os.path.isdir(canned_icu_dir)

if (o['variables']['icu_small'] == b(True)) and using_default_locales and (not with_icu_source) and canned_icu_available:
# OK- we can use the canned ICU.
icu_config['variables']['icu_small_canned'] = 1
icu_full_path = canned_icu_dir

# --with-icu-source processing
# first, check that they didn't pass --with-icu-source=deps/icu
if with_icu_source and os.path.abspath(icu_full_path) == os.path.abspath(with_icu_source):
# now, check that they didn't pass --with-icu-source=deps/icu
elif with_icu_source and os.path.abspath(icu_full_path) == os.path.abspath(with_icu_source):
print 'Ignoring redundant --with-icu-source=%s' % (with_icu_source)
with_icu_source = None
# if with_icu_source is still set, try to use it.
Expand Down Expand Up @@ -1052,7 +1088,7 @@ def configure_intl(o):

# ICU mode. (icu-generic.gyp)
o['variables']['icu_gyp_path'] = 'tools/icu/icu-generic.gyp'
# ICU source dir relative to root
# ICU source dir relative to tools/icu (for .gyp file)
o['variables']['icu_path'] = icu_full_path
if not os.path.isdir(icu_full_path):
print '* ECMA-402 (Intl) support didn\'t find ICU in %s..' % (icu_full_path)
Expand Down Expand Up @@ -1092,14 +1128,14 @@ def configure_intl(o):
'source/data/in',
icu_data_file_l)
# relative to dep..
icu_data_in = os.path.join('../../deps/icu/source/data/in', icu_data_file_l)
icu_data_in = os.path.join('..','..', icu_full_path, 'source/data/in', icu_data_file_l)
if not os.path.isfile(icu_data_path) and icu_endianness != 'l':
# use host endianness
icu_data_path = os.path.join(icu_full_path,
'source/data/in',
icu_data_file)
# relative to dep..
icu_data_in = os.path.join('icu/source/data/in',
icu_data_in = os.path.join('..', icu_full_path, 'source/data/in',
icu_data_file)
# this is the input '.dat' file to use .. icudt*.dat
# may be little-endian if from a icu-project.org tarball
Expand All @@ -1126,7 +1162,7 @@ def configure_intl(o):
# with a list of the src files to use
for i in icu_src:
var = 'icu_src_%s' % i
path = '../../deps/icu/source/%s' % icu_src[i]
path = '../../%s/source/%s' % (icu_full_path, icu_src[i])
icu_config['variables'][var] = glob_to_var('tools/icu', path, 'patches/%s/source/%s' % (icu_ver_major, icu_src[i]) )
# write updated icu_config.gypi with a bunch of paths
write(icu_config_name, do_not_edit +
Expand Down

0 comments on commit ca75446

Please sign in to comment.