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

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

Issue 11316105: ARM: Use division instructions in lithium and stubs (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 // A change from an integer32 can be replaced by the integer32 value. 1219 // A change from an integer32 can be replaced by the integer32 value.
1220 } else if (dividend->IsChange() && 1220 } else if (dividend->IsChange() &&
1221 HChange::cast(dividend)->from().IsInteger32()) { 1221 HChange::cast(dividend)->from().IsInteger32()) {
1222 return HChange::cast(dividend)->value(); 1222 return HChange::cast(dividend)->value();
1223 } 1223 }
1224 return NULL; 1224 return NULL;
1225 } 1225 }
1226 1226
1227 1227
1228 HValue* LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(HValue* divisor) { 1228 HValue* LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(HValue* divisor) {
1229 // Only optimize when we have magic numbers for the divisor. 1229 if (CpuFeatures::IsSupported(SUDIV)) {
1230 // The standard integer division routine is usually slower than transitionning 1230 // A value with an integer representation does not need to be transformed.
1231 // to VFP. 1231 if (divisor->representation().IsInteger32()) {
1232 if (divisor->IsConstant() && 1232 return divisor;
1233 HConstant::cast(divisor)->HasInteger32Value()) { 1233 // A change from an integer32 can be replaced by the integer32 value.
1234 } else if (divisor->IsChange() &&
1235 HChange::cast(divisor)->from().IsInteger32()) {
1236 return HChange::cast(divisor)->value();
1237 }
1238 }
1239
1240 if (divisor->IsConstant() && HConstant::cast(divisor)->HasInteger32Value()) {
1234 HConstant* constant_val = HConstant::cast(divisor); 1241 HConstant* constant_val = HConstant::cast(divisor);
1235 int32_t int32_val = constant_val->Integer32Value(); 1242 int32_t int32_val = constant_val->Integer32Value();
1236 if (LChunkBuilder::HasMagicNumberForDivisor(int32_val)) { 1243 if (LChunkBuilder::HasMagicNumberForDivisor(int32_val) ||
1244 CpuFeatures::IsSupported(SUDIV)) {
1237 return constant_val->CopyToRepresentation(Representation::Integer32(), 1245 return constant_val->CopyToRepresentation(Representation::Integer32(),
1238 divisor->block()->zone()); 1246 divisor->block()->zone());
1239 } 1247 }
1240 } 1248 }
1249
1241 return NULL; 1250 return NULL;
1242 } 1251 }
1243 1252
1244 1253
1245 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { 1254 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1246 HValue* right = instr->right(); 1255 HValue* right = instr->right();
1247 LOperand* dividend = UseRegister(instr->left()); 1256 LOperand* dividend = UseRegister(instr->left());
1248 LOperand* divisor = UseRegisterOrConstant(right); 1257 LOperand* divisor = UseRegisterOrConstant(right);
1249 LOperand* remainder = TempRegister(); 1258 LOperand* remainder = TempRegister();
1250 ASSERT(right->IsConstant() && 1259 ASSERT(CpuFeatures::IsSupported(SUDIV) ||
1251 HConstant::cast(right)->HasInteger32Value() && 1260 (right->IsConstant() &&
1252 HasMagicNumberForDivisor(HConstant::cast(right)->Integer32Value())); 1261 HConstant::cast(right)->HasInteger32Value() &&
1253 return AssignEnvironment(DefineAsRegister( 1262 HasMagicNumberForDivisor(HConstant::cast(right)->Integer32Value())));
1263 return AssignEnvironment(DefineAsRegister(
1254 new(zone()) LMathFloorOfDiv(dividend, divisor, remainder))); 1264 new(zone()) LMathFloorOfDiv(dividend, divisor, remainder)));
1255 } 1265 }
1256 1266
1257 1267
1258 LInstruction* LChunkBuilder::DoMod(HMod* instr) { 1268 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1259 if (instr->representation().IsInteger32()) { 1269 if (instr->representation().IsInteger32()) {
1260 ASSERT(instr->left()->representation().IsInteger32()); 1270 ASSERT(instr->left()->representation().IsInteger32());
1261 ASSERT(instr->right()->representation().IsInteger32()); 1271 ASSERT(instr->right()->representation().IsInteger32());
1262 1272
1263 LModI* mod; 1273 LModI* mod;
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
2341 2351
2342 2352
2343 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2353 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2344 LOperand* object = UseRegister(instr->object()); 2354 LOperand* object = UseRegister(instr->object());
2345 LOperand* index = UseRegister(instr->index()); 2355 LOperand* index = UseRegister(instr->index());
2346 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); 2356 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index));
2347 } 2357 }
2348 2358
2349 2359
2350 } } // namespace v8::internal 2360 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698