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

Side by Side Diff: src/x64/lithium-x64.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
« src/hydrogen-instructions.cc ('K') | « src/x64/lithium-x64.h ('k') | 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 // 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 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 LDivI* result = new(zone()) LDivI(dividend, divisor, temp); 1268 LDivI* result = new(zone()) LDivI(dividend, divisor, temp);
1269 return AssignEnvironment(DefineFixed(result, rax)); 1269 return AssignEnvironment(DefineFixed(result, rax));
1270 } else if (instr->representation().IsDouble()) { 1270 } else if (instr->representation().IsDouble()) {
1271 return DoArithmeticD(Token::DIV, instr); 1271 return DoArithmeticD(Token::DIV, instr);
1272 } else { 1272 } else {
1273 return DoArithmeticT(Token::DIV, instr); 1273 return DoArithmeticT(Token::DIV, instr);
1274 } 1274 }
1275 } 1275 }
1276 1276
1277 1277
1278 HValue* LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(HValue* divisor) {
1279 if (divisor->IsConstant() &&
1280 HConstant::cast(divisor)->HasInteger32Value()) {
1281 HConstant* constant_val = HConstant::cast(divisor);
1282 return constant_val->CopyToRepresentation(Representation::Integer32(),
1283 divisor->block()->zone());
1284 }
1285 // A value with an integer representation does not need to be transformed.
1286 if (divisor->representation().IsInteger32()) {
1287 return divisor;
1288 // A change from an integer32 can be replaced by the integer32 value.
1289 } else if (divisor->IsChange() &&
1290 HChange::cast(divisor)->from().IsInteger32()) {
1291 return HChange::cast(divisor)->value();
1292 }
1293 return NULL;
1294 }
1295
1296
1297 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { 1278 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) {
1298 HValue* right = instr->right(); 1279 HValue* right = instr->right();
1299 if (!right->IsConstant()) { 1280 if (!right->IsConstant()) {
1300 ASSERT(right->representation().IsInteger32()); 1281 ASSERT(right->representation().IsInteger32());
1301 // The temporary operand is necessary to ensure that right is not allocated 1282 // The temporary operand is necessary to ensure that right is not allocated
1302 // into rdx. 1283 // into rdx.
1303 LOperand* temp = FixedTemp(rdx); 1284 LOperand* temp = FixedTemp(rdx);
1304 LOperand* dividend = UseFixed(instr->left(), rax); 1285 LOperand* dividend = UseFixed(instr->left(), rax);
1305 LOperand* divisor = UseRegister(instr->right()); 1286 LOperand* divisor = UseRegister(instr->right());
1306 LDivI* flooring_div = new(zone()) LDivI(dividend, divisor, temp); 1287 LDivI* flooring_div = new(zone()) LDivI(dividend, divisor, temp);
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2489 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2470 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2490 LOperand* object = UseRegister(instr->object()); 2471 LOperand* object = UseRegister(instr->object());
2491 LOperand* index = UseTempRegister(instr->index()); 2472 LOperand* index = UseTempRegister(instr->index());
2492 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2473 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2493 } 2474 }
2494 2475
2495 2476
2496 } } // namespace v8::internal 2477 } } // namespace v8::internal
2497 2478
2498 #endif // V8_TARGET_ARCH_X64 2479 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/hydrogen-instructions.cc ('K') | « src/x64/lithium-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698