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

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

Issue 141653015: Simplify HUnaryMathOperation::Canonicalize. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Moved forward declaration Created 6 years, 11 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
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 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); 1347 LDivI* result = new(zone()) LDivI(dividend, divisor, temp);
1348 return AssignEnvironment(DefineFixed(result, eax)); 1348 return AssignEnvironment(DefineFixed(result, eax));
1349 } else if (instr->representation().IsDouble()) { 1349 } else if (instr->representation().IsDouble()) {
1350 return DoArithmeticD(Token::DIV, instr); 1350 return DoArithmeticD(Token::DIV, instr);
1351 } else { 1351 } else {
1352 return DoArithmeticT(Token::DIV, instr); 1352 return DoArithmeticT(Token::DIV, instr);
1353 } 1353 }
1354 } 1354 }
1355 1355
1356 1356
1357 HValue* LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(HValue* divisor) {
1358 if (divisor->IsConstant() &&
1359 HConstant::cast(divisor)->HasInteger32Value()) {
1360 HConstant* constant_val = HConstant::cast(divisor);
1361 return constant_val->CopyToRepresentation(Representation::Integer32(),
1362 divisor->block()->zone());
1363 }
1364 // A value with an integer representation does not need to be transformed.
1365 if (divisor->representation().IsInteger32()) {
1366 return divisor;
1367 // A change from an integer32 can be replaced by the integer32 value.
1368 } else if (divisor->IsChange() &&
1369 HChange::cast(divisor)->from().IsInteger32()) {
1370 return HChange::cast(divisor)->value();
1371 }
1372 return NULL;
1373 }
1374
1375
1376 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { 1357 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1377 HValue* right = instr->right(); 1358 HValue* right = instr->right();
1378 if (!right->IsConstant()) { 1359 if (!right->IsConstant()) {
1379 ASSERT(right->representation().IsInteger32()); 1360 ASSERT(right->representation().IsInteger32());
1380 // The temporary operand is necessary to ensure that right is not allocated 1361 // The temporary operand is necessary to ensure that right is not allocated
1381 // into edx. 1362 // into edx.
1382 LOperand* temp = FixedTemp(edx); 1363 LOperand* temp = FixedTemp(edx);
1383 LOperand* dividend = UseFixed(instr->left(), eax); 1364 LOperand* dividend = UseFixed(instr->left(), eax);
1384 LOperand* divisor = UseRegister(instr->right()); 1365 LOperand* divisor = UseRegister(instr->right());
1385 LDivI* flooring_div = new(zone()) LDivI(dividend, divisor, temp); 1366 LDivI* flooring_div = new(zone()) LDivI(dividend, divisor, temp);
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2624 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2644 LOperand* object = UseRegister(instr->object()); 2625 LOperand* object = UseRegister(instr->object());
2645 LOperand* index = UseTempRegister(instr->index()); 2626 LOperand* index = UseTempRegister(instr->index());
2646 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2627 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2647 } 2628 }
2648 2629
2649 2630
2650 } } // namespace v8::internal 2631 } } // namespace v8::internal
2651 2632
2652 #endif // V8_TARGET_ARCH_IA32 2633 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698