| 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 chunk_->LookupLiteralRepresentation(op).IsSmi(); | 403 chunk_->LookupLiteralRepresentation(op).IsSmi(); |
| 404 } | 404 } |
| 405 | 405 |
| 406 | 406 |
| 407 bool LCodeGen::IsTaggedConstant(LConstantOperand* op) const { | 407 bool LCodeGen::IsTaggedConstant(LConstantOperand* op) const { |
| 408 return op->IsConstantOperand() && | 408 return op->IsConstantOperand() && |
| 409 chunk_->LookupLiteralRepresentation(op).IsTagged(); | 409 chunk_->LookupLiteralRepresentation(op).IsTagged(); |
| 410 } | 410 } |
| 411 | 411 |
| 412 | 412 |
| 413 int LCodeGen::ToInteger32(LConstantOperand* op) const { | 413 int32_t LCodeGen::ToInteger32(LConstantOperand* op) const { |
| 414 HConstant* constant = chunk_->LookupConstant(op); | 414 HConstant* constant = chunk_->LookupConstant(op); |
| 415 return constant->Integer32Value(); | 415 return constant->Integer32Value(); |
| 416 } | 416 } |
| 417 | 417 |
| 418 | 418 |
| 419 Smi* LCodeGen::ToSmi(LConstantOperand* op) const { | 419 Smi* LCodeGen::ToSmi(LConstantOperand* op) const { |
| 420 HConstant* constant = chunk_->LookupConstant(op); | 420 HConstant* constant = chunk_->LookupConstant(op); |
| 421 return Smi::FromInt(constant->Integer32Value()); | 421 return Smi::FromInt(constant->Integer32Value()); |
| 422 } | 422 } |
| 423 | 423 |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 __ shll(left, Immediate(4)); | 1292 __ shll(left, Immediate(4)); |
| 1293 break; | 1293 break; |
| 1294 default: | 1294 default: |
| 1295 __ imull(left, left, Immediate(right_value)); | 1295 __ imull(left, left, Immediate(right_value)); |
| 1296 break; | 1296 break; |
| 1297 } | 1297 } |
| 1298 } else { | 1298 } else { |
| 1299 __ imull(left, left, Immediate(right_value)); | 1299 __ imull(left, left, Immediate(right_value)); |
| 1300 } | 1300 } |
| 1301 } else if (right->IsStackSlot()) { | 1301 } else if (right->IsStackSlot()) { |
| 1302 __ imull(left, ToOperand(right)); | 1302 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1303 __ SmiToInteger32(left, left); |
| 1304 __ imul(left, ToOperand(right)); |
| 1305 } else { |
| 1306 __ imull(left, ToOperand(right)); |
| 1307 } |
| 1303 } else { | 1308 } else { |
| 1304 __ imull(left, ToRegister(right)); | 1309 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1310 __ SmiToInteger32(left, left); |
| 1311 __ imul(left, ToRegister(right)); |
| 1312 } else { |
| 1313 __ imull(left, ToRegister(right)); |
| 1314 } |
| 1305 } | 1315 } |
| 1306 | 1316 |
| 1307 if (can_overflow) { | 1317 if (can_overflow) { |
| 1308 DeoptimizeIf(overflow, instr->environment()); | 1318 DeoptimizeIf(overflow, instr->environment()); |
| 1309 } | 1319 } |
| 1310 | 1320 |
| 1311 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1321 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1312 // Bail out if the result is supposed to be negative zero. | 1322 // Bail out if the result is supposed to be negative zero. |
| 1313 Label done; | 1323 Label done; |
| 1314 __ testl(left, left); | 1324 __ testl(left, left); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 case Token::BIT_XOR: | 1361 case Token::BIT_XOR: |
| 1352 __ xorl(ToRegister(left), Immediate(right_operand)); | 1362 __ xorl(ToRegister(left), Immediate(right_operand)); |
| 1353 break; | 1363 break; |
| 1354 default: | 1364 default: |
| 1355 UNREACHABLE(); | 1365 UNREACHABLE(); |
| 1356 break; | 1366 break; |
| 1357 } | 1367 } |
| 1358 } else if (right->IsStackSlot()) { | 1368 } else if (right->IsStackSlot()) { |
| 1359 switch (instr->op()) { | 1369 switch (instr->op()) { |
| 1360 case Token::BIT_AND: | 1370 case Token::BIT_AND: |
| 1361 __ andl(ToRegister(left), ToOperand(right)); | 1371 __ and_(ToRegister(left), ToOperand(right)); |
| 1362 break; | 1372 break; |
| 1363 case Token::BIT_OR: | 1373 case Token::BIT_OR: |
| 1364 __ orl(ToRegister(left), ToOperand(right)); | 1374 __ or_(ToRegister(left), ToOperand(right)); |
| 1365 break; | 1375 break; |
| 1366 case Token::BIT_XOR: | 1376 case Token::BIT_XOR: |
| 1367 __ xorl(ToRegister(left), ToOperand(right)); | 1377 __ xor_(ToRegister(left), ToOperand(right)); |
| 1368 break; | 1378 break; |
| 1369 default: | 1379 default: |
| 1370 UNREACHABLE(); | 1380 UNREACHABLE(); |
| 1371 break; | 1381 break; |
| 1372 } | 1382 } |
| 1373 } else { | 1383 } else { |
| 1374 ASSERT(right->IsRegister()); | 1384 ASSERT(right->IsRegister()); |
| 1375 switch (instr->op()) { | 1385 switch (instr->op()) { |
| 1376 case Token::BIT_AND: | 1386 case Token::BIT_AND: |
| 1377 __ andl(ToRegister(left), ToRegister(right)); | 1387 __ and_(ToRegister(left), ToRegister(right)); |
| 1378 break; | 1388 break; |
| 1379 case Token::BIT_OR: | 1389 case Token::BIT_OR: |
| 1380 __ orl(ToRegister(left), ToRegister(right)); | 1390 __ or_(ToRegister(left), ToRegister(right)); |
| 1381 break; | 1391 break; |
| 1382 case Token::BIT_XOR: | 1392 case Token::BIT_XOR: |
| 1383 __ xorl(ToRegister(left), ToRegister(right)); | 1393 __ xor_(ToRegister(left), ToRegister(right)); |
| 1384 break; | 1394 break; |
| 1385 default: | 1395 default: |
| 1386 UNREACHABLE(); | 1396 UNREACHABLE(); |
| 1387 break; | 1397 break; |
| 1388 } | 1398 } |
| 1389 } | 1399 } |
| 1390 } | 1400 } |
| 1391 | 1401 |
| 1392 | 1402 |
| 1393 void LCodeGen::DoShiftI(LShiftI* instr) { | 1403 void LCodeGen::DoShiftI(LShiftI* instr) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 | 1466 |
| 1457 void LCodeGen::DoSubI(LSubI* instr) { | 1467 void LCodeGen::DoSubI(LSubI* instr) { |
| 1458 LOperand* left = instr->left(); | 1468 LOperand* left = instr->left(); |
| 1459 LOperand* right = instr->right(); | 1469 LOperand* right = instr->right(); |
| 1460 ASSERT(left->Equals(instr->result())); | 1470 ASSERT(left->Equals(instr->result())); |
| 1461 | 1471 |
| 1462 if (right->IsConstantOperand()) { | 1472 if (right->IsConstantOperand()) { |
| 1463 __ subl(ToRegister(left), | 1473 __ subl(ToRegister(left), |
| 1464 Immediate(ToInteger32(LConstantOperand::cast(right)))); | 1474 Immediate(ToInteger32(LConstantOperand::cast(right)))); |
| 1465 } else if (right->IsRegister()) { | 1475 } else if (right->IsRegister()) { |
| 1466 __ subl(ToRegister(left), ToRegister(right)); | 1476 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1477 __ subq(ToRegister(left), ToRegister(right)); |
| 1478 } else { |
| 1479 __ subl(ToRegister(left), ToRegister(right)); |
| 1480 } |
| 1467 } else { | 1481 } else { |
| 1468 __ subl(ToRegister(left), ToOperand(right)); | 1482 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1483 __ subq(ToRegister(left), ToOperand(right)); |
| 1484 } else { |
| 1485 __ subl(ToRegister(left), ToOperand(right)); |
| 1486 } |
| 1469 } | 1487 } |
| 1470 | 1488 |
| 1471 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1489 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 1472 DeoptimizeIf(overflow, instr->environment()); | 1490 DeoptimizeIf(overflow, instr->environment()); |
| 1473 } | 1491 } |
| 1474 } | 1492 } |
| 1475 | 1493 |
| 1476 | 1494 |
| 1477 void LCodeGen::DoConstantI(LConstantI* instr) { | 1495 void LCodeGen::DoConstantI(LConstantI* instr) { |
| 1478 __ Set(ToRegister(instr->result()), instr->value()); | 1496 __ Set(ToRegister(instr->result()), instr->value()); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1644 LOperand* left = instr->left(); | 1662 LOperand* left = instr->left(); |
| 1645 LOperand* right = instr->right(); | 1663 LOperand* right = instr->right(); |
| 1646 | 1664 |
| 1647 if (LAddI::UseLea(instr->hydrogen()) && !left->Equals(instr->result())) { | 1665 if (LAddI::UseLea(instr->hydrogen()) && !left->Equals(instr->result())) { |
| 1648 if (right->IsConstantOperand()) { | 1666 if (right->IsConstantOperand()) { |
| 1649 int32_t offset = ToInteger32(LConstantOperand::cast(right)); | 1667 int32_t offset = ToInteger32(LConstantOperand::cast(right)); |
| 1650 __ leal(ToRegister(instr->result()), | 1668 __ leal(ToRegister(instr->result()), |
| 1651 MemOperand(ToRegister(left), offset)); | 1669 MemOperand(ToRegister(left), offset)); |
| 1652 } else { | 1670 } else { |
| 1653 Operand address(ToRegister(left), ToRegister(right), times_1, 0); | 1671 Operand address(ToRegister(left), ToRegister(right), times_1, 0); |
| 1654 __ leal(ToRegister(instr->result()), address); | 1672 if (instr->hydrogen()->representation().IsSmi()) { |
| 1673 __ lea(ToRegister(instr->result()), address); |
| 1674 } else { |
| 1675 __ leal(ToRegister(instr->result()), address); |
| 1676 } |
| 1655 } | 1677 } |
| 1656 } else { | 1678 } else { |
| 1657 if (right->IsConstantOperand()) { | 1679 if (right->IsConstantOperand()) { |
| 1658 __ addl(ToRegister(left), | 1680 __ addl(ToRegister(left), |
| 1659 Immediate(ToInteger32(LConstantOperand::cast(right)))); | 1681 Immediate(ToInteger32(LConstantOperand::cast(right)))); |
| 1660 } else if (right->IsRegister()) { | 1682 } else if (right->IsRegister()) { |
| 1661 __ addl(ToRegister(left), ToRegister(right)); | 1683 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1684 __ addq(ToRegister(left), ToRegister(right)); |
| 1685 } else { |
| 1686 __ addl(ToRegister(left), ToRegister(right)); |
| 1687 } |
| 1662 } else { | 1688 } else { |
| 1663 __ addl(ToRegister(left), ToOperand(right)); | 1689 if (instr->hydrogen_value()->representation().IsSmi()) { |
| 1690 __ addq(ToRegister(left), ToOperand(right)); |
| 1691 } else { |
| 1692 __ addl(ToRegister(left), ToOperand(right)); |
| 1693 } |
| 1664 } | 1694 } |
| 1665 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { | 1695 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { |
| 1666 DeoptimizeIf(overflow, instr->environment()); | 1696 DeoptimizeIf(overflow, instr->environment()); |
| 1667 } | 1697 } |
| 1668 } | 1698 } |
| 1669 } | 1699 } |
| 1670 | 1700 |
| 1671 | 1701 |
| 1672 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { | 1702 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { |
| 1673 LOperand* left = instr->left(); | 1703 LOperand* left = instr->left(); |
| (...skipping 3862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5536 FixedArray::kHeaderSize - kPointerSize)); | 5566 FixedArray::kHeaderSize - kPointerSize)); |
| 5537 __ bind(&done); | 5567 __ bind(&done); |
| 5538 } | 5568 } |
| 5539 | 5569 |
| 5540 | 5570 |
| 5541 #undef __ | 5571 #undef __ |
| 5542 | 5572 |
| 5543 } } // namespace v8::internal | 5573 } } // namespace v8::internal |
| 5544 | 5574 |
| 5545 #endif // V8_TARGET_ARCH_X64 | 5575 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |