OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/js-native-context-specialization.h" | 5 #include "src/compiler/js-native-context-specialization.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 // Deoptimize in case of the hole. | 783 // Deoptimize in case of the hole. |
784 this_control = this_effect = | 784 this_control = this_effect = |
785 graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, | 785 graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, |
786 this_effect, this_control); | 786 this_effect, this_control); |
787 } | 787 } |
788 // Rename the result to represent the actual type (not polluted by the | 788 // Rename the result to represent the actual type (not polluted by the |
789 // hole). | 789 // hole). |
790 this_value = graph()->NewNode(simplified()->TypeGuard(element_type), | 790 this_value = graph()->NewNode(simplified()->TypeGuard(element_type), |
791 this_value, this_control); | 791 this_value, this_control); |
792 } else if (elements_kind == FAST_HOLEY_DOUBLE_ELEMENTS) { | 792 } else if (elements_kind == FAST_HOLEY_DOUBLE_ELEMENTS) { |
793 // Perform the hole check on the result. | |
794 Node* check = | |
795 graph()->NewNode(simplified()->NumberIsHoleNaN(), this_value); | |
796 // Check if we are allowed to return the hole directly. | 793 // Check if we are allowed to return the hole directly. |
797 Type* initial_holey_array_type = Type::Class( | 794 Type* initial_holey_array_type = Type::Class( |
798 handle(isolate()->get_initial_js_array_map(elements_kind)), | 795 handle(isolate()->get_initial_js_array_map(elements_kind)), |
799 graph()->zone()); | 796 graph()->zone()); |
800 if (receiver_type->NowIs(initial_holey_array_type) && | 797 if (receiver_type->NowIs(initial_holey_array_type) && |
801 isolate()->IsFastArrayConstructorPrototypeChainIntact()) { | 798 isolate()->IsFastArrayConstructorPrototypeChainIntact()) { |
802 // Add a code dependency on the array protector cell. | 799 // Add a code dependency on the array protector cell. |
803 AssumePrototypesStable(receiver_type, native_context, | 800 AssumePrototypesStable(receiver_type, native_context, |
804 isolate()->initial_object_prototype()); | 801 isolate()->initial_object_prototype()); |
805 dependencies()->AssumePropertyCell(factory()->array_protector()); | 802 dependencies()->AssumePropertyCell(factory()->array_protector()); |
806 // Turn the hole into undefined. | 803 // Turn the hole into undefined. |
807 this_value = graph()->NewNode( | 804 this_value = graph()->NewNode(simplified()->NumberConvertHoleNaN(), |
808 common()->Select(MachineRepresentation::kTagged, | 805 this_value); |
809 BranchHint::kFalse), | |
810 check, jsgraph()->UndefinedConstant(), this_value); | |
811 } else { | 806 } else { |
| 807 // Perform the hole check on the result. |
| 808 Node* check = |
| 809 graph()->NewNode(simplified()->NumberIsHoleNaN(), this_value); |
812 // Deoptimize in case of the hole. | 810 // Deoptimize in case of the hole. |
813 this_control = this_effect = | 811 this_control = this_effect = |
814 graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, | 812 graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, |
815 this_effect, this_control); | 813 this_effect, this_control); |
816 } | 814 } |
817 } | 815 } |
818 } else { | 816 } else { |
819 DCHECK_EQ(AccessMode::kStore, access_mode); | 817 DCHECK_EQ(AccessMode::kStore, access_mode); |
820 if (IsFastSmiElementsKind(elements_kind)) { | 818 if (IsFastSmiElementsKind(elements_kind)) { |
821 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), this_value); | 819 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), this_value); |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 } | 1122 } |
1125 | 1123 |
1126 | 1124 |
1127 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1125 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
1128 return jsgraph()->simplified(); | 1126 return jsgraph()->simplified(); |
1129 } | 1127 } |
1130 | 1128 |
1131 } // namespace compiler | 1129 } // namespace compiler |
1132 } // namespace internal | 1130 } // namespace internal |
1133 } // namespace v8 | 1131 } // namespace v8 |
OLD | NEW |