| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 DeoptimizeIf(not_zero, instr->environment()); | 1291 DeoptimizeIf(not_zero, instr->environment()); |
| 1292 } | 1292 } |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 | 1295 |
| 1296 void LCodeGen::DoMulI(LMulI* instr) { | 1296 void LCodeGen::DoMulI(LMulI* instr) { |
| 1297 Register left = ToRegister(instr->left()); | 1297 Register left = ToRegister(instr->left()); |
| 1298 LOperand* right = instr->right(); | 1298 LOperand* right = instr->right(); |
| 1299 | 1299 |
| 1300 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1300 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1301 __ movl(kScratchRegister, left); | 1301 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1302 __ movq(kScratchRegister, left); |
| 1303 } else { |
| 1304 __ movl(kScratchRegister, left); |
| 1305 } |
| 1302 } | 1306 } |
| 1303 | 1307 |
| 1304 bool can_overflow = | 1308 bool can_overflow = |
| 1305 instr->hydrogen()->CheckFlag(HValue::kCanOverflow); | 1309 instr->hydrogen()->CheckFlag(HValue::kCanOverflow); |
| 1306 if (right->IsConstantOperand()) { | 1310 if (right->IsConstantOperand()) { |
| 1307 int32_t right_value = ToInteger32(LConstantOperand::cast(right)); | 1311 int32_t right_value = ToInteger32(LConstantOperand::cast(right)); |
| 1308 if (right_value == -1) { | 1312 if (right_value == -1) { |
| 1309 __ negl(left); | 1313 __ negl(left); |
| 1310 } else if (right_value == 0) { | 1314 } else if (right_value == 0) { |
| 1311 __ xorl(left, left); | 1315 __ xorl(left, left); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1339 break; | 1343 break; |
| 1340 default: | 1344 default: |
| 1341 __ imull(left, left, Immediate(right_value)); | 1345 __ imull(left, left, Immediate(right_value)); |
| 1342 break; | 1346 break; |
| 1343 } | 1347 } |
| 1344 } else { | 1348 } else { |
| 1345 __ imull(left, left, Immediate(right_value)); | 1349 __ imull(left, left, Immediate(right_value)); |
| 1346 } | 1350 } |
| 1347 } else if (right->IsStackSlot()) { | 1351 } else if (right->IsStackSlot()) { |
| 1348 if (instr->hydrogen_value()->representation().IsSmi()) { | 1352 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1349 __ SmiToInteger32(left, left); | 1353 __ SmiToInteger64(left, left); |
| 1350 __ imul(left, ToOperand(right)); | 1354 __ imul(left, ToOperand(right)); |
| 1351 } else { | 1355 } else { |
| 1352 __ imull(left, ToOperand(right)); | 1356 __ imull(left, ToOperand(right)); |
| 1353 } | 1357 } |
| 1354 } else { | 1358 } else { |
| 1355 if (instr->hydrogen_value()->representation().IsSmi()) { | 1359 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1356 __ SmiToInteger32(left, left); | 1360 __ SmiToInteger64(left, left); |
| 1357 __ imul(left, ToRegister(right)); | 1361 __ imul(left, ToRegister(right)); |
| 1358 } else { | 1362 } else { |
| 1359 __ imull(left, ToRegister(right)); | 1363 __ imull(left, ToRegister(right)); |
| 1360 } | 1364 } |
| 1361 } | 1365 } |
| 1362 | 1366 |
| 1363 if (can_overflow) { | 1367 if (can_overflow) { |
| 1364 DeoptimizeIf(overflow, instr->environment()); | 1368 DeoptimizeIf(overflow, instr->environment()); |
| 1365 } | 1369 } |
| 1366 | 1370 |
| 1367 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1371 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1368 // Bail out if the result is supposed to be negative zero. | 1372 // Bail out if the result is supposed to be negative zero. |
| 1369 Label done; | 1373 Label done; |
| 1370 __ testl(left, left); | 1374 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1375 __ testq(left, left); |
| 1376 } else { |
| 1377 __ testl(left, left); |
| 1378 } |
| 1371 __ j(not_zero, &done, Label::kNear); | 1379 __ j(not_zero, &done, Label::kNear); |
| 1372 if (right->IsConstantOperand()) { | 1380 if (right->IsConstantOperand()) { |
| 1381 // Constant can't be represented as Smi due to immediate size limit. |
| 1382 ASSERT(!instr->hydrogen_value()->representation().IsSmi()); |
| 1373 if (ToInteger32(LConstantOperand::cast(right)) < 0) { | 1383 if (ToInteger32(LConstantOperand::cast(right)) < 0) { |
| 1374 DeoptimizeIf(no_condition, instr->environment()); | 1384 DeoptimizeIf(no_condition, instr->environment()); |
| 1375 } else if (ToInteger32(LConstantOperand::cast(right)) == 0) { | 1385 } else if (ToInteger32(LConstantOperand::cast(right)) == 0) { |
| 1376 __ cmpl(kScratchRegister, Immediate(0)); | 1386 __ cmpl(kScratchRegister, Immediate(0)); |
| 1377 DeoptimizeIf(less, instr->environment()); | 1387 DeoptimizeIf(less, instr->environment()); |
| 1378 } | 1388 } |
| 1379 } else if (right->IsStackSlot()) { | 1389 } else if (right->IsStackSlot()) { |
| 1380 __ orl(kScratchRegister, ToOperand(right)); | 1390 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1391 __ or_(kScratchRegister, ToOperand(right)); |
| 1392 } else { |
| 1393 __ orl(kScratchRegister, ToOperand(right)); |
| 1394 } |
| 1381 DeoptimizeIf(sign, instr->environment()); | 1395 DeoptimizeIf(sign, instr->environment()); |
| 1382 } else { | 1396 } else { |
| 1383 // Test the non-zero operand for negative sign. | 1397 // Test the non-zero operand for negative sign. |
| 1384 __ orl(kScratchRegister, ToRegister(right)); | 1398 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1399 __ or_(kScratchRegister, ToRegister(right)); |
| 1400 } else { |
| 1401 __ orl(kScratchRegister, ToRegister(right)); |
| 1402 } |
| 1385 DeoptimizeIf(sign, instr->environment()); | 1403 DeoptimizeIf(sign, instr->environment()); |
| 1386 } | 1404 } |
| 1387 __ bind(&done); | 1405 __ bind(&done); |
| 1388 } | 1406 } |
| 1389 } | 1407 } |
| 1390 | 1408 |
| 1391 | 1409 |
| 1392 void LCodeGen::DoBitI(LBitI* instr) { | 1410 void LCodeGen::DoBitI(LBitI* instr) { |
| 1393 LOperand* left = instr->left(); | 1411 LOperand* left = instr->left(); |
| 1394 LOperand* right = instr->right(); | 1412 LOperand* right = instr->right(); |
| (...skipping 4131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5526 FixedArray::kHeaderSize - kPointerSize)); | 5544 FixedArray::kHeaderSize - kPointerSize)); |
| 5527 __ bind(&done); | 5545 __ bind(&done); |
| 5528 } | 5546 } |
| 5529 | 5547 |
| 5530 | 5548 |
| 5531 #undef __ | 5549 #undef __ |
| 5532 | 5550 |
| 5533 } } // namespace v8::internal | 5551 } } // namespace v8::internal |
| 5534 | 5552 |
| 5535 #endif // V8_TARGET_ARCH_X64 | 5553 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |