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

Side by Side Diff: src/code-stubs.cc

Issue 2395083002: [ignition] Inline the add for strings in AddWithFeedback (Closed)
Patch Set: Created 4 years, 2 months 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 compiler::Node* AddWithFeedbackStub::Generate( 1027 compiler::Node* AddWithFeedbackStub::Generate(
1028 CodeStubAssembler* assembler, compiler::Node* lhs, compiler::Node* rhs, 1028 CodeStubAssembler* assembler, compiler::Node* lhs, compiler::Node* rhs,
1029 compiler::Node* slot_id, compiler::Node* type_feedback_vector, 1029 compiler::Node* slot_id, compiler::Node* type_feedback_vector,
1030 compiler::Node* context) { 1030 compiler::Node* context) {
1031 typedef CodeStubAssembler::Label Label; 1031 typedef CodeStubAssembler::Label Label;
1032 typedef compiler::Node Node; 1032 typedef compiler::Node Node;
1033 typedef CodeStubAssembler::Variable Variable; 1033 typedef CodeStubAssembler::Variable Variable;
1034 1034
1035 // Shared entry for floating point addition. 1035 // Shared entry for floating point addition.
1036 Label do_fadd(assembler), end(assembler), 1036 Label do_fadd(assembler), end(assembler),
1037 do_add_any(assembler, Label::kDeferred), call_add_stub(assembler); 1037 call_add_stub(assembler, Label::kDeferred);
1038 Variable var_fadd_lhs(assembler, MachineRepresentation::kFloat64), 1038 Variable var_fadd_lhs(assembler, MachineRepresentation::kFloat64),
1039 var_fadd_rhs(assembler, MachineRepresentation::kFloat64), 1039 var_fadd_rhs(assembler, MachineRepresentation::kFloat64),
1040 var_type_feedback(assembler, MachineRepresentation::kWord32), 1040 var_type_feedback(assembler, MachineRepresentation::kWord32),
1041 var_result(assembler, MachineRepresentation::kTagged); 1041 var_result(assembler, MachineRepresentation::kTagged);
1042 1042
1043 // Check if the {lhs} is a Smi or a HeapObject. 1043 // Check if the {lhs} is a Smi or a HeapObject.
1044 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler); 1044 Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler);
1045 assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi); 1045 assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi);
1046 1046
1047 assembler->Bind(&if_lhsissmi); 1047 assembler->Bind(&if_lhsissmi);
(...skipping 27 matching lines...) Expand all
1075 assembler->Goto(&end); 1075 assembler->Goto(&end);
1076 } 1076 }
1077 } 1077 }
1078 1078
1079 assembler->Bind(&if_rhsisnotsmi); 1079 assembler->Bind(&if_rhsisnotsmi);
1080 { 1080 {
1081 // Load the map of {rhs}. 1081 // Load the map of {rhs}.
1082 Node* rhs_map = assembler->LoadMap(rhs); 1082 Node* rhs_map = assembler->LoadMap(rhs);
1083 1083
1084 // Check if the {rhs} is a HeapNumber. 1084 // Check if the {rhs} is a HeapNumber.
1085 assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map), &do_add_any); 1085 assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
1086 &call_add_stub);
1086 1087
1087 var_fadd_lhs.Bind(assembler->SmiToFloat64(lhs)); 1088 var_fadd_lhs.Bind(assembler->SmiToFloat64(lhs));
1088 var_fadd_rhs.Bind(assembler->LoadHeapNumberValue(rhs)); 1089 var_fadd_rhs.Bind(assembler->LoadHeapNumberValue(rhs));
1089 assembler->Goto(&do_fadd); 1090 assembler->Goto(&do_fadd);
1090 } 1091 }
1091 } 1092 }
1092 1093
1093 assembler->Bind(&if_lhsisnotsmi); 1094 assembler->Bind(&if_lhsisnotsmi);
1094 { 1095 {
1095 Label check_string(assembler); 1096 Label check_string(assembler);
(...skipping 15 matching lines...) Expand all
1111 var_fadd_rhs.Bind(assembler->SmiToFloat64(rhs)); 1112 var_fadd_rhs.Bind(assembler->SmiToFloat64(rhs));
1112 assembler->Goto(&do_fadd); 1113 assembler->Goto(&do_fadd);
1113 } 1114 }
1114 1115
1115 assembler->Bind(&if_rhsisnotsmi); 1116 assembler->Bind(&if_rhsisnotsmi);
1116 { 1117 {
1117 // Load the map of {rhs}. 1118 // Load the map of {rhs}.
1118 Node* rhs_map = assembler->LoadMap(rhs); 1119 Node* rhs_map = assembler->LoadMap(rhs);
1119 1120
1120 // Check if the {rhs} is a HeapNumber. 1121 // Check if the {rhs} is a HeapNumber.
1121 assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map), &do_add_any); 1122 assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
1123 &call_add_stub);
1122 1124
1123 var_fadd_lhs.Bind(assembler->LoadHeapNumberValue(lhs)); 1125 var_fadd_lhs.Bind(assembler->LoadHeapNumberValue(lhs));
1124 var_fadd_rhs.Bind(assembler->LoadHeapNumberValue(rhs)); 1126 var_fadd_rhs.Bind(assembler->LoadHeapNumberValue(rhs));
1125 assembler->Goto(&do_fadd); 1127 assembler->Goto(&do_fadd);
1126 } 1128 }
1127 1129
1128 assembler->Bind(&check_string); 1130 assembler->Bind(&check_string);
1129 { 1131 {
1130 // Check if the {rhs} is a smi, and exit the string check early if it is. 1132 // Check if the {rhs} is a smi, and exit the string check early if it is.
1131 assembler->GotoIf(assembler->WordIsSmi(rhs), &do_add_any); 1133 assembler->GotoIf(assembler->WordIsSmi(rhs), &call_add_stub);
1132 1134
1133 Node* lhs_instance_type = assembler->LoadMapInstanceType(lhs_map); 1135 Node* lhs_instance_type = assembler->LoadMapInstanceType(lhs_map);
1134 1136
1135 // Exit unless {lhs} is a string 1137 // Exit unless {lhs} is a string
1136 assembler->GotoUnless(assembler->IsStringInstanceType(lhs_instance_type), 1138 assembler->GotoUnless(assembler->IsStringInstanceType(lhs_instance_type),
1137 &do_add_any); 1139 &call_add_stub);
1138 1140
1139 Node* rhs_instance_type = assembler->LoadInstanceType(rhs); 1141 Node* rhs_instance_type = assembler->LoadInstanceType(rhs);
1140 1142
1141 // Exit unless {rhs} is a string 1143 // Exit unless {rhs} is a string
1142 assembler->GotoUnless(assembler->IsStringInstanceType(rhs_instance_type), 1144 assembler->GotoUnless(assembler->IsStringInstanceType(rhs_instance_type),
1143 &do_add_any); 1145 &call_add_stub);
1144 1146
1145 var_type_feedback.Bind( 1147 var_type_feedback.Bind(
1146 assembler->Int32Constant(BinaryOperationFeedback::kString)); 1148 assembler->Int32Constant(BinaryOperationFeedback::kString));
1147 assembler->Goto(&call_add_stub); 1149 Callable callable = CodeFactory::StringAdd(
1150 assembler->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
1151 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs));
1152
1153 assembler->Goto(&end);
1148 } 1154 }
1149 } 1155 }
1150 1156
1151 assembler->Bind(&do_fadd); 1157 assembler->Bind(&do_fadd);
1152 { 1158 {
1153 var_type_feedback.Bind( 1159 var_type_feedback.Bind(
1154 assembler->Int32Constant(BinaryOperationFeedback::kNumber)); 1160 assembler->Int32Constant(BinaryOperationFeedback::kNumber));
1155 Node* value = 1161 Node* value =
1156 assembler->Float64Add(var_fadd_lhs.value(), var_fadd_rhs.value()); 1162 assembler->Float64Add(var_fadd_lhs.value(), var_fadd_rhs.value());
1157 Node* result = assembler->ChangeFloat64ToTagged(value); 1163 Node* result = assembler->ChangeFloat64ToTagged(value);
1158 var_result.Bind(result); 1164 var_result.Bind(result);
1159 assembler->Goto(&end); 1165 assembler->Goto(&end);
1160 } 1166 }
1161 1167
1162 assembler->Bind(&do_add_any);
1163 {
1164 var_type_feedback.Bind(
1165 assembler->Int32Constant(BinaryOperationFeedback::kAny));
1166 assembler->Goto(&call_add_stub);
1167 }
1168
1169 assembler->Bind(&call_add_stub); 1168 assembler->Bind(&call_add_stub);
1170 { 1169 {
1170 var_type_feedback.Bind(
1171 assembler->Int32Constant(BinaryOperationFeedback::kAny));
1171 Callable callable = CodeFactory::Add(assembler->isolate()); 1172 Callable callable = CodeFactory::Add(assembler->isolate());
1172 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs)); 1173 var_result.Bind(assembler->CallStub(callable, context, lhs, rhs));
1173 assembler->Goto(&end); 1174 assembler->Goto(&end);
1174 } 1175 }
1175 1176
1176 assembler->Bind(&end); 1177 assembler->Bind(&end);
1177 assembler->UpdateFeedback(var_type_feedback.value(), type_feedback_vector, 1178 assembler->UpdateFeedback(var_type_feedback.value(), type_feedback_vector,
1178 slot_id); 1179 slot_id);
1179 return var_result.value(); 1180 return var_result.value();
1180 } 1181 }
(...skipping 4665 matching lines...) Expand 10 before | Expand all | Expand 10 after
5846 5847
5847 if (type == MachineType::Pointer()) { 5848 if (type == MachineType::Pointer()) {
5848 return Representation::External(); 5849 return Representation::External();
5849 } 5850 }
5850 5851
5851 return Representation::Tagged(); 5852 return Representation::Tagged();
5852 } 5853 }
5853 5854
5854 } // namespace internal 5855 } // namespace internal
5855 } // namespace v8 5856 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698