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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 6730029: [v8-dev] Improve code generation for DoAddI, DoSubI and DoBitI when the right hand... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
« 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 } 1078 }
1079 } 1079 }
1080 1080
1081 1081
1082 void LCodeGen::DoBitI(LBitI* instr) { 1082 void LCodeGen::DoBitI(LBitI* instr) {
1083 LOperand* left = instr->InputAt(0); 1083 LOperand* left = instr->InputAt(0);
1084 LOperand* right = instr->InputAt(1); 1084 LOperand* right = instr->InputAt(1);
1085 ASSERT(left->Equals(instr->result())); 1085 ASSERT(left->Equals(instr->result()));
1086 ASSERT(left->IsRegister()); 1086 ASSERT(left->IsRegister());
1087 Register result = ToRegister(left); 1087 Register result = ToRegister(left);
1088 Register right_reg = EmitLoadRegister(right, ip); 1088 Operand right_operand(no_reg);
1089
1090 if (right->IsStackSlot() || right->IsArgument()) {
1091 Register right_reg = EmitLoadRegister(right, ip);
1092 right_operand = Operand(right_reg);
1093 } else {
1094 ASSERT(right->IsRegister() || right->IsConstantOperand());
1095 right_operand = ToOperand(right);
1096 }
1097
1089 switch (instr->op()) { 1098 switch (instr->op()) {
1090 case Token::BIT_AND: 1099 case Token::BIT_AND:
1091 __ and_(result, ToRegister(left), Operand(right_reg)); 1100 __ and_(result, ToRegister(left), right_operand);
1092 break; 1101 break;
1093 case Token::BIT_OR: 1102 case Token::BIT_OR:
1094 __ orr(result, ToRegister(left), Operand(right_reg)); 1103 __ orr(result, ToRegister(left), right_operand);
1095 break; 1104 break;
1096 case Token::BIT_XOR: 1105 case Token::BIT_XOR:
1097 __ eor(result, ToRegister(left), Operand(right_reg)); 1106 __ eor(result, ToRegister(left), right_operand);
1098 break; 1107 break;
1099 default: 1108 default:
1100 UNREACHABLE(); 1109 UNREACHABLE();
1101 break; 1110 break;
1102 } 1111 }
1103 } 1112 }
1104 1113
1105 1114
1106 void LCodeGen::DoShiftI(LShiftI* instr) { 1115 void LCodeGen::DoShiftI(LShiftI* instr) {
1107 Register scratch = scratch0(); 1116 Register scratch = scratch0();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 break; 1165 break;
1157 default: 1166 default:
1158 UNREACHABLE(); 1167 UNREACHABLE();
1159 break; 1168 break;
1160 } 1169 }
1161 } 1170 }
1162 } 1171 }
1163 1172
1164 1173
1165 void LCodeGen::DoSubI(LSubI* instr) { 1174 void LCodeGen::DoSubI(LSubI* instr) {
1166 Register left = ToRegister(instr->InputAt(0)); 1175 LOperand* left = instr->InputAt(0);
1167 Register right = EmitLoadRegister(instr->InputAt(1), ip); 1176 LOperand* right = instr->InputAt(1);
1168 ASSERT(instr->InputAt(0)->Equals(instr->result())); 1177 ASSERT(left->Equals(instr->result()));
1169 __ sub(left, left, right, SetCC); 1178 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
Søren Thygesen Gjesse 2011/03/24 20:32:24 Can't we just use SetCC always?
Rodolph Perfetta 2011/03/25 00:23:09 We could, but on modern cores, setting the flags w
Søren Thygesen Gjesse 2011/03/25 07:42:23 No, I am fine with that - I just wanted to know th
1170 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { 1179 SBit set_cond = can_overflow ? SetCC : LeaveCC;
1180
1181 if (right->IsStackSlot() || right->IsArgument()) {
1182 Register right_reg = EmitLoadRegister(right, ip);
1183 __ sub(ToRegister(left), ToRegister(left), Operand(right_reg), set_cond);
1184 } else {
1185 ASSERT(right->IsRegister() || right->IsConstantOperand());
1186 __ sub(ToRegister(left), ToRegister(left), ToOperand(right), set_cond);
1187 }
1188
1189 if (can_overflow) {
1171 DeoptimizeIf(vs, instr->environment()); 1190 DeoptimizeIf(vs, instr->environment());
1172 } 1191 }
1173 } 1192 }
1174 1193
1175 1194
1176 void LCodeGen::DoConstantI(LConstantI* instr) { 1195 void LCodeGen::DoConstantI(LConstantI* instr) {
1177 ASSERT(instr->result()->IsRegister()); 1196 ASSERT(instr->result()->IsRegister());
1178 __ mov(ToRegister(instr->result()), Operand(instr->value())); 1197 __ mov(ToRegister(instr->result()), Operand(instr->value()));
1179 } 1198 }
1180 1199
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 if (FLAG_debug_code) { 1268 if (FLAG_debug_code) {
1250 __ stop("Unreachable code."); 1269 __ stop("Unreachable code.");
1251 } 1270 }
1252 } 1271 }
1253 1272
1254 1273
1255 void LCodeGen::DoAddI(LAddI* instr) { 1274 void LCodeGen::DoAddI(LAddI* instr) {
1256 LOperand* left = instr->InputAt(0); 1275 LOperand* left = instr->InputAt(0);
1257 LOperand* right = instr->InputAt(1); 1276 LOperand* right = instr->InputAt(1);
1258 ASSERT(left->Equals(instr->result())); 1277 ASSERT(left->Equals(instr->result()));
1278 bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow);
Søren Thygesen Gjesse 2011/03/24 20:32:24 Ditto.
Rodolph Perfetta 2011/03/25 00:23:09 see previous answer.
1279 SBit set_cond = can_overflow ? SetCC : LeaveCC;
1259 1280
1260 Register right_reg = EmitLoadRegister(right, ip); 1281 if (right->IsStackSlot() || right->IsArgument()) {
1261 __ add(ToRegister(left), ToRegister(left), Operand(right_reg), SetCC); 1282 Register right_reg = EmitLoadRegister(right, ip);
1283 __ add(ToRegister(left), ToRegister(left), Operand(right_reg), set_cond);
1284 } else {
1285 ASSERT(right->IsRegister() || right->IsConstantOperand());
1286 __ add(ToRegister(left), ToRegister(left), ToOperand(right), set_cond);
1287 }
1262 1288
1263 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { 1289 if (can_overflow) {
1264 DeoptimizeIf(vs, instr->environment()); 1290 DeoptimizeIf(vs, instr->environment());
1265 } 1291 }
1266 } 1292 }
1267 1293
1268 1294
1269 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { 1295 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
1270 DoubleRegister left = ToDoubleRegister(instr->InputAt(0)); 1296 DoubleRegister left = ToDoubleRegister(instr->InputAt(0));
1271 DoubleRegister right = ToDoubleRegister(instr->InputAt(1)); 1297 DoubleRegister right = ToDoubleRegister(instr->InputAt(1));
1272 switch (instr->op()) { 1298 switch (instr->op()) {
1273 case Token::ADD: 1299 case Token::ADD:
(...skipping 2794 matching lines...) Expand 10 before | Expand all | Expand 10 after
4068 ASSERT(!environment->HasBeenRegistered()); 4094 ASSERT(!environment->HasBeenRegistered());
4069 RegisterEnvironmentForDeoptimization(environment); 4095 RegisterEnvironmentForDeoptimization(environment);
4070 ASSERT(osr_pc_offset_ == -1); 4096 ASSERT(osr_pc_offset_ == -1);
4071 osr_pc_offset_ = masm()->pc_offset(); 4097 osr_pc_offset_ = masm()->pc_offset();
4072 } 4098 }
4073 4099
4074 4100
4075 #undef __ 4101 #undef __
4076 4102
4077 } } // namespace v8::internal 4103 } } // namespace v8::internal
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