Large diffs are not rendered by default.

@@ -0,0 +1,22 @@
// Copyright 2014 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: --allow-natives-syntax --gc-interval=439 --random-seed=-423594851

var __v_3;
function __f_2() {
var __v_1 = new Array(3);
__v_1[0] = 10;
__v_1[1] = 15.5;
__v_3 = __f_2();
__v_1[2] = 20;
return __v_1;
}

try {
for (var __v_2 = 0; __v_2 < 3; ++__v_2) {
__v_3 = __f_2();
}
}
catch (e) { }
@@ -0,0 +1,18 @@
// Copyright 2014 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.

Array.prototype[0] = 777;
var kElements = 10;

var input_array = [];
for (var i = 1; i < kElements; i++) {
input_array[i] = 0.5;
}
var output_array = input_array.concat(0.5);

assertEquals(kElements + 1, output_array.length);
assertEquals(777, output_array[0]);
for (var j = 1; j < kElements; j++) {
assertEquals(0.5, output_array[j]);
}
@@ -0,0 +1,12 @@
// Copyright 2014 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: --allow-natives-syntax

function f(n) { return [0].indexOf((n - n) + 0); }

assertEquals(0, f(.1));
assertEquals(0, f(.1));
%OptimizeFunctionOnNextCall(f);
assertEquals(0, f(.1));
@@ -0,0 +1,10 @@
// Copyright 2014 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: --allow-natives-syntax

var json = '{"a":{"c":2.1,"d":0},"b":{"c":7,"1024":8}}';
var data = JSON.parse(json);

data.b.c++;
@@ -0,0 +1,18 @@
// Copyright 2014 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: --allow-natives-syntax

// Test push double as tagged.
var a = [{}];
function f(a) {
a.push(Infinity);
}

f(a);
f(a);
f(a);
%OptimizeFunctionOnNextCall(f);
f(a);
assertEquals([{}, Infinity, Infinity, Infinity, Infinity], a);
@@ -0,0 +1,6 @@
// Copyright 2014 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.

var o = JSON.parse('{"\\u0030":100}');
assertEquals(100, o[0]);
@@ -0,0 +1,14 @@
// Copyright 2014 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.

var a = [];
a[10000] = 1;
a.length = 0;
a[1] = 1;
a.length = 0;
assertEquals(undefined, a[1]);

var o = {};
Object.freeze(o);
assertEquals(undefined, o[1]);

This file was deleted.

Large diffs are not rendered by default.

@@ -0,0 +1,11 @@
shared-library,"shell",0x08048000,0x081ee000
shared-library,"/lib32/libm-2.7.so",0xf7db6000,0xf7dd9000
shared-library,"ffffe000-fffff000",0xffffe000,0xfffff000
profiler,"begin",1
code-creation,Stub,0,0x424260,348,"CompareStub_GE"
code-creation,LazyCompile,0,0x2a8100,18535,"DrawQube 3d-cube.js:188",0xf43abcac,
code-creation,LazyCompile,0,0x480100,3908,"DrawLine 3d-cube.js:17",0xf43abc50,
tick,0x424284,0,0,0x480600,0,0x2aaaa5
tick,0x42429f,0,0,0x480600,0,0x2aacb4
tick,0x48063d,0,0,0x2d0f7c,0,0x2aaec6
profiler,"end"
@@ -0,0 +1,25 @@
shared-library,"shell",0x08048000,0x081ee000
shared-library,"/lib32/libm-2.7.so",0xf7db6000,0xf7dd9000
shared-library,"ffffe000-fffff000",0xffffe000,0xfffff000
profiler,"begin",1
code-creation,Stub,0,0xf540a100,474,"CEntryStub"
code-creation,Script,0,0xf541cd80,736,"exp.js"
code-creation,Stub,0,0xf541d0e0,47,"RuntimeStub_Math_exp"
code-creation,LazyCompile,0,0xf541d120,145,"exp native math.js:41"
function-creation,0xf441d280,0xf541d120
code-creation,LoadIC,0,0xf541d280,117,"j"
code-creation,LoadIC,0,0xf541d360,63,"i"
tick,0x80f82d1,0,0,0,0,0xf541ce5c
tick,0x80f89a1,0,0,0,0,0xf541ce5c
tick,0x8123b5c,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0x8123b65,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf541d2be,0,0,0,0
tick,0xf541d320,0,0,0,0
tick,0xf541d384,0,0,0,0
tick,0xf7db94da,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7db951c,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7dbc508,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7dbff21,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7edec90,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xffffe402,0,0,0,0
profiler,"end"
@@ -68,7 +68,7 @@ PASS getSortedOwnPropertyNames(Object.prototype) is ['__defineGetter__', '__defi
PASS getSortedOwnPropertyNames(Function) is ['arguments', 'caller', 'length', 'name', 'prototype']
PASS getSortedOwnPropertyNames(Function.prototype) is ['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString']
PASS getSortedOwnPropertyNames(Array) is ['arguments', 'caller', 'isArray', 'length', 'name', 'observe', 'prototype', 'unobserve']
PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'entries', 'every', 'filter', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']
PASS getSortedOwnPropertyNames(Array.prototype) is ['concat', 'constructor', 'entries', 'every', 'filter', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']
PASS getSortedOwnPropertyNames(String) is ['arguments', 'caller', 'fromCharCode', 'length', 'name', 'prototype']
PASS getSortedOwnPropertyNames(String.prototype) is ['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'normalize', 'replace', 'search', 'slice', 'small', 'split', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf']
PASS getSortedOwnPropertyNames(Boolean) is ['arguments', 'caller', 'length', 'name', 'prototype']
@@ -76,7 +76,7 @@ var expectedPropertyNamesSet = {
"Function": "['arguments', 'caller', 'length', 'name', 'prototype']",
"Function.prototype": "['apply', 'arguments', 'bind', 'call', 'caller', 'constructor', 'length', 'name', 'toString']",
"Array": "['arguments', 'caller', 'isArray', 'length', 'name', 'observe', 'prototype', 'unobserve']",
"Array.prototype": "['concat', 'constructor', 'entries', 'every', 'filter', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift', 'values']",
"Array.prototype": "['concat', 'constructor', 'entries', 'every', 'filter', 'forEach', 'indexOf', 'join', 'keys', 'lastIndexOf', 'length', 'map', 'pop', 'push', 'reduce', 'reduceRight', 'reverse', 'shift', 'slice', 'some', 'sort', 'splice', 'toLocaleString', 'toString', 'unshift']",
"String": "['arguments', 'caller', 'fromCharCode', 'length', 'name', 'prototype']",
"String.prototype": "['anchor', 'big', 'blink', 'bold', 'charAt', 'charCodeAt', 'concat', 'constructor', 'fixed', 'fontcolor', 'fontsize', 'indexOf', 'italics', 'lastIndexOf', 'length', 'link', 'localeCompare', 'match', 'normalize', 'replace', 'search', 'slice', 'small', 'split', 'strike', 'sub', 'substr', 'substring', 'sup', 'toLocaleLowerCase', 'toLocaleUpperCase', 'toLowerCase', 'toString', 'toUpperCase', 'trim', 'trimLeft', 'trimRight', 'valueOf']",
"Boolean": "['arguments', 'caller', 'length', 'name', 'prototype']",
@@ -50,6 +50,9 @@
['simulator', {
'function-apply-aliased': [SKIP],
}], # 'simulator'
['arch == arm and simulator_run == True', {
'dfg-int-overflow-in-loop': [SKIP],
}], # 'arch == arm and simulator_run == True'
['arch == arm64 and simulator_run == True', {
'dfg-int-overflow-in-loop': [SKIP],
}], # 'arch == arm64 and simulator_run == True'

This file was deleted.

@@ -37,7 +37,6 @@
'gtest/src/gtest-test-part.cc',
'gtest/src/gtest-typed-test.cc',
'gtest/src/gtest.cc',
'gtest-type-names.h',
],
'sources!': [
'gtest/src/gtest-all.cc', # Not needed by our build.
@@ -26,7 +26,7 @@ namespace fdlibm {
inline double scalbn(double x, int y) { return _scalb(x, y); }
#endif // _MSC_VER

const double MathConstants::constants[] = {
const double TrigonometricConstants::constants[] = {
6.36619772367581382433e-01, // invpio2 0
1.57079632673412561417e+00, // pio2_1 1
6.07710050650619224932e-11, // pio2_1t 2
@@ -61,17 +61,6 @@ const double MathConstants::constants[] = {
2.59073051863633712884e-05, // T12 31
7.85398163397448278999e-01, // pio4 32
3.06161699786838301793e-17, // pio4lo 33
6.93147180369123816490e-01, // ln2_hi 34
1.90821492927058770002e-10, // ln2_lo 35
1.80143985094819840000e+16, // 2^54 36
6.666666666666666666e-01, // 2/3 37
6.666666666666735130e-01, // LP1 38
3.999999999940941908e-01, // 39
2.857142874366239149e-01, // 40
2.222219843214978396e-01, // 41
1.818357216161805012e-01, // 42
1.531383769920937332e-01, // 43
1.479819860511658591e-01, // LP7 44
};


@@ -22,8 +22,8 @@ namespace fdlibm {
int rempio2(double x, double* y);

// Constants to be exposed to builtins via Float64Array.
struct MathConstants {
static const double constants[45];
struct TrigonometricConstants {
static const double constants[34];
};
}
} // namespace v8::internal
@@ -13,21 +13,21 @@
// modified significantly by Google Inc.
// Copyright 2014 the V8 project authors. All rights reserved.
//
// The following is a straightforward translation of fdlibm routines
// by Raymond Toy (rtoy@google.com).
// The following is a straightforward translation of fdlibm routines for
// sin, cos, and tan, by Raymond Toy (rtoy@google.com).


var kMath; // Initialized to a Float64Array during genesis and is not writable.
var kTrig; // Initialized to a Float64Array during genesis and is not writable.

const INVPIO2 = kMath[0];
const PIO2_1 = kMath[1];
const PIO2_1T = kMath[2];
const PIO2_2 = kMath[3];
const PIO2_2T = kMath[4];
const PIO2_3 = kMath[5];
const PIO2_3T = kMath[6];
const PIO4 = kMath[32];
const PIO4LO = kMath[33];
const INVPIO2 = kTrig[0];
const PIO2_1 = kTrig[1];
const PIO2_1T = kTrig[2];
const PIO2_2 = kTrig[3];
const PIO2_2T = kTrig[4];
const PIO2_3 = kTrig[5];
const PIO2_3T = kTrig[6];
const PIO4 = kTrig[32];
const PIO4LO = kTrig[33];

// Compute k and r such that x - k*pi/2 = r where |r| < pi/4. For
// precision, r is returned as two values y0 and y1 such that r = y0 + y1
@@ -133,7 +133,7 @@ endmacro
// sin(x) = X + (S1*X + (X *(r-Y/2)+Y))
//
macro KSIN(x)
kMath[7+x]
kTrig[7+x]
endmacro

macro RETURN_KERNELSIN(X, Y, SIGN)
@@ -177,7 +177,7 @@ endmacro
// thus, reducing the rounding error in the subtraction.
//
macro KCOS(x)
kMath[13+x]
kTrig[13+x]
endmacro

macro RETURN_KERNELCOS(X, Y, SIGN)
@@ -199,7 +199,6 @@ macro RETURN_KERNELCOS(X, Y, SIGN)
}
endmacro


// kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
// Input x is assumed to be bounded by ~pi/4 in magnitude.
// Input y is the tail of x.
@@ -236,7 +235,7 @@ endmacro
// and will cause incorrect results.
//
macro KTAN(x)
kMath[19+x]
kTrig[19+x]
endmacro

function KernelTan(x, y, returnTan) {
@@ -355,164 +354,3 @@ function MathTan(x) {
REMPIO2(x);
return KernelTan(y0, y1, (n & 1) ? -1 : 1);
}

// ES6 draft 09-27-13, section 20.2.2.20.
// Math.log1p
//
// Method :
// 1. Argument Reduction: find k and f such that
// 1+x = 2^k * (1+f),
// where sqrt(2)/2 < 1+f < sqrt(2) .
//
// Note. If k=0, then f=x is exact. However, if k!=0, then f
// may not be representable exactly. In that case, a correction
// term is need. Let u=1+x rounded. Let c = (1+x)-u, then
// log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u),
// and add back the correction term c/u.
// (Note: when x > 2**53, one can simply return log(x))
//
// 2. Approximation of log1p(f).
// Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
// = 2s + 2/3 s**3 + 2/5 s**5 + .....,
// = 2s + s*R
// We use a special Reme algorithm on [0,0.1716] to generate
// a polynomial of degree 14 to approximate R The maximum error
// of this polynomial approximation is bounded by 2**-58.45. In
// other words,
// 2 4 6 8 10 12 14
// R(z) ~ Lp1*s +Lp2*s +Lp3*s +Lp4*s +Lp5*s +Lp6*s +Lp7*s
// (the values of Lp1 to Lp7 are listed in the program)
// and
// | 2 14 | -58.45
// | Lp1*s +...+Lp7*s - R(z) | <= 2
// | |
// Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.
// In order to guarantee error in log below 1ulp, we compute log
// by
// log1p(f) = f - (hfsq - s*(hfsq+R)).
//
// 3. Finally, log1p(x) = k*ln2 + log1p(f).
// = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))
// Here ln2 is split into two floating point number:
// ln2_hi + ln2_lo,
// where n*ln2_hi is always exact for |n| < 2000.
//
// Special cases:
// log1p(x) is NaN with signal if x < -1 (including -INF) ;
// log1p(+INF) is +INF; log1p(-1) is -INF with signal;
// log1p(NaN) is that NaN with no signal.
//
// Accuracy:
// according to an error analysis, the error is always less than
// 1 ulp (unit in the last place).
//
// Constants:
// The hexadecimal values are the intended ones for the following
// constants. The decimal values may be used, provided that the
// compiler will convert from decimal to binary accurately enough
// to produce the hexadecimal values shown.
//
// Note: Assuming log() return accurate answer, the following
// algorithm can be used to compute log1p(x) to within a few ULP:
//
// u = 1+x;
// if (u==1.0) return x ; else
// return log(u)*(x/(u-1.0));
//
// See HP-15C Advanced Functions Handbook, p.193.
//
const LN2_HI = kMath[34];
const LN2_LO = kMath[35];
const TWO54 = kMath[36];
const TWO_THIRD = kMath[37];
macro KLOGP1(x)
(kMath[38+x])
endmacro

function MathLog1p(x) {
x = x * 1; // Convert to number.
var hx = %_DoubleHi(x);
var ax = hx & 0x7fffffff;
var k = 1;
var f = x;
var hu = 1;
var c = 0;
var u = x;

if (hx < 0x3fda827a) {
// x < 0.41422
if (ax >= 0x3ff00000) { // |x| >= 1
if (x === -1) {
return -INFINITY; // log1p(-1) = -inf
} else {
return NAN; // log1p(x<-1) = NaN
}
} else if (ax < 0x3c900000) {
// For |x| < 2^-54 we can return x.
return x;
} else if (ax < 0x3e200000) {
// For |x| < 2^-29 we can use a simple two-term Taylor series.
return x - x * x * 0.5;
}

if ((hx > 0) || (hx <= -0x402D413D)) { // (int) 0xbfd2bec3 = -0x402d413d
// -.2929 < x < 0.41422
k = 0;
}
}

// Handle Infinity and NAN
if (hx >= 0x7ff00000) return x;

if (k !== 0) {
if (hx < 0x43400000) {
// x < 2^53
u = 1 + x;
hu = %_DoubleHi(u);
k = (hu >> 20) - 1023;
c = (k > 0) ? 1 - (u - x) : x - (u - 1);
c = c / u;
} else {
hu = %_DoubleHi(u);
k = (hu >> 20) - 1023;
}
hu = hu & 0xfffff;
if (hu < 0x6a09e) {
u = %_ConstructDouble(hu | 0x3ff00000, %_DoubleLo(u)); // Normalize u.
} else {
++k;
u = %_ConstructDouble(hu | 0x3fe00000, %_DoubleLo(u)); // Normalize u/2.
hu = (0x00100000 - hu) >> 2;
}
f = u - 1;
}

var hfsq = 0.5 * f * f;
if (hu === 0) {
// |f| < 2^-20;
if (f === 0) {
if (k === 0) {
return 0.0;
} else {
return k * LN2_HI + (c + k * LN2_LO);
}
}
var R = hfsq * (1 - TWO_THIRD * f);
if (k === 0) {
return f - R;
} else {
return k * LN2_HI - ((R - (k * LN2_LO + c)) - f);
}
}

var s = f / (2 + f);
var z = s * s;
var R = z * (KLOGP1(0) + z * (KLOGP1(1) + z *
(KLOGP1(2) + z * (KLOGP1(3) + z *
(KLOGP1(4) + z * (KLOGP1(5) + z * KLOGP1(6)))))));
if (k === 0) {
return f - (hfsq - s * (hfsq + R));
} else {
return k * LN2_HI - ((hfsq - (s * (hfsq + R) + (k * LN2_LO + c))) - f);
}
}
@@ -47,11 +47,11 @@
# that the parser doesn't bit-rot. Change the values as needed when you add,
# remove or change runtime functions, but make sure we don't lose our ability
# to parse them!
EXPECTED_FUNCTION_COUNT = 429
EXPECTED_FUZZABLE_COUNT = 332
EXPECTED_FUNCTION_COUNT = 428
EXPECTED_FUZZABLE_COUNT = 331
EXPECTED_CCTEST_COUNT = 7
EXPECTED_UNKNOWN_COUNT = 16
EXPECTED_BUILTINS_COUNT = 808
EXPECTED_BUILTINS_COUNT = 809


# Don't call these at all.
@@ -226,7 +226,6 @@
"CreateBreakIterator": ["'en-US'", "{type: 'string'}", None, None],
"CreateJSFunctionProxy": [None, "function() {}", None, None, None],
"CreatePrivateSymbol": ["\"foo\"", None],
"CreatePrivateOwnSymbol": ["\"foo\"", None],
"CreateSymbol": ["\"foo\"", None],
"DateParseString": [None, "new Array(8)", None],
"DefineAccessorPropertyUnchecked": [None, None, "function() {}",
@@ -344,8 +344,6 @@
'../../src/compilation-cache.h',
'../../src/compiler/ast-graph-builder.cc',
'../../src/compiler/ast-graph-builder.h',
'../../src/compiler/change-lowering.cc',
'../../src/compiler/change-lowering.h',
'../../src/compiler/code-generator-impl.h',
'../../src/compiler/code-generator.cc',
'../../src/compiler/code-generator.h',
@@ -1250,7 +1248,7 @@
['OS=="solaris"', {
'link_settings': {
'libraries': [
'-lnsl -lrt',
'-lnsl',
]},
'sources': [
'../../src/base/platform/platform-solaris.cc',
@@ -28,6 +28,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


from collections import OrderedDict
import itertools
import multiprocessing
import optparse
@@ -52,6 +53,31 @@
ARCH_GUESS = utils.DefaultArch()
DEFAULT_TESTS = ["mjsunit", "fuzz-natives", "base-unittests",
"cctest", "compiler-unittests", "message", "preparser"]

# Map of test name synonyms to lists of test suites. Should be ordered by
# expected runtimes (suites with slow test cases first). These groups are
# invoked in seperate steps on the bots.
TEST_MAP = {
"default": [
"mjsunit",
"fuzz-natives",
"cctest",
"message",
"preparser",
],
"optimize_for_size": [
"mjsunit",
"cctest",
"webkit",
],
"unittests": [
"compiler-unittests",
"heap-unittests",
"base-unittests",
"libplatform-unittests",
],
}

TIMEOUT_DEFAULT = 60
TIMEOUT_SCALEFACTOR = {"debug" : 4,
"release" : 1 }
@@ -377,14 +403,23 @@ def Main():

suite_paths = utils.GetSuitePaths(join(workspace, "test"))

# Expand arguments with grouped tests. The args should reflect the list of
# suites as otherwise filters would break.
def ExpandTestGroups(name):
if name in TEST_MAP:
return [suite for suite in TEST_MAP[arg]]
else:
return [name]
args = reduce(lambda x, y: x + y,
[ExpandTestGroups(arg) for arg in args],
[])

if len(args) == 0:
suite_paths = [ s for s in DEFAULT_TESTS if s in suite_paths ]
else:
args_suites = set()
args_suites = OrderedDict() # Used as set
for arg in args:
suite = arg.split(os.path.sep)[0]
if not suite in args_suites:
args_suites.add(suite)
args_suites[arg.split(os.path.sep)[0]] = True
suite_paths = [ s for s in args_suites if s in suite_paths ]

suites = []
@@ -0,0 +1,11 @@
The Xcode project for V8 has been retired. If an Xcode project
is needed for building on a Mac there is the option of using GYP to
generate it. Please look in the build directory in the root of the
V8 project. It contains the required infrastructure and a README.txt
file explaining how to get started.

Generating Xcode projects using GYP is how the Chromium
project integrated V8 into the Mac build.

The main build system for V8 is still SCons, see
http://code.google.com/apis/v8/build.html for details.
@@ -5,4 +5,4 @@ Try to write something funny. And please don't add trailing whitespace.
A Smi walks into a bar and says:
"I'm so deoptimized today!"
The doubles heard this and started to unbox.
The Smi looked at them and......................
The Smi looked at them and....................
@@ -259,8 +259,9 @@ The following flags can be passed as hints to `dns.lookup`.
of addresses supported by the current system. For example, IPv4 addresses
are only returned if the current system has at least one IPv4 address
configured. Loopback addresses are not considered.
- `dns.V4MAPPED`: If the IPv6 family was specified, but no IPv6 addresses
were found, then return IPv4 mapped IPv6 addresses.
- `dns.V4MAPPED`: If the IPv6 family was specified, but no IPv6 addresses were
found, then return IPv4 mapped IPv6 addresses. Note that it is not supported
on some operating systems (e.g FreeBSD 10.1).

## Implementation considerations

@@ -917,8 +917,18 @@ Socket.prototype.connect = function(options, cb) {
throw new RangeError('port should be >= 0 and < 65536: ' +
options.port);

if (dnsopts.family !== 4 && dnsopts.family !== 6)
dnsopts.hints = dns.ADDRCONFIG | dns.V4MAPPED;
if (dnsopts.family !== 4 && dnsopts.family !== 6) {
dnsopts.hints = dns.ADDRCONFIG;
// The AI_V4MAPPED hint is not supported on FreeBSD, and getaddrinfo
// returns EAI_BADFLAGS. However, it seems to be supported on most other
// systems. See
// http://lists.freebsd.org/pipermail/freebsd-bugs/2008-February/028260.html
// and
// https://svnweb.freebsd.org/base/head/lib/libc/net/getaddrinfo.c?r1=172052&r2=175955
// for more information on the lack of support for FreeBSD.
if (process.platform !== 'freebsd')
dnsopts.hints |= dns.V4MAPPED;
}

debug('connect: find host ' + host);
debug('connect: dns options ' + dnsopts);
@@ -0,0 +1,38 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

/*
* This is a regression test for the issue described at:
* https://github.com/joyent/node/issues/9113.
*
* This problem has been fixed by floating a patch on V8, this test makes
* sure that the appropriate patch is floated even after future V8 upgrades.
*
* If the bug is reproduced, this test stalls and the tests suite makes it
* time out eventually (currently after one minute). Otherwise it exits after
* the for loop completes its execution.
*/
var spawn = require('child_process').spawn;
var args = ['--harmony',
'--use-strict',
'-e',
'for (let i = 0; i < 3; ++i) { if (i == 1) { continue; } }'];
var child = spawn(process.execPath, args);