| 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/interpreter/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
| 6 | 6 |
| 7 #include <fstream> | 7 #include <fstream> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 // try-finally blocks and generators), and we could get rid of this by | 996 // try-finally blocks and generators), and we could get rid of this by |
| 997 // introducing Smi equality tests. | 997 // introducing Smi equality tests. |
| 998 Label gather_type_feedback(assembler), do_compare(assembler); | 998 Label gather_type_feedback(assembler), do_compare(assembler); |
| 999 __ Branch(__ WordEqual(slot_index, __ IntPtrConstant(0)), &do_compare, | 999 __ Branch(__ WordEqual(slot_index, __ IntPtrConstant(0)), &do_compare, |
| 1000 &gather_type_feedback); | 1000 &gather_type_feedback); |
| 1001 | 1001 |
| 1002 __ Bind(&gather_type_feedback); | 1002 __ Bind(&gather_type_feedback); |
| 1003 { | 1003 { |
| 1004 Variable var_type_feedback(assembler, MachineRepresentation::kWord32); | 1004 Variable var_type_feedback(assembler, MachineRepresentation::kWord32); |
| 1005 Label lhs_is_not_smi(assembler), lhs_is_not_number(assembler), | 1005 Label lhs_is_not_smi(assembler), lhs_is_not_number(assembler), |
| 1006 lhs_is_not_oddball(assembler), lhs_is_not_string(assembler), | 1006 lhs_is_not_string(assembler), gather_rhs_type(assembler), |
| 1007 gather_rhs_type(assembler), update_feedback(assembler); | 1007 update_feedback(assembler); |
| 1008 | 1008 |
| 1009 __ GotoUnless(__ TaggedIsSmi(lhs), &lhs_is_not_smi); | 1009 __ GotoUnless(__ TaggedIsSmi(lhs), &lhs_is_not_smi); |
| 1010 | 1010 |
| 1011 var_type_feedback.Bind( | 1011 var_type_feedback.Bind( |
| 1012 __ Int32Constant(CompareOperationFeedback::kSignedSmall)); | 1012 __ Int32Constant(CompareOperationFeedback::kSignedSmall)); |
| 1013 __ Goto(&gather_rhs_type); | 1013 __ Goto(&gather_rhs_type); |
| 1014 | 1014 |
| 1015 __ Bind(&lhs_is_not_smi); | 1015 __ Bind(&lhs_is_not_smi); |
| 1016 { | 1016 { |
| 1017 Node* lhs_map = __ LoadMap(lhs); | 1017 Node* lhs_map = __ LoadMap(lhs); |
| 1018 __ GotoUnless(__ WordEqual(lhs_map, __ HeapNumberMapConstant()), | 1018 __ GotoUnless(__ WordEqual(lhs_map, __ HeapNumberMapConstant()), |
| 1019 &lhs_is_not_number); | 1019 &lhs_is_not_number); |
| 1020 | 1020 |
| 1021 var_type_feedback.Bind( | 1021 var_type_feedback.Bind( |
| 1022 __ Int32Constant(CompareOperationFeedback::kNumber)); | 1022 __ Int32Constant(CompareOperationFeedback::kNumber)); |
| 1023 __ Goto(&gather_rhs_type); | 1023 __ Goto(&gather_rhs_type); |
| 1024 | 1024 |
| 1025 __ Bind(&lhs_is_not_number); | 1025 __ Bind(&lhs_is_not_number); |
| 1026 { | 1026 { |
| 1027 Node* lhs_instance_type = __ LoadInstanceType(lhs); | 1027 Node* lhs_instance_type = __ LoadInstanceType(lhs); |
| 1028 Node* lhs_is_oddball = | 1028 Node* lhs_type = |
| 1029 __ Word32Equal(lhs_instance_type, __ Int32Constant(ODDBALL_TYPE)); | 1029 __ Select(__ IsStringInstanceType(lhs_instance_type), |
| 1030 __ GotoUnless(lhs_is_oddball, &lhs_is_not_oddball); | 1030 __ Int32Constant(CompareOperationFeedback::kString), |
| 1031 __ Int32Constant(CompareOperationFeedback::kAny)); |
| 1031 | 1032 |
| 1032 var_type_feedback.Bind( | 1033 var_type_feedback.Bind(lhs_type); |
| 1033 __ Int32Constant(CompareOperationFeedback::kNumberOrOddball)); | |
| 1034 __ Goto(&gather_rhs_type); | 1034 __ Goto(&gather_rhs_type); |
| 1035 | |
| 1036 __ Bind(&lhs_is_not_oddball); | |
| 1037 { | |
| 1038 Node* lhs_type = | |
| 1039 __ Select(__ IsStringInstanceType(lhs_instance_type), | |
| 1040 __ Int32Constant(CompareOperationFeedback::kString), | |
| 1041 __ Int32Constant(CompareOperationFeedback::kAny)); | |
| 1042 | |
| 1043 var_type_feedback.Bind(lhs_type); | |
| 1044 __ Goto(&gather_rhs_type); | |
| 1045 } | |
| 1046 } | 1035 } |
| 1047 } | 1036 } |
| 1048 | 1037 |
| 1049 __ Bind(&gather_rhs_type); | 1038 __ Bind(&gather_rhs_type); |
| 1050 { | 1039 { |
| 1051 Label rhs_is_not_smi(assembler), rhs_is_not_number(assembler), | 1040 Label rhs_is_not_smi(assembler), rhs_is_not_number(assembler); |
| 1052 rhs_is_not_oddball(assembler); | |
| 1053 | 1041 |
| 1054 __ GotoUnless(__ TaggedIsSmi(rhs), &rhs_is_not_smi); | 1042 __ GotoUnless(__ TaggedIsSmi(rhs), &rhs_is_not_smi); |
| 1055 | 1043 |
| 1056 var_type_feedback.Bind(__ Word32Or( | 1044 var_type_feedback.Bind(__ Word32Or( |
| 1057 var_type_feedback.value(), | 1045 var_type_feedback.value(), |
| 1058 __ Int32Constant(CompareOperationFeedback::kSignedSmall))); | 1046 __ Int32Constant(CompareOperationFeedback::kSignedSmall))); |
| 1059 __ Goto(&update_feedback); | 1047 __ Goto(&update_feedback); |
| 1060 | 1048 |
| 1061 __ Bind(&rhs_is_not_smi); | 1049 __ Bind(&rhs_is_not_smi); |
| 1062 { | 1050 { |
| 1063 Node* rhs_map = __ LoadMap(rhs); | 1051 Node* rhs_map = __ LoadMap(rhs); |
| 1064 __ GotoUnless(__ WordEqual(rhs_map, __ HeapNumberMapConstant()), | 1052 __ GotoUnless(__ WordEqual(rhs_map, __ HeapNumberMapConstant()), |
| 1065 &rhs_is_not_number); | 1053 &rhs_is_not_number); |
| 1066 | 1054 |
| 1067 var_type_feedback.Bind( | 1055 var_type_feedback.Bind( |
| 1068 __ Word32Or(var_type_feedback.value(), | 1056 __ Word32Or(var_type_feedback.value(), |
| 1069 __ Int32Constant(CompareOperationFeedback::kNumber))); | 1057 __ Int32Constant(CompareOperationFeedback::kNumber))); |
| 1070 __ Goto(&update_feedback); | 1058 __ Goto(&update_feedback); |
| 1071 | 1059 |
| 1072 __ Bind(&rhs_is_not_number); | 1060 __ Bind(&rhs_is_not_number); |
| 1073 { | 1061 { |
| 1074 Node* rhs_instance_type = __ LoadInstanceType(rhs); | 1062 Node* rhs_instance_type = __ LoadInstanceType(rhs); |
| 1075 Node* rhs_is_oddball = | 1063 Node* rhs_type = |
| 1076 __ Word32Equal(rhs_instance_type, __ Int32Constant(ODDBALL_TYPE)); | 1064 __ Select(__ IsStringInstanceType(rhs_instance_type), |
| 1077 __ GotoUnless(rhs_is_oddball, &rhs_is_not_oddball); | 1065 __ Int32Constant(CompareOperationFeedback::kString), |
| 1078 | 1066 __ Int32Constant(CompareOperationFeedback::kAny)); |
| 1079 var_type_feedback.Bind( | 1067 var_type_feedback.Bind( |
| 1080 __ Int32Constant(CompareOperationFeedback::kNumberOrOddball)); | 1068 __ Word32Or(var_type_feedback.value(), rhs_type)); |
| 1081 __ Goto(&do_compare); | 1069 __ Goto(&update_feedback); |
| 1082 | |
| 1083 __ Bind(&rhs_is_not_oddball); | |
| 1084 { | |
| 1085 Node* rhs_type = | |
| 1086 __ Select(__ IsStringInstanceType(rhs_instance_type), | |
| 1087 __ Int32Constant(CompareOperationFeedback::kString), | |
| 1088 __ Int32Constant(CompareOperationFeedback::kAny)); | |
| 1089 var_type_feedback.Bind( | |
| 1090 __ Word32Or(var_type_feedback.value(), rhs_type)); | |
| 1091 __ Goto(&update_feedback); | |
| 1092 } | |
| 1093 } | 1070 } |
| 1094 } | 1071 } |
| 1095 } | 1072 } |
| 1096 | 1073 |
| 1097 __ Bind(&update_feedback); | 1074 __ Bind(&update_feedback); |
| 1098 { | 1075 { |
| 1099 __ UpdateFeedback(var_type_feedback.value(), type_feedback_vector, | 1076 __ UpdateFeedback(var_type_feedback.value(), type_feedback_vector, |
| 1100 slot_index); | 1077 slot_index); |
| 1101 __ Goto(&do_compare); | 1078 __ Goto(&do_compare); |
| 1102 } | 1079 } |
| (...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2757 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2734 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 2758 __ SmiTag(new_state)); | 2735 __ SmiTag(new_state)); |
| 2759 __ SetAccumulator(old_state); | 2736 __ SetAccumulator(old_state); |
| 2760 | 2737 |
| 2761 __ Dispatch(); | 2738 __ Dispatch(); |
| 2762 } | 2739 } |
| 2763 | 2740 |
| 2764 } // namespace interpreter | 2741 } // namespace interpreter |
| 2765 } // namespace internal | 2742 } // namespace internal |
| 2766 } // namespace v8 | 2743 } // namespace v8 |
| OLD | NEW |