Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: src/interpreter/interpreter.cc

Issue 2506283003: [Interpreter] Collect NumberOrOddball feedback in CompareOps. (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/globals.h ('k') | src/type-feedback-vector-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_string(assembler), gather_rhs_type(assembler), 1006 lhs_is_not_oddball(assembler), lhs_is_not_string(assembler),
1007 update_feedback(assembler); 1007 gather_rhs_type(assembler), 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_type = 1028 Node* lhs_is_oddball =
1029 __ Select(__ IsStringInstanceType(lhs_instance_type), 1029 __ Word32Equal(lhs_instance_type, __ Int32Constant(ODDBALL_TYPE));
1030 __ Int32Constant(CompareOperationFeedback::kString), 1030 __ GotoUnless(lhs_is_oddball, &lhs_is_not_oddball);
1031 __ Int32Constant(CompareOperationFeedback::kAny));
1032 1031
1033 var_type_feedback.Bind(lhs_type); 1032 var_type_feedback.Bind(
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 }
1035 } 1046 }
1036 } 1047 }
1037 1048
1038 __ Bind(&gather_rhs_type); 1049 __ Bind(&gather_rhs_type);
1039 { 1050 {
1040 Label rhs_is_not_smi(assembler), rhs_is_not_number(assembler); 1051 Label rhs_is_not_smi(assembler), rhs_is_not_number(assembler),
1052 rhs_is_not_oddball(assembler);
1041 1053
1042 __ GotoUnless(__ TaggedIsSmi(rhs), &rhs_is_not_smi); 1054 __ GotoUnless(__ TaggedIsSmi(rhs), &rhs_is_not_smi);
1043 1055
1044 var_type_feedback.Bind(__ Word32Or( 1056 var_type_feedback.Bind(__ Word32Or(
1045 var_type_feedback.value(), 1057 var_type_feedback.value(),
1046 __ Int32Constant(CompareOperationFeedback::kSignedSmall))); 1058 __ Int32Constant(CompareOperationFeedback::kSignedSmall)));
1047 __ Goto(&update_feedback); 1059 __ Goto(&update_feedback);
1048 1060
1049 __ Bind(&rhs_is_not_smi); 1061 __ Bind(&rhs_is_not_smi);
1050 { 1062 {
1051 Node* rhs_map = __ LoadMap(rhs); 1063 Node* rhs_map = __ LoadMap(rhs);
1052 __ GotoUnless(__ WordEqual(rhs_map, __ HeapNumberMapConstant()), 1064 __ GotoUnless(__ WordEqual(rhs_map, __ HeapNumberMapConstant()),
1053 &rhs_is_not_number); 1065 &rhs_is_not_number);
1054 1066
1055 var_type_feedback.Bind( 1067 var_type_feedback.Bind(
1056 __ Word32Or(var_type_feedback.value(), 1068 __ Word32Or(var_type_feedback.value(),
1057 __ Int32Constant(CompareOperationFeedback::kNumber))); 1069 __ Int32Constant(CompareOperationFeedback::kNumber)));
1058 __ Goto(&update_feedback); 1070 __ Goto(&update_feedback);
1059 1071
1060 __ Bind(&rhs_is_not_number); 1072 __ Bind(&rhs_is_not_number);
1061 { 1073 {
1062 Node* rhs_instance_type = __ LoadInstanceType(rhs); 1074 Node* rhs_instance_type = __ LoadInstanceType(rhs);
1063 Node* rhs_type = 1075 Node* rhs_is_oddball =
1064 __ Select(__ IsStringInstanceType(rhs_instance_type), 1076 __ Word32Equal(rhs_instance_type, __ Int32Constant(ODDBALL_TYPE));
1065 __ Int32Constant(CompareOperationFeedback::kString), 1077 __ GotoUnless(rhs_is_oddball, &rhs_is_not_oddball);
1066 __ Int32Constant(CompareOperationFeedback::kAny)); 1078
1067 var_type_feedback.Bind( 1079 var_type_feedback.Bind(
1068 __ Word32Or(var_type_feedback.value(), rhs_type)); 1080 __ Int32Constant(CompareOperationFeedback::kNumberOrOddball));
1069 __ Goto(&update_feedback); 1081 __ Goto(&do_compare);
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 }
1070 } 1093 }
1071 } 1094 }
1072 } 1095 }
1073 1096
1074 __ Bind(&update_feedback); 1097 __ Bind(&update_feedback);
1075 { 1098 {
1076 __ UpdateFeedback(var_type_feedback.value(), type_feedback_vector, 1099 __ UpdateFeedback(var_type_feedback.value(), type_feedback_vector,
1077 slot_index); 1100 slot_index);
1078 __ Goto(&do_compare); 1101 __ Goto(&do_compare);
1079 } 1102 }
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, 2757 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset,
2735 __ SmiTag(new_state)); 2758 __ SmiTag(new_state));
2736 __ SetAccumulator(old_state); 2759 __ SetAccumulator(old_state);
2737 2760
2738 __ Dispatch(); 2761 __ Dispatch();
2739 } 2762 }
2740 2763
2741 } // namespace interpreter 2764 } // namespace interpreter
2742 } // namespace internal 2765 } // namespace internal
2743 } // namespace v8 2766 } // namespace v8
OLDNEW
« no previous file with comments | « src/globals.h ('k') | src/type-feedback-vector-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698