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

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

Issue 148573005: A64: Synchronize with r16249. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('j') | 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 block->UpdateEnvironment(last_environment); 863 block->UpdateEnvironment(last_environment);
864 ASSERT(pred->argument_count() >= 0); 864 ASSERT(pred->argument_count() >= 0);
865 argument_count_ = pred->argument_count(); 865 argument_count_ = pred->argument_count();
866 } else { 866 } else {
867 // We are at a state join => process phis. 867 // We are at a state join => process phis.
868 HBasicBlock* pred = block->predecessors()->at(0); 868 HBasicBlock* pred = block->predecessors()->at(0);
869 // No need to copy the environment, it cannot be used later. 869 // No need to copy the environment, it cannot be used later.
870 HEnvironment* last_environment = pred->last_environment(); 870 HEnvironment* last_environment = pred->last_environment();
871 for (int i = 0; i < block->phis()->length(); ++i) { 871 for (int i = 0; i < block->phis()->length(); ++i) {
872 HPhi* phi = block->phis()->at(i); 872 HPhi* phi = block->phis()->at(i);
873 if (phi->merged_index() < last_environment->length()) { 873 if (phi->HasMergedIndex()) {
874 last_environment->SetValueAt(phi->merged_index(), phi); 874 last_environment->SetValueAt(phi->merged_index(), phi);
875 } 875 }
876 } 876 }
877 for (int i = 0; i < block->deleted_phis()->length(); ++i) { 877 for (int i = 0; i < block->deleted_phis()->length(); ++i) {
878 if (block->deleted_phis()->at(i) < last_environment->length()) { 878 if (block->deleted_phis()->at(i) < last_environment->length()) {
879 last_environment->SetValueAt(block->deleted_phis()->at(i), 879 last_environment->SetValueAt(block->deleted_phis()->at(i),
880 graph_->GetConstantUndefined()); 880 graph_->GetConstantUndefined());
881 } 881 }
882 } 882 }
883 block->UpdateEnvironment(last_environment); 883 block->UpdateEnvironment(last_environment);
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 } 1408 }
1409 1409
1410 1410
1411 LInstruction* LChunkBuilder::DoShl(HShl* instr) { 1411 LInstruction* LChunkBuilder::DoShl(HShl* instr) {
1412 return DoShift(Token::SHL, instr); 1412 return DoShift(Token::SHL, instr);
1413 } 1413 }
1414 1414
1415 1415
1416 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) { 1416 LInstruction* LChunkBuilder::DoBitwise(HBitwise* instr) {
1417 if (instr->representation().IsSmiOrInteger32()) { 1417 if (instr->representation().IsSmiOrInteger32()) {
1418 ASSERT(instr->left()->representation().IsSmiOrInteger32()); 1418 ASSERT(instr->left()->representation().Equals(instr->representation()));
1419 ASSERT(instr->right()->representation().Equals( 1419 ASSERT(instr->right()->representation().Equals(instr->representation()));
1420 instr->left()->representation()));
1421 1420
1422 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); 1421 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1423 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand()); 1422 LOperand* right = UseOrConstantAtStart(instr->BetterRightOperand());
1424 return DefineSameAsFirst(new(zone()) LBitI(left, right)); 1423 return DefineSameAsFirst(new(zone()) LBitI(left, right));
1425 } else { 1424 } else {
1426 ASSERT(instr->representation().IsSmiOrTagged()); 1425 ASSERT(instr->representation().IsSmiOrTagged());
1427 ASSERT(instr->left()->representation().IsSmiOrTagged()); 1426 ASSERT(instr->left()->representation().IsSmiOrTagged());
1428 ASSERT(instr->right()->representation().IsSmiOrTagged()); 1427 ASSERT(instr->right()->representation().IsSmiOrTagged());
1429 1428
1430 LOperand* context = UseFixed(instr->context(), esi); 1429 LOperand* context = UseFixed(instr->context(), esi);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 new(zone()) LMathFloorOfDiv(dividend, divisor, temp), edx); 1517 new(zone()) LMathFloorOfDiv(dividend, divisor, temp), edx);
1519 return divisor_si < 0 ? AssignEnvironment(result) : result; 1518 return divisor_si < 0 ? AssignEnvironment(result) : result;
1520 } 1519 }
1521 } 1520 }
1522 1521
1523 1522
1524 LInstruction* LChunkBuilder::DoMod(HMod* instr) { 1523 LInstruction* LChunkBuilder::DoMod(HMod* instr) {
1525 HValue* left = instr->left(); 1524 HValue* left = instr->left();
1526 HValue* right = instr->right(); 1525 HValue* right = instr->right();
1527 if (instr->representation().IsSmiOrInteger32()) { 1526 if (instr->representation().IsSmiOrInteger32()) {
1528 ASSERT(left->representation().IsSmiOrInteger32()); 1527 ASSERT(instr->left()->representation().Equals(instr->representation()));
1529 ASSERT(right->representation().Equals(left->representation())); 1528 ASSERT(instr->right()->representation().Equals(instr->representation()));
1530 1529
1531 if (instr->HasPowerOf2Divisor()) { 1530 if (instr->HasPowerOf2Divisor()) {
1532 ASSERT(!right->CanBeZero()); 1531 ASSERT(!right->CanBeZero());
1533 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), 1532 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left),
1534 UseOrConstant(right), 1533 UseOrConstant(right),
1535 NULL); 1534 NULL);
1536 LInstruction* result = DefineSameAsFirst(mod); 1535 LInstruction* result = DefineSameAsFirst(mod);
1537 return (left->CanBeNegative() && 1536 return (left->CanBeNegative() &&
1538 instr->CheckFlag(HValue::kBailoutOnMinusZero)) 1537 instr->CheckFlag(HValue::kBailoutOnMinusZero))
1539 ? AssignEnvironment(result) 1538 ? AssignEnvironment(result)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 return DoArithmeticD(Token::MUL, instr); 1594 return DoArithmeticD(Token::MUL, instr);
1596 } else { 1595 } else {
1597 ASSERT(instr->representation().IsTagged()); 1596 ASSERT(instr->representation().IsTagged());
1598 return DoArithmeticT(Token::MUL, instr); 1597 return DoArithmeticT(Token::MUL, instr);
1599 } 1598 }
1600 } 1599 }
1601 1600
1602 1601
1603 LInstruction* LChunkBuilder::DoSub(HSub* instr) { 1602 LInstruction* LChunkBuilder::DoSub(HSub* instr) {
1604 if (instr->representation().IsSmiOrInteger32()) { 1603 if (instr->representation().IsSmiOrInteger32()) {
1605 ASSERT(instr->left()->representation().IsSmiOrInteger32()); 1604 ASSERT(instr->left()->representation().Equals(instr->representation()));
1606 ASSERT(instr->right()->representation().Equals( 1605 ASSERT(instr->right()->representation().Equals(instr->representation()));
1607 instr->left()->representation()));
1608 LOperand* left = UseRegisterAtStart(instr->left()); 1606 LOperand* left = UseRegisterAtStart(instr->left());
1609 LOperand* right = UseOrConstantAtStart(instr->right()); 1607 LOperand* right = UseOrConstantAtStart(instr->right());
1610 LSubI* sub = new(zone()) LSubI(left, right); 1608 LSubI* sub = new(zone()) LSubI(left, right);
1611 LInstruction* result = DefineSameAsFirst(sub); 1609 LInstruction* result = DefineSameAsFirst(sub);
1612 if (instr->CheckFlag(HValue::kCanOverflow)) { 1610 if (instr->CheckFlag(HValue::kCanOverflow)) {
1613 result = AssignEnvironment(result); 1611 result = AssignEnvironment(result);
1614 } 1612 }
1615 return result; 1613 return result;
1616 } else if (instr->representation().IsDouble()) { 1614 } else if (instr->representation().IsDouble()) {
1617 return DoArithmeticD(Token::SUB, instr); 1615 return DoArithmeticD(Token::SUB, instr);
1618 } else { 1616 } else {
1619 ASSERT(instr->representation().IsSmiOrTagged()); 1617 ASSERT(instr->representation().IsSmiOrTagged());
1620 return DoArithmeticT(Token::SUB, instr); 1618 return DoArithmeticT(Token::SUB, instr);
1621 } 1619 }
1622 } 1620 }
1623 1621
1624 1622
1625 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) { 1623 LInstruction* LChunkBuilder::DoAdd(HAdd* instr) {
1626 if (instr->representation().IsSmiOrInteger32()) { 1624 if (instr->representation().IsSmiOrInteger32()) {
1627 ASSERT(instr->left()->representation().IsSmiOrInteger32()); 1625 ASSERT(instr->left()->representation().Equals(instr->representation()));
1628 ASSERT(instr->right()->representation().Equals( 1626 ASSERT(instr->right()->representation().Equals(instr->representation()));
1629 instr->left()->representation()));
1630 // Check to see if it would be advantageous to use an lea instruction rather 1627 // Check to see if it would be advantageous to use an lea instruction rather
1631 // than an add. This is the case when no overflow check is needed and there 1628 // than an add. This is the case when no overflow check is needed and there
1632 // are multiple uses of the add's inputs, so using a 3-register add will 1629 // are multiple uses of the add's inputs, so using a 3-register add will
1633 // preserve all input values for later uses. 1630 // preserve all input values for later uses.
1634 bool use_lea = LAddI::UseLea(instr); 1631 bool use_lea = LAddI::UseLea(instr);
1635 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand()); 1632 LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
1636 HValue* right_candidate = instr->BetterRightOperand(); 1633 HValue* right_candidate = instr->BetterRightOperand();
1637 LOperand* right = use_lea 1634 LOperand* right = use_lea
1638 ? UseRegisterOrConstantAtStart(right_candidate) 1635 ? UseRegisterOrConstantAtStart(right_candidate)
1639 : UseOrConstantAtStart(right_candidate); 1636 : UseOrConstantAtStart(right_candidate);
(...skipping 12 matching lines...) Expand all
1652 ASSERT(instr->representation().IsSmiOrTagged()); 1649 ASSERT(instr->representation().IsSmiOrTagged());
1653 return DoArithmeticT(Token::ADD, instr); 1650 return DoArithmeticT(Token::ADD, instr);
1654 } 1651 }
1655 } 1652 }
1656 1653
1657 1654
1658 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) { 1655 LInstruction* LChunkBuilder::DoMathMinMax(HMathMinMax* instr) {
1659 LOperand* left = NULL; 1656 LOperand* left = NULL;
1660 LOperand* right = NULL; 1657 LOperand* right = NULL;
1661 if (instr->representation().IsSmiOrInteger32()) { 1658 if (instr->representation().IsSmiOrInteger32()) {
1662 ASSERT(instr->left()->representation().IsSmiOrInteger32()); 1659 ASSERT(instr->left()->representation().Equals(instr->representation()));
1663 ASSERT(instr->right()->representation().Equals( 1660 ASSERT(instr->right()->representation().Equals(instr->representation()));
1664 instr->left()->representation()));
1665 left = UseRegisterAtStart(instr->BetterLeftOperand()); 1661 left = UseRegisterAtStart(instr->BetterLeftOperand());
1666 right = UseOrConstantAtStart(instr->BetterRightOperand()); 1662 right = UseOrConstantAtStart(instr->BetterRightOperand());
1667 } else { 1663 } else {
1668 ASSERT(instr->representation().IsDouble()); 1664 ASSERT(instr->representation().IsDouble());
1669 ASSERT(instr->left()->representation().IsDouble()); 1665 ASSERT(instr->left()->representation().IsDouble());
1670 ASSERT(instr->right()->representation().IsDouble()); 1666 ASSERT(instr->right()->representation().IsDouble());
1671 left = UseRegisterAtStart(instr->left()); 1667 left = UseRegisterAtStart(instr->left());
1672 right = UseRegisterAtStart(instr->right()); 1668 right = UseRegisterAtStart(instr->right());
1673 } 1669 }
1674 LMathMinMax* minmax = new(zone()) LMathMinMax(left, right); 1670 LMathMinMax* minmax = new(zone()) LMathMinMax(left, right);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 LOperand* right = UseFixed(instr->right(), eax); 1705 LOperand* right = UseFixed(instr->right(), eax);
1710 LCmpT* result = new(zone()) LCmpT(context, left, right); 1706 LCmpT* result = new(zone()) LCmpT(context, left, right);
1711 return MarkAsCall(DefineFixed(result, eax), instr); 1707 return MarkAsCall(DefineFixed(result, eax), instr);
1712 } 1708 }
1713 1709
1714 1710
1715 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( 1711 LInstruction* LChunkBuilder::DoCompareNumericAndBranch(
1716 HCompareNumericAndBranch* instr) { 1712 HCompareNumericAndBranch* instr) {
1717 Representation r = instr->representation(); 1713 Representation r = instr->representation();
1718 if (r.IsSmiOrInteger32()) { 1714 if (r.IsSmiOrInteger32()) {
1719 ASSERT(instr->left()->representation().IsSmiOrInteger32()); 1715 ASSERT(instr->left()->representation().Equals(r));
1720 ASSERT(instr->left()->representation().Equals( 1716 ASSERT(instr->right()->representation().Equals(r));
1721 instr->right()->representation()));
1722 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); 1717 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
1723 LOperand* right = UseOrConstantAtStart(instr->right()); 1718 LOperand* right = UseOrConstantAtStart(instr->right());
1724 return new(zone()) LCompareNumericAndBranch(left, right); 1719 return new(zone()) LCompareNumericAndBranch(left, right);
1725 } else { 1720 } else {
1726 ASSERT(r.IsDouble()); 1721 ASSERT(r.IsDouble());
1727 ASSERT(instr->left()->representation().IsDouble()); 1722 ASSERT(instr->left()->representation().IsDouble());
1728 ASSERT(instr->right()->representation().IsDouble()); 1723 ASSERT(instr->right()->representation().IsDouble());
1729 LOperand* left; 1724 LOperand* left;
1730 LOperand* right; 1725 LOperand* right;
1731 if (instr->left()->IsConstant() && instr->right()->IsConstant()) { 1726 if (instr->left()->IsConstant() && instr->right()->IsConstant()) {
1732 left = UseRegisterOrConstantAtStart(instr->left()); 1727 left = UseRegisterOrConstantAtStart(instr->left());
1733 right = UseRegisterOrConstantAtStart(instr->right()); 1728 right = UseRegisterOrConstantAtStart(instr->right());
1734 } else { 1729 } else {
1735 left = UseRegisterAtStart(instr->left()); 1730 left = UseRegisterAtStart(instr->left());
1736 right = UseRegisterAtStart(instr->right()); 1731 right = UseRegisterAtStart(instr->right());
1737 } 1732 }
1738 return new(zone()) LCompareNumericAndBranch(left, right); 1733 return new(zone()) LCompareNumericAndBranch(left, right);
1739 } 1734 }
1740 } 1735 }
1741 1736
1742 1737
1743 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( 1738 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch(
1744 HCompareObjectEqAndBranch* instr) { 1739 HCompareObjectEqAndBranch* instr) {
1745 LOperand* left = UseRegisterAtStart(instr->left()); 1740 LOperand* left = UseRegisterAtStart(instr->left());
1746 LOperand* right = UseOrConstantAtStart(instr->right()); 1741 LOperand* right = UseOrConstantAtStart(instr->right());
1747 return new(zone()) LCmpObjectEqAndBranch(left, right); 1742 return new(zone()) LCmpObjectEqAndBranch(left, right);
1748 } 1743 }
1749 1744
1750 1745
1746 LInstruction* LChunkBuilder::DoCompareHoleAndBranch(
1747 HCompareHoleAndBranch* instr) {
1748 LOperand* object = UseRegisterAtStart(instr->object());
1749 return new(zone()) LCmpHoleAndBranch(object);
1750 }
1751
1752
1751 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { 1753 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1752 ASSERT(instr->value()->representation().IsSmiOrTagged()); 1754 ASSERT(instr->value()->representation().IsSmiOrTagged());
1753 LOperand* temp = TempRegister(); 1755 LOperand* temp = TempRegister();
1754 return new(zone()) LIsObjectAndBranch(UseRegister(instr->value()), temp); 1756 return new(zone()) LIsObjectAndBranch(UseRegister(instr->value()), temp);
1755 } 1757 }
1756 1758
1757 1759
1758 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { 1760 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1759 ASSERT(instr->value()->representation().IsTagged()); 1761 ASSERT(instr->value()->representation().IsTagged());
1760 LOperand* temp = TempRegister(); 1762 LOperand* temp = TempRegister();
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 2200
2199 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { 2201 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2200 LOperand* obj = (instr->access().IsExternalMemory() && 2202 LOperand* obj = (instr->access().IsExternalMemory() &&
2201 instr->access().offset() == 0) 2203 instr->access().offset() == 0)
2202 ? UseRegisterOrConstantAtStart(instr->object()) 2204 ? UseRegisterOrConstantAtStart(instr->object())
2203 : UseRegisterAtStart(instr->object()); 2205 : UseRegisterAtStart(instr->object());
2204 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); 2206 return DefineAsRegister(new(zone()) LLoadNamedField(obj));
2205 } 2207 }
2206 2208
2207 2209
2208 LInstruction* LChunkBuilder::DoLoadNamedFieldPolymorphic(
2209 HLoadNamedFieldPolymorphic* instr) {
2210 ASSERT(instr->representation().IsTagged());
2211 if (instr->need_generic()) {
2212 LOperand* context = UseFixed(instr->context(), esi);
2213 LOperand* obj = UseFixed(instr->object(), edx);
2214 LLoadNamedFieldPolymorphic* result =
2215 new(zone()) LLoadNamedFieldPolymorphic(context, obj);
2216 return MarkAsCall(DefineFixed(result, eax), instr);
2217 } else {
2218 LOperand* context = UseAny(instr->context()); // Not actually used.
2219 LOperand* obj = UseRegisterAtStart(instr->object());
2220 LLoadNamedFieldPolymorphic* result =
2221 new(zone()) LLoadNamedFieldPolymorphic(context, obj);
2222 return AssignEnvironment(DefineAsRegister(result));
2223 }
2224 }
2225
2226
2227 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { 2210 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
2228 LOperand* context = UseFixed(instr->context(), esi); 2211 LOperand* context = UseFixed(instr->context(), esi);
2229 LOperand* object = UseFixed(instr->object(), edx); 2212 LOperand* object = UseFixed(instr->object(), edx);
2230 LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(context, object); 2213 LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric(context, object);
2231 return MarkAsCall(DefineFixed(result, eax), instr); 2214 return MarkAsCall(DefineFixed(result, eax), instr);
2232 } 2215 }
2233 2216
2234 2217
2235 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( 2218 LInstruction* LChunkBuilder::DoLoadFunctionPrototype(
2236 HLoadFunctionPrototype* instr) { 2219 HLoadFunctionPrototype* instr) {
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
2750 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2733 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2751 LOperand* object = UseRegister(instr->object()); 2734 LOperand* object = UseRegister(instr->object());
2752 LOperand* index = UseTempRegister(instr->index()); 2735 LOperand* index = UseTempRegister(instr->index());
2753 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2736 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2754 } 2737 }
2755 2738
2756 2739
2757 } } // namespace v8::internal 2740 } } // namespace v8::internal
2758 2741
2759 #endif // V8_TARGET_ARCH_IA32 2742 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698