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