| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
| 6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
| 7 #include "src/compiler/js-operator.h" | 7 #include "src/compiler/js-operator.h" |
| 8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" |
| 9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
| 10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 Node* input = Parameter(Type::Boolean(), 0); | 112 Node* input = Parameter(Type::Boolean(), 0); |
| 113 Node* context = Parameter(Type::Any(), 1); | 113 Node* context = Parameter(Type::Any(), 1); |
| 114 Reduction r = | 114 Reduction r = |
| 115 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); | 115 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); |
| 116 ASSERT_TRUE(r.Changed()); | 116 ASSERT_TRUE(r.Changed()); |
| 117 EXPECT_THAT(r.replacement(), IsBooleanNot(input)); | 117 EXPECT_THAT(r.replacement(), IsBooleanNot(input)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| 121 TEST_F(JSTypedLoweringTest, JSUnaryNotWithFalsish) { | 121 TEST_F(JSTypedLoweringTest, JSUnaryNotWithFalsish) { |
| 122 Handle<Object> zero = factory()->NewNumber(0); | |
| 123 Node* input = Parameter( | 122 Node* input = Parameter( |
| 124 Type::Union( | 123 Type::Union( |
| 125 Type::MinusZero(), | 124 Type::MinusZero(), |
| 126 Type::Union( | 125 Type::Union( |
| 127 Type::NaN(), | 126 Type::NaN(), |
| 128 Type::Union( | 127 Type::Union( |
| 129 Type::Null(), | 128 Type::Null(), |
| 130 Type::Union( | 129 Type::Union( |
| 131 Type::Undefined(), | 130 Type::Undefined(), |
| 132 Type::Union( | 131 Type::Union( |
| 133 Type::Undetectable(), | 132 Type::Undetectable(), |
| 134 Type::Union( | 133 Type::Union( |
| 135 Type::Constant(factory()->false_value(), zone()), | 134 Type::Constant(factory()->false_value(), zone()), |
| 136 Type::Range(zero, zero, zone()), zone()), | 135 Type::Range(0.0, 0.0, zone()), zone()), |
| 137 zone()), | 136 zone()), |
| 138 zone()), | 137 zone()), |
| 139 zone()), | 138 zone()), |
| 140 zone()), | 139 zone()), |
| 141 zone()), | 140 zone()), |
| 142 0); | 141 0); |
| 143 Node* context = Parameter(Type::Any(), 1); | 142 Node* context = Parameter(Type::Any(), 1); |
| 144 Reduction r = | 143 Reduction r = |
| 145 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); | 144 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); |
| 146 ASSERT_TRUE(r.Changed()); | 145 ASSERT_TRUE(r.Changed()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 157 0); | 156 0); |
| 158 Node* context = Parameter(Type::Any(), 1); | 157 Node* context = Parameter(Type::Any(), 1); |
| 159 Reduction r = | 158 Reduction r = |
| 160 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); | 159 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); |
| 161 ASSERT_TRUE(r.Changed()); | 160 ASSERT_TRUE(r.Changed()); |
| 162 EXPECT_THAT(r.replacement(), IsFalseConstant()); | 161 EXPECT_THAT(r.replacement(), IsFalseConstant()); |
| 163 } | 162 } |
| 164 | 163 |
| 165 | 164 |
| 166 TEST_F(JSTypedLoweringTest, JSUnaryNotWithNonZeroPlainNumber) { | 165 TEST_F(JSTypedLoweringTest, JSUnaryNotWithNonZeroPlainNumber) { |
| 167 Node* input = Parameter( | 166 Node* input = Parameter(Type::Range(1.0, 42.0, zone()), 0); |
| 168 Type::Range(factory()->NewNumber(1), factory()->NewNumber(42), zone()), | |
| 169 0); | |
| 170 Node* context = Parameter(Type::Any(), 1); | 167 Node* context = Parameter(Type::Any(), 1); |
| 171 Reduction r = | 168 Reduction r = |
| 172 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); | 169 Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context)); |
| 173 ASSERT_TRUE(r.Changed()); | 170 ASSERT_TRUE(r.Changed()); |
| 174 EXPECT_THAT(r.replacement(), IsFalseConstant()); | 171 EXPECT_THAT(r.replacement(), IsFalseConstant()); |
| 175 } | 172 } |
| 176 | 173 |
| 177 | 174 |
| 178 TEST_F(JSTypedLoweringTest, JSUnaryNotWithAny) { | 175 TEST_F(JSTypedLoweringTest, JSUnaryNotWithAny) { |
| 179 Node* input = Parameter(Type::Any(), 0); | 176 Node* input = Parameter(Type::Any(), 0); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 249 |
| 253 | 250 |
| 254 TEST_F(JSTypedLoweringTest, ParameterWithPlainNumber) { | 251 TEST_F(JSTypedLoweringTest, ParameterWithPlainNumber) { |
| 255 TRACED_FOREACH(double, value, kFloat64Values) { | 252 TRACED_FOREACH(double, value, kFloat64Values) { |
| 256 Handle<Object> constant = factory()->NewNumber(value); | 253 Handle<Object> constant = factory()->NewNumber(value); |
| 257 Reduction r = Reduce(Parameter(Type::Constant(constant, zone()))); | 254 Reduction r = Reduce(Parameter(Type::Constant(constant, zone()))); |
| 258 ASSERT_TRUE(r.Changed()); | 255 ASSERT_TRUE(r.Changed()); |
| 259 EXPECT_THAT(r.replacement(), IsNumberConstant(value)); | 256 EXPECT_THAT(r.replacement(), IsNumberConstant(value)); |
| 260 } | 257 } |
| 261 TRACED_FOREACH(double, value, kIntegerValues) { | 258 TRACED_FOREACH(double, value, kIntegerValues) { |
| 262 Handle<Object> constant = factory()->NewNumber(value); | 259 Reduction r = Reduce(Parameter(Type::Range(value, value, zone()))); |
| 263 Reduction r = Reduce(Parameter(Type::Range(constant, constant, zone()))); | |
| 264 ASSERT_TRUE(r.Changed()); | 260 ASSERT_TRUE(r.Changed()); |
| 265 EXPECT_THAT(r.replacement(), IsNumberConstant(value)); | 261 EXPECT_THAT(r.replacement(), IsNumberConstant(value)); |
| 266 } | 262 } |
| 267 } | 263 } |
| 268 | 264 |
| 269 | 265 |
| 270 TEST_F(JSTypedLoweringTest, ParameterWithUndefined) { | 266 TEST_F(JSTypedLoweringTest, ParameterWithUndefined) { |
| 271 Handle<HeapObject> undefined = factory()->undefined_value(); | 267 Handle<HeapObject> undefined = factory()->undefined_value(); |
| 272 { | 268 { |
| 273 Reduction r = Reduce(Parameter(Type::Undefined())); | 269 Reduction r = Reduce(Parameter(Type::Undefined())); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 292 Node* input = Parameter(Type::Boolean(), 0); | 288 Node* input = Parameter(Type::Boolean(), 0); |
| 293 Node* context = Parameter(Type::Any(), 1); | 289 Node* context = Parameter(Type::Any(), 1); |
| 294 Reduction r = | 290 Reduction r = |
| 295 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); | 291 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); |
| 296 ASSERT_TRUE(r.Changed()); | 292 ASSERT_TRUE(r.Changed()); |
| 297 EXPECT_EQ(input, r.replacement()); | 293 EXPECT_EQ(input, r.replacement()); |
| 298 } | 294 } |
| 299 | 295 |
| 300 | 296 |
| 301 TEST_F(JSTypedLoweringTest, JSToBooleanWithFalsish) { | 297 TEST_F(JSTypedLoweringTest, JSToBooleanWithFalsish) { |
| 302 Handle<Object> zero = factory()->NewNumber(0); | |
| 303 Node* input = Parameter( | 298 Node* input = Parameter( |
| 304 Type::Union( | 299 Type::Union( |
| 305 Type::MinusZero(), | 300 Type::MinusZero(), |
| 306 Type::Union( | 301 Type::Union( |
| 307 Type::NaN(), | 302 Type::NaN(), |
| 308 Type::Union( | 303 Type::Union( |
| 309 Type::Null(), | 304 Type::Null(), |
| 310 Type::Union( | 305 Type::Union( |
| 311 Type::Undefined(), | 306 Type::Undefined(), |
| 312 Type::Union( | 307 Type::Union( |
| 313 Type::Undetectable(), | 308 Type::Undetectable(), |
| 314 Type::Union( | 309 Type::Union( |
| 315 Type::Constant(factory()->false_value(), zone()), | 310 Type::Constant(factory()->false_value(), zone()), |
| 316 Type::Range(zero, zero, zone()), zone()), | 311 Type::Range(0.0, 0.0, zone()), zone()), |
| 317 zone()), | 312 zone()), |
| 318 zone()), | 313 zone()), |
| 319 zone()), | 314 zone()), |
| 320 zone()), | 315 zone()), |
| 321 zone()), | 316 zone()), |
| 322 0); | 317 0); |
| 323 Node* context = Parameter(Type::Any(), 1); | 318 Node* context = Parameter(Type::Any(), 1); |
| 324 Reduction r = | 319 Reduction r = |
| 325 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); | 320 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); |
| 326 ASSERT_TRUE(r.Changed()); | 321 ASSERT_TRUE(r.Changed()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 337 0); | 332 0); |
| 338 Node* context = Parameter(Type::Any(), 1); | 333 Node* context = Parameter(Type::Any(), 1); |
| 339 Reduction r = | 334 Reduction r = |
| 340 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); | 335 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); |
| 341 ASSERT_TRUE(r.Changed()); | 336 ASSERT_TRUE(r.Changed()); |
| 342 EXPECT_THAT(r.replacement(), IsTrueConstant()); | 337 EXPECT_THAT(r.replacement(), IsTrueConstant()); |
| 343 } | 338 } |
| 344 | 339 |
| 345 | 340 |
| 346 TEST_F(JSTypedLoweringTest, JSToBooleanWithNonZeroPlainNumber) { | 341 TEST_F(JSTypedLoweringTest, JSToBooleanWithNonZeroPlainNumber) { |
| 347 Node* input = | 342 Node* input = Parameter(Type::Range(1, V8_INFINITY, zone()), 0); |
| 348 Parameter(Type::Range(factory()->NewNumber(1), | |
| 349 factory()->NewNumber(V8_INFINITY), zone()), | |
| 350 0); | |
| 351 Node* context = Parameter(Type::Any(), 1); | 343 Node* context = Parameter(Type::Any(), 1); |
| 352 Reduction r = | 344 Reduction r = |
| 353 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); | 345 Reduce(graph()->NewNode(javascript()->ToBoolean(), input, context)); |
| 354 ASSERT_TRUE(r.Changed()); | 346 ASSERT_TRUE(r.Changed()); |
| 355 EXPECT_THAT(r.replacement(), IsTrueConstant()); | 347 EXPECT_THAT(r.replacement(), IsTrueConstant()); |
| 356 } | 348 } |
| 357 | 349 |
| 358 | 350 |
| 359 TEST_F(JSTypedLoweringTest, JSToBooleanWithAny) { | 351 TEST_F(JSTypedLoweringTest, JSToBooleanWithAny) { |
| 360 Node* input = Parameter(Type::Any(), 0); | 352 Node* input = Parameter(Type::Any(), 0); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 Handle<JSArrayBuffer> buffer = | 578 Handle<JSArrayBuffer> buffer = |
| 587 NewArrayBuffer(backing_store, sizeof(backing_store)); | 579 NewArrayBuffer(backing_store, sizeof(backing_store)); |
| 588 VectorSlotPair feedback(Handle<TypeFeedbackVector>::null(), | 580 VectorSlotPair feedback(Handle<TypeFeedbackVector>::null(), |
| 589 FeedbackVectorICSlot::Invalid()); | 581 FeedbackVectorICSlot::Invalid()); |
| 590 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { | 582 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { |
| 591 Handle<JSTypedArray> array = | 583 Handle<JSTypedArray> array = |
| 592 factory()->NewJSTypedArray(type, buffer, 0, kLength); | 584 factory()->NewJSTypedArray(type, buffer, 0, kLength); |
| 593 int const element_size = static_cast<int>(array->element_size()); | 585 int const element_size = static_cast<int>(array->element_size()); |
| 594 | 586 |
| 595 Node* key = Parameter( | 587 Node* key = Parameter( |
| 596 Type::Range(factory()->NewNumber(kMinInt / element_size), | 588 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); |
| 597 factory()->NewNumber(kMaxInt / element_size), zone())); | |
| 598 Node* base = HeapConstant(array); | 589 Node* base = HeapConstant(array); |
| 599 Node* context = UndefinedConstant(); | 590 Node* context = UndefinedConstant(); |
| 600 Node* effect = graph()->start(); | 591 Node* effect = graph()->start(); |
| 601 Node* control = graph()->start(); | 592 Node* control = graph()->start(); |
| 602 Node* node = graph()->NewNode(javascript()->LoadProperty(feedback), base, | 593 Node* node = graph()->NewNode(javascript()->LoadProperty(feedback), base, |
| 603 key, context); | 594 key, context); |
| 604 if (FLAG_turbo_deoptimization) { | 595 if (FLAG_turbo_deoptimization) { |
| 605 node->AppendInput(zone(), UndefinedConstant()); | 596 node->AppendInput(zone(), UndefinedConstant()); |
| 606 } | 597 } |
| 607 node->AppendInput(zone(), effect); | 598 node->AppendInput(zone(), effect); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 633 VectorSlotPair feedback(Handle<TypeFeedbackVector>::null(), | 624 VectorSlotPair feedback(Handle<TypeFeedbackVector>::null(), |
| 634 FeedbackVectorICSlot::Invalid()); | 625 FeedbackVectorICSlot::Invalid()); |
| 635 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { | 626 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { |
| 636 Handle<JSTypedArray> array = | 627 Handle<JSTypedArray> array = |
| 637 factory()->NewJSTypedArray(type, buffer, 0, kLength); | 628 factory()->NewJSTypedArray(type, buffer, 0, kLength); |
| 638 ElementAccess access = AccessBuilder::ForTypedArrayElement(type, true); | 629 ElementAccess access = AccessBuilder::ForTypedArrayElement(type, true); |
| 639 | 630 |
| 640 int min = random_number_generator()->NextInt(static_cast<int>(kLength)); | 631 int min = random_number_generator()->NextInt(static_cast<int>(kLength)); |
| 641 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); | 632 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); |
| 642 if (min > max) std::swap(min, max); | 633 if (min > max) std::swap(min, max); |
| 643 Node* key = Parameter(Type::Range(factory()->NewNumber(min), | 634 Node* key = Parameter(Type::Range(min, max, zone())); |
| 644 factory()->NewNumber(max), zone())); | |
| 645 Node* base = HeapConstant(array); | 635 Node* base = HeapConstant(array); |
| 646 Node* context = UndefinedConstant(); | 636 Node* context = UndefinedConstant(); |
| 647 Node* effect = graph()->start(); | 637 Node* effect = graph()->start(); |
| 648 Node* control = graph()->start(); | 638 Node* control = graph()->start(); |
| 649 Node* node = graph()->NewNode(javascript()->LoadProperty(feedback), base, | 639 Node* node = graph()->NewNode(javascript()->LoadProperty(feedback), base, |
| 650 key, context); | 640 key, context); |
| 651 if (FLAG_turbo_deoptimization) { | 641 if (FLAG_turbo_deoptimization) { |
| 652 node->AppendInput(zone(), UndefinedConstant()); | 642 node->AppendInput(zone(), UndefinedConstant()); |
| 653 } | 643 } |
| 654 node->AppendInput(zone(), effect); | 644 node->AppendInput(zone(), effect); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 674 double backing_store[kLength]; | 664 double backing_store[kLength]; |
| 675 Handle<JSArrayBuffer> buffer = | 665 Handle<JSArrayBuffer> buffer = |
| 676 NewArrayBuffer(backing_store, sizeof(backing_store)); | 666 NewArrayBuffer(backing_store, sizeof(backing_store)); |
| 677 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { | 667 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { |
| 678 TRACED_FOREACH(StrictMode, strict_mode, kStrictModes) { | 668 TRACED_FOREACH(StrictMode, strict_mode, kStrictModes) { |
| 679 Handle<JSTypedArray> array = | 669 Handle<JSTypedArray> array = |
| 680 factory()->NewJSTypedArray(type, buffer, 0, kLength); | 670 factory()->NewJSTypedArray(type, buffer, 0, kLength); |
| 681 int const element_size = static_cast<int>(array->element_size()); | 671 int const element_size = static_cast<int>(array->element_size()); |
| 682 | 672 |
| 683 Node* key = Parameter( | 673 Node* key = Parameter( |
| 684 Type::Range(factory()->NewNumber(kMinInt / element_size), | 674 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); |
| 685 factory()->NewNumber(kMaxInt / element_size), zone())); | |
| 686 Node* base = HeapConstant(array); | 675 Node* base = HeapConstant(array); |
| 687 Node* value = | 676 Node* value = |
| 688 Parameter(AccessBuilder::ForTypedArrayElement(type, true).type); | 677 Parameter(AccessBuilder::ForTypedArrayElement(type, true).type); |
| 689 Node* context = UndefinedConstant(); | 678 Node* context = UndefinedConstant(); |
| 690 Node* effect = graph()->start(); | 679 Node* effect = graph()->start(); |
| 691 Node* control = graph()->start(); | 680 Node* control = graph()->start(); |
| 692 Node* node = graph()->NewNode(javascript()->StoreProperty(strict_mode), | 681 Node* node = graph()->NewNode(javascript()->StoreProperty(strict_mode), |
| 693 base, key, value, context); | 682 base, key, value, context); |
| 694 if (FLAG_turbo_deoptimization) { | 683 if (FLAG_turbo_deoptimization) { |
| 695 node->AppendInput(zone(), UndefinedConstant()); | 684 node->AppendInput(zone(), UndefinedConstant()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 721 double backing_store[kLength]; | 710 double backing_store[kLength]; |
| 722 Handle<JSArrayBuffer> buffer = | 711 Handle<JSArrayBuffer> buffer = |
| 723 NewArrayBuffer(backing_store, sizeof(backing_store)); | 712 NewArrayBuffer(backing_store, sizeof(backing_store)); |
| 724 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { | 713 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { |
| 725 TRACED_FOREACH(StrictMode, strict_mode, kStrictModes) { | 714 TRACED_FOREACH(StrictMode, strict_mode, kStrictModes) { |
| 726 Handle<JSTypedArray> array = | 715 Handle<JSTypedArray> array = |
| 727 factory()->NewJSTypedArray(type, buffer, 0, kLength); | 716 factory()->NewJSTypedArray(type, buffer, 0, kLength); |
| 728 int const element_size = static_cast<int>(array->element_size()); | 717 int const element_size = static_cast<int>(array->element_size()); |
| 729 | 718 |
| 730 Node* key = Parameter( | 719 Node* key = Parameter( |
| 731 Type::Range(factory()->NewNumber(kMinInt / element_size), | 720 Type::Range(kMinInt / element_size, kMaxInt / element_size, zone())); |
| 732 factory()->NewNumber(kMaxInt / element_size), zone())); | |
| 733 Node* base = HeapConstant(array); | 721 Node* base = HeapConstant(array); |
| 734 Node* value = Parameter(Type::Any()); | 722 Node* value = Parameter(Type::Any()); |
| 735 Node* context = UndefinedConstant(); | 723 Node* context = UndefinedConstant(); |
| 736 Node* effect = graph()->start(); | 724 Node* effect = graph()->start(); |
| 737 Node* control = graph()->start(); | 725 Node* control = graph()->start(); |
| 738 Node* node = graph()->NewNode(javascript()->StoreProperty(strict_mode), | 726 Node* node = graph()->NewNode(javascript()->StoreProperty(strict_mode), |
| 739 base, key, value, context); | 727 base, key, value, context); |
| 740 if (FLAG_turbo_deoptimization) { | 728 if (FLAG_turbo_deoptimization) { |
| 741 node->AppendInput(zone(), UndefinedConstant()); | 729 node->AppendInput(zone(), UndefinedConstant()); |
| 742 } | 730 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 NewArrayBuffer(backing_store, sizeof(backing_store)); | 768 NewArrayBuffer(backing_store, sizeof(backing_store)); |
| 781 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { | 769 TRACED_FOREACH(ExternalArrayType, type, kExternalArrayTypes) { |
| 782 TRACED_FOREACH(StrictMode, strict_mode, kStrictModes) { | 770 TRACED_FOREACH(StrictMode, strict_mode, kStrictModes) { |
| 783 Handle<JSTypedArray> array = | 771 Handle<JSTypedArray> array = |
| 784 factory()->NewJSTypedArray(type, buffer, 0, kLength); | 772 factory()->NewJSTypedArray(type, buffer, 0, kLength); |
| 785 ElementAccess access = AccessBuilder::ForTypedArrayElement(type, true); | 773 ElementAccess access = AccessBuilder::ForTypedArrayElement(type, true); |
| 786 | 774 |
| 787 int min = random_number_generator()->NextInt(static_cast<int>(kLength)); | 775 int min = random_number_generator()->NextInt(static_cast<int>(kLength)); |
| 788 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); | 776 int max = random_number_generator()->NextInt(static_cast<int>(kLength)); |
| 789 if (min > max) std::swap(min, max); | 777 if (min > max) std::swap(min, max); |
| 790 Node* key = Parameter(Type::Range(factory()->NewNumber(min), | 778 Node* key = Parameter(Type::Range(min, max, zone())); |
| 791 factory()->NewNumber(max), zone())); | |
| 792 Node* base = HeapConstant(array); | 779 Node* base = HeapConstant(array); |
| 793 Node* value = Parameter(access.type); | 780 Node* value = Parameter(access.type); |
| 794 Node* context = UndefinedConstant(); | 781 Node* context = UndefinedConstant(); |
| 795 Node* effect = graph()->start(); | 782 Node* effect = graph()->start(); |
| 796 Node* control = graph()->start(); | 783 Node* control = graph()->start(); |
| 797 Node* node = graph()->NewNode(javascript()->StoreProperty(strict_mode), | 784 Node* node = graph()->NewNode(javascript()->StoreProperty(strict_mode), |
| 798 base, key, value, context); | 785 base, key, value, context); |
| 799 if (FLAG_turbo_deoptimization) { | 786 if (FLAG_turbo_deoptimization) { |
| 800 node->AppendInput(zone(), UndefinedConstant()); | 787 node->AppendInput(zone(), UndefinedConstant()); |
| 801 } | 788 } |
| 802 node->AppendInput(zone(), effect); | 789 node->AppendInput(zone(), effect); |
| 803 node->AppendInput(zone(), control); | 790 node->AppendInput(zone(), control); |
| 804 Reduction r = Reduce(node); | 791 Reduction r = Reduce(node); |
| 805 | 792 |
| 806 ASSERT_TRUE(r.Changed()); | 793 ASSERT_TRUE(r.Changed()); |
| 807 EXPECT_THAT( | 794 EXPECT_THAT( |
| 808 r.replacement(), | 795 r.replacement(), |
| 809 IsStoreElement( | 796 IsStoreElement( |
| 810 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), | 797 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), |
| 811 key, value, effect, control)); | 798 key, value, effect, control)); |
| 812 } | 799 } |
| 813 } | 800 } |
| 814 } | 801 } |
| 815 | 802 |
| 816 } // namespace compiler | 803 } // namespace compiler |
| 817 } // namespace internal | 804 } // namespace internal |
| 818 } // namespace v8 | 805 } // namespace v8 |
| OLD | NEW |