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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 field_access.name = MaybeHandle<Name>(); | 283 field_access.name = MaybeHandle<Name>(); |
284 } | 284 } |
285 field_access.machine_type = MachineType::Float64(); | 285 field_access.machine_type = MachineType::Float64(); |
286 } | 286 } |
287 this_value = this_effect = | 287 this_value = this_effect = |
288 graph()->NewNode(simplified()->LoadField(field_access), | 288 graph()->NewNode(simplified()->LoadField(field_access), |
289 this_storage, this_effect, this_control); | 289 this_storage, this_effect, this_control); |
290 } else { | 290 } else { |
291 DCHECK_EQ(AccessMode::kStore, access_mode); | 291 DCHECK_EQ(AccessMode::kStore, access_mode); |
292 if (field_type->Is(Type::UntaggedFloat64())) { | 292 if (field_type->Is(Type::UntaggedFloat64())) { |
293 Node* check = this_control = this_effect = | 293 Node* check = |
294 graph()->NewNode(simplified()->ObjectIsNumber(), this_value, | 294 graph()->NewNode(simplified()->ObjectIsNumber(), this_value); |
295 this_effect, this_control); | |
296 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), | 295 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), |
297 check, this_control); | 296 check, this_control); |
298 exit_controls.push_back( | 297 exit_controls.push_back( |
299 graph()->NewNode(common()->IfFalse(), branch)); | 298 graph()->NewNode(common()->IfFalse(), branch)); |
300 this_control = graph()->NewNode(common()->IfTrue(), branch); | 299 this_control = graph()->NewNode(common()->IfTrue(), branch); |
301 this_value = graph()->NewNode(common()->Guard(Type::Number()), | 300 this_value = graph()->NewNode(common()->Guard(Type::Number()), |
302 this_value, this_control); | 301 this_value, this_control); |
303 | 302 |
304 if (!field_index.is_inobject() || field_index.is_hidden_field() || | 303 if (!field_index.is_inobject() || field_index.is_hidden_field() || |
305 !FLAG_unbox_double_fields) { | 304 !FLAG_unbox_double_fields) { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 // Certain stores need a prototype chain check because shape changes | 645 // Certain stores need a prototype chain check because shape changes |
647 // could allow callbacks on elements in the prototype chain that are | 646 // could allow callbacks on elements in the prototype chain that are |
648 // not compatible with (monomorphic) keyed stores. | 647 // not compatible with (monomorphic) keyed stores. |
649 Handle<JSObject> holder; | 648 Handle<JSObject> holder; |
650 if (access_info.holder().ToHandle(&holder)) { | 649 if (access_info.holder().ToHandle(&holder)) { |
651 AssumePrototypesStable(receiver_type, native_context, holder); | 650 AssumePrototypesStable(receiver_type, native_context, holder); |
652 } | 651 } |
653 | 652 |
654 // Check that the {index} is actually a Number. | 653 // Check that the {index} is actually a Number. |
655 if (!NumberMatcher(this_index).HasValue()) { | 654 if (!NumberMatcher(this_index).HasValue()) { |
656 Node* check = this_control = this_effect = | 655 Node* check = |
657 graph()->NewNode(simplified()->ObjectIsNumber(), this_index, | 656 graph()->NewNode(simplified()->ObjectIsNumber(), this_index); |
658 this_effect, this_control); | |
659 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), | 657 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), |
660 check, this_control); | 658 check, this_control); |
661 exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); | 659 exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); |
662 this_control = graph()->NewNode(common()->IfTrue(), branch); | 660 this_control = graph()->NewNode(common()->IfTrue(), branch); |
663 this_index = graph()->NewNode(common()->Guard(Type::Number()), this_index, | 661 this_index = graph()->NewNode(common()->Guard(Type::Number()), this_index, |
664 this_control); | 662 this_control); |
665 } | 663 } |
666 | 664 |
667 // Convert the {index} to an unsigned32 value and check if the result is | 665 // Convert the {index} to an unsigned32 value and check if the result is |
668 // equal to the original {index}. | 666 // equal to the original {index}. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 DCHECK_EQ(AccessMode::kStore, access_mode); | 818 DCHECK_EQ(AccessMode::kStore, access_mode); |
821 if (IsFastSmiElementsKind(elements_kind)) { | 819 if (IsFastSmiElementsKind(elements_kind)) { |
822 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), this_value); | 820 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), this_value); |
823 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), | 821 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), |
824 check, this_control); | 822 check, this_control); |
825 exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); | 823 exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); |
826 this_control = graph()->NewNode(common()->IfTrue(), branch); | 824 this_control = graph()->NewNode(common()->IfTrue(), branch); |
827 this_value = graph()->NewNode(common()->Guard(type_cache_.kSmi), | 825 this_value = graph()->NewNode(common()->Guard(type_cache_.kSmi), |
828 this_value, this_control); | 826 this_value, this_control); |
829 } else if (IsFastDoubleElementsKind(elements_kind)) { | 827 } else if (IsFastDoubleElementsKind(elements_kind)) { |
830 Node* check = this_control = this_effect = | 828 Node* check = |
831 graph()->NewNode(simplified()->ObjectIsNumber(), this_value, | 829 graph()->NewNode(simplified()->ObjectIsNumber(), this_value); |
832 this_effect, this_control); | |
833 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), | 830 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), |
834 check, this_control); | 831 check, this_control); |
835 exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); | 832 exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); |
836 this_control = graph()->NewNode(common()->IfTrue(), branch); | 833 this_control = graph()->NewNode(common()->IfTrue(), branch); |
837 this_value = graph()->NewNode(common()->Guard(Type::Number()), | 834 this_value = graph()->NewNode(common()->Guard(Type::Number()), |
838 this_value, this_control); | 835 this_value, this_control); |
839 } | 836 } |
840 this_effect = graph()->NewNode(simplified()->StoreElement(element_access), | 837 this_effect = graph()->NewNode(simplified()->StoreElement(element_access), |
841 this_elements, this_index, this_value, | 838 this_elements, this_index, this_value, |
842 this_effect, this_control); | 839 this_effect, this_control); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 } | 1043 } |
1047 | 1044 |
1048 | 1045 |
1049 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1046 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
1050 return jsgraph()->simplified(); | 1047 return jsgraph()->simplified(); |
1051 } | 1048 } |
1052 | 1049 |
1053 } // namespace compiler | 1050 } // namespace compiler |
1054 } // namespace internal | 1051 } // namespace internal |
1055 } // namespace v8 | 1052 } // namespace v8 |
OLD | NEW |