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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 field_access.machine_type = MachineType::Float64(); | 316 field_access.machine_type = MachineType::Float64(); |
317 } | 317 } |
318 } else if (field_type->Is(Type::TaggedSigned())) { | 318 } else if (field_type->Is(Type::TaggedSigned())) { |
319 Node* check = | 319 Node* check = |
320 graph()->NewNode(simplified()->ObjectIsSmi(), this_value); | 320 graph()->NewNode(simplified()->ObjectIsSmi(), this_value); |
321 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), | 321 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), |
322 check, this_control); | 322 check, this_control); |
323 exit_controls.push_back( | 323 exit_controls.push_back( |
324 graph()->NewNode(common()->IfFalse(), branch)); | 324 graph()->NewNode(common()->IfFalse(), branch)); |
325 this_control = graph()->NewNode(common()->IfTrue(), branch); | 325 this_control = graph()->NewNode(common()->IfTrue(), branch); |
| 326 this_value = graph()->NewNode(common()->Guard(type_cache_.kSmi), |
| 327 this_value, this_control); |
326 } else if (field_type->Is(Type::TaggedPointer())) { | 328 } else if (field_type->Is(Type::TaggedPointer())) { |
327 Node* check = | 329 Node* check = |
328 graph()->NewNode(simplified()->ObjectIsSmi(), this_value); | 330 graph()->NewNode(simplified()->ObjectIsSmi(), this_value); |
329 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse), | 331 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kFalse), |
330 check, this_control); | 332 check, this_control); |
331 exit_controls.push_back(graph()->NewNode(common()->IfTrue(), branch)); | 333 exit_controls.push_back(graph()->NewNode(common()->IfTrue(), branch)); |
332 this_control = graph()->NewNode(common()->IfFalse(), branch); | 334 this_control = graph()->NewNode(common()->IfFalse(), branch); |
333 if (field_type->NumClasses() > 0) { | 335 if (field_type->NumClasses() > 0) { |
334 // Emit a (sequence of) map checks for the value. | 336 // Emit a (sequence of) map checks for the value. |
335 ZoneVector<Node*> this_controls(zone()); | 337 ZoneVector<Node*> this_controls(zone()); |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 } | 797 } |
796 } | 798 } |
797 } else { | 799 } else { |
798 DCHECK_EQ(AccessMode::kStore, access_mode); | 800 DCHECK_EQ(AccessMode::kStore, access_mode); |
799 if (IsFastSmiElementsKind(elements_kind)) { | 801 if (IsFastSmiElementsKind(elements_kind)) { |
800 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), this_value); | 802 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), this_value); |
801 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), | 803 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), |
802 check, this_control); | 804 check, this_control); |
803 exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); | 805 exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); |
804 this_control = graph()->NewNode(common()->IfTrue(), branch); | 806 this_control = graph()->NewNode(common()->IfTrue(), branch); |
| 807 this_value = graph()->NewNode(common()->Guard(type_cache_.kSmi), |
| 808 this_value, this_control); |
805 } else if (IsFastDoubleElementsKind(elements_kind)) { | 809 } else if (IsFastDoubleElementsKind(elements_kind)) { |
806 Node* check = | 810 Node* check = |
807 graph()->NewNode(simplified()->ObjectIsNumber(), this_value); | 811 graph()->NewNode(simplified()->ObjectIsNumber(), this_value); |
808 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), | 812 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), |
809 check, this_control); | 813 check, this_control); |
810 exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); | 814 exit_controls.push_back(graph()->NewNode(common()->IfFalse(), branch)); |
811 this_control = graph()->NewNode(common()->IfTrue(), branch); | 815 this_control = graph()->NewNode(common()->IfTrue(), branch); |
812 this_value = graph()->NewNode(common()->Guard(Type::Number()), | 816 this_value = graph()->NewNode(common()->Guard(Type::Number()), |
813 this_value, this_control); | 817 this_value, this_control); |
814 } | 818 } |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 } | 1024 } |
1021 | 1025 |
1022 | 1026 |
1023 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1027 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
1024 return jsgraph()->simplified(); | 1028 return jsgraph()->simplified(); |
1025 } | 1029 } |
1026 | 1030 |
1027 } // namespace compiler | 1031 } // namespace compiler |
1028 } // namespace internal | 1032 } // namespace internal |
1029 } // namespace v8 | 1033 } // namespace v8 |
OLD | NEW |