v8/test/mjsunit/regress/regress-5332.js
bmeurer 64a7bd3877 [turbofan] Don't treat the hole NaN as constant inside the compiler.
We use a signaling NaN to represent the hole in
FAST_HOLEY_DOUBLE_ELEMENTS backing stores, but on Intel processors, the
C++ compiler may decide to (or be forced to due to calling conventions)
use X87 registers for double values. However transfering to X87
registers automatically quietens the NaNs and there's no way to disable
this. Therefore we should just always load the hole NaN from the canonical
place identified by the address_of_hole_nan external reference instead,
which might even be more efficient in some cases.

R=jarin@chromium.org, jkummerow@chromium.org
BUG=v8:5332

Review-Url: https://codereview.chromium.org/2303643002
Cr-Commit-Position: refs/heads/master@{#39062}
2016-09-01 06:02:19 +00:00

32 lines
693 B
JavaScript

// Copyright 2016 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() {
function foo() {
var a = new Array(2);
a[1] = 1.5;
return a;
}
assertEquals(undefined, foo()[0]);
assertEquals(undefined, foo()[0]);
%OptimizeFunctionOnNextCall(foo);
assertEquals(undefined, foo()[0]);
})();
(function() {
function foo() {
var a = Array(2);
a[1] = 1.5;
return a;
}
assertEquals(undefined, foo()[0]);
assertEquals(undefined, foo()[0]);
%OptimizeFunctionOnNextCall(foo);
assertEquals(undefined, foo()[0]);
})();