| Index: src/compiler/js-create-lowering.cc
|
| diff --git a/src/compiler/js-create-lowering.cc b/src/compiler/js-create-lowering.cc
|
| index f2c5edd630831aeb1c5e6dacd6baab9c29329f21..21997f7d5822fa84f082e9a02beb6e1776230a07 100644
|
| --- a/src/compiler/js-create-lowering.cc
|
| +++ b/src/compiler/js-create-lowering.cc
|
| @@ -1013,10 +1013,17 @@ Node* JSCreateLowering::AllocateElements(Node* effect, Node* control,
|
| ElementAccess access = IsFastDoubleElementsKind(elements_kind)
|
| ? AccessBuilder::ForFixedDoubleArrayElement()
|
| : AccessBuilder::ForFixedArrayElement();
|
| - Node* value =
|
| - IsFastDoubleElementsKind(elements_kind)
|
| - ? jsgraph()->Float64Constant(bit_cast<double>(kHoleNanInt64))
|
| - : jsgraph()->TheHoleConstant();
|
| + Node* value;
|
| + if (IsFastDoubleElementsKind(elements_kind)) {
|
| + // Load the hole NaN pattern from the canonical location.
|
| + value = effect = graph()->NewNode(
|
| + simplified()->LoadField(AccessBuilder::ForExternalDoubleValue()),
|
| + jsgraph()->ExternalConstant(
|
| + ExternalReference::address_of_the_hole_nan()),
|
| + effect, control);
|
| + } else {
|
| + value = jsgraph()->TheHoleConstant();
|
| + }
|
|
|
| // Actually allocate the backing store.
|
| AllocationBuilder a(jsgraph(), effect, control);
|
| @@ -1169,18 +1176,18 @@ Node* JSCreateLowering::AllocateFastLiteralElements(
|
| if (elements_map->instance_type() == FIXED_DOUBLE_ARRAY_TYPE) {
|
| Handle<FixedDoubleArray> elements =
|
| Handle<FixedDoubleArray>::cast(boilerplate_elements);
|
| + Node* the_hole_value = nullptr;
|
| for (int i = 0; i < elements_length; ++i) {
|
| if (elements->is_the_hole(i)) {
|
| - // TODO(turbofan): We cannot currently safely pass thru the (signaling)
|
| - // hole NaN in C++ code, as the C++ compiler on Intel might use FPU
|
| - // instructions/registers for doubles and therefore make the NaN quiet.
|
| - // We should consider passing doubles in the compiler as raw int64
|
| - // values to prevent this.
|
| - elements_values[i] = effect =
|
| - graph()->NewNode(simplified()->LoadElement(
|
| - AccessBuilder::ForFixedDoubleArrayElement()),
|
| - jsgraph()->HeapConstant(elements),
|
| - jsgraph()->Constant(i), effect, control);
|
| + if (the_hole_value == nullptr) {
|
| + // Load the hole NaN pattern from the canonical location.
|
| + the_hole_value = effect = graph()->NewNode(
|
| + simplified()->LoadField(AccessBuilder::ForExternalDoubleValue()),
|
| + jsgraph()->ExternalConstant(
|
| + ExternalReference::address_of_the_hole_nan()),
|
| + effect, control);
|
| + }
|
| + elements_values[i] = the_hole_value;
|
| } else {
|
| elements_values[i] = jsgraph()->Constant(elements->get_scalar(i));
|
| }
|
|
|