| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
| 8 | 8 |
| 9 #include "lithium-allocator-inl.h" | 9 #include "lithium-allocator-inl.h" |
| 10 #include "x87/lithium-x87.h" | 10 #include "x87/lithium-x87.h" |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 LDummyUse(UseAny(current->OperandAt(0)))); | 861 LDummyUse(UseAny(current->OperandAt(0)))); |
| 862 } | 862 } |
| 863 for (int i = 1; i < current->OperandCount(); ++i) { | 863 for (int i = 1; i < current->OperandCount(); ++i) { |
| 864 if (current->OperandAt(i)->IsControlInstruction()) continue; | 864 if (current->OperandAt(i)->IsControlInstruction()) continue; |
| 865 LInstruction* dummy = | 865 LInstruction* dummy = |
| 866 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); | 866 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); |
| 867 dummy->set_hydrogen_value(current); | 867 dummy->set_hydrogen_value(current); |
| 868 chunk_->AddInstruction(dummy, current_block_); | 868 chunk_->AddInstruction(dummy, current_block_); |
| 869 } | 869 } |
| 870 } else { | 870 } else { |
| 871 instr = current->CompileToLithium(this); | 871 HBasicBlock* successor; |
| 872 if (current->IsControlInstruction() && |
| 873 HControlInstruction::cast(current)->KnownSuccessorBlock(&successor) && |
| 874 successor != NULL) { |
| 875 instr = new(zone()) LGoto(successor); |
| 876 } else { |
| 877 instr = current->CompileToLithium(this); |
| 878 } |
| 872 } | 879 } |
| 873 | 880 |
| 874 argument_count_ += current->argument_delta(); | 881 argument_count_ += current->argument_delta(); |
| 875 ASSERT(argument_count_ >= 0); | 882 ASSERT(argument_count_ >= 0); |
| 876 | 883 |
| 877 if (instr != NULL) { | 884 if (instr != NULL) { |
| 878 AddInstruction(instr, current); | 885 AddInstruction(instr, current); |
| 879 } | 886 } |
| 880 | 887 |
| 881 current_instruction_ = old_current; | 888 current_instruction_ = old_current; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 } | 963 } |
| 957 } | 964 } |
| 958 | 965 |
| 959 | 966 |
| 960 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 967 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
| 961 return new(zone()) LGoto(instr->FirstSuccessor()); | 968 return new(zone()) LGoto(instr->FirstSuccessor()); |
| 962 } | 969 } |
| 963 | 970 |
| 964 | 971 |
| 965 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 972 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| 966 LInstruction* goto_instr = CheckElideControlInstruction(instr); | |
| 967 if (goto_instr != NULL) return goto_instr; | |
| 968 | |
| 969 HValue* value = instr->value(); | 973 HValue* value = instr->value(); |
| 970 Representation r = value->representation(); | 974 Representation r = value->representation(); |
| 971 HType type = value->type(); | 975 HType type = value->type(); |
| 972 ToBooleanStub::Types expected = instr->expected_input_types(); | 976 ToBooleanStub::Types expected = instr->expected_input_types(); |
| 973 if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic(); | 977 if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic(); |
| 974 | 978 |
| 975 bool easy_case = !r.IsTagged() || type.IsBoolean() || type.IsSmi() || | 979 bool easy_case = !r.IsTagged() || type.IsBoolean() || type.IsSmi() || |
| 976 type.IsJSArray() || type.IsHeapNumber() || type.IsString(); | 980 type.IsJSArray() || type.IsHeapNumber() || type.IsString(); |
| 977 LOperand* temp = !easy_case && expected.NeedsMap() ? TempRegister() : NULL; | 981 LOperand* temp = !easy_case && expected.NeedsMap() ? TempRegister() : NULL; |
| 978 LInstruction* branch = new(zone()) LBranch(UseRegister(value), temp); | 982 LInstruction* branch = new(zone()) LBranch(UseRegister(value), temp); |
| 979 if (!easy_case && | 983 if (!easy_case && |
| 980 ((!expected.Contains(ToBooleanStub::SMI) && expected.NeedsMap()) || | 984 ((!expected.Contains(ToBooleanStub::SMI) && expected.NeedsMap()) || |
| 981 !expected.IsGeneric())) { | 985 !expected.IsGeneric())) { |
| 982 branch = AssignEnvironment(branch); | 986 branch = AssignEnvironment(branch); |
| 983 } | 987 } |
| 984 return branch; | 988 return branch; |
| 985 } | 989 } |
| 986 | 990 |
| 987 | 991 |
| 988 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { | 992 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { |
| 989 return new(zone()) LDebugBreak(); | 993 return new(zone()) LDebugBreak(); |
| 990 } | 994 } |
| 991 | 995 |
| 992 | 996 |
| 993 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 997 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
| 994 LInstruction* goto_instr = CheckElideControlInstruction(instr); | |
| 995 if (goto_instr != NULL) return goto_instr; | |
| 996 | |
| 997 ASSERT(instr->value()->representation().IsTagged()); | 998 ASSERT(instr->value()->representation().IsTagged()); |
| 998 LOperand* value = UseRegisterAtStart(instr->value()); | 999 LOperand* value = UseRegisterAtStart(instr->value()); |
| 999 return new(zone()) LCmpMapAndBranch(value); | 1000 return new(zone()) LCmpMapAndBranch(value); |
| 1000 } | 1001 } |
| 1001 | 1002 |
| 1002 | 1003 |
| 1003 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* length) { | 1004 LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* length) { |
| 1004 info()->MarkAsRequiresFrame(); | 1005 info()->MarkAsRequiresFrame(); |
| 1005 return DefineAsRegister(new(zone()) LArgumentsLength(Use(length->value()))); | 1006 return DefineAsRegister(new(zone()) LArgumentsLength(Use(length->value()))); |
| 1006 } | 1007 } |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 LOperand* context = UseFixed(instr->context(), esi); | 1624 LOperand* context = UseFixed(instr->context(), esi); |
| 1624 LOperand* left = UseFixed(instr->left(), edx); | 1625 LOperand* left = UseFixed(instr->left(), edx); |
| 1625 LOperand* right = UseFixed(instr->right(), eax); | 1626 LOperand* right = UseFixed(instr->right(), eax); |
| 1626 LCmpT* result = new(zone()) LCmpT(context, left, right); | 1627 LCmpT* result = new(zone()) LCmpT(context, left, right); |
| 1627 return MarkAsCall(DefineFixed(result, eax), instr); | 1628 return MarkAsCall(DefineFixed(result, eax), instr); |
| 1628 } | 1629 } |
| 1629 | 1630 |
| 1630 | 1631 |
| 1631 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( | 1632 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
| 1632 HCompareNumericAndBranch* instr) { | 1633 HCompareNumericAndBranch* instr) { |
| 1633 LInstruction* goto_instr = CheckElideControlInstruction(instr); | |
| 1634 if (goto_instr != NULL) return goto_instr; | |
| 1635 Representation r = instr->representation(); | 1634 Representation r = instr->representation(); |
| 1636 if (r.IsSmiOrInteger32()) { | 1635 if (r.IsSmiOrInteger32()) { |
| 1637 ASSERT(instr->left()->representation().Equals(r)); | 1636 ASSERT(instr->left()->representation().Equals(r)); |
| 1638 ASSERT(instr->right()->representation().Equals(r)); | 1637 ASSERT(instr->right()->representation().Equals(r)); |
| 1639 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); | 1638 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
| 1640 LOperand* right = UseOrConstantAtStart(instr->right()); | 1639 LOperand* right = UseOrConstantAtStart(instr->right()); |
| 1641 return new(zone()) LCompareNumericAndBranch(left, right); | 1640 return new(zone()) LCompareNumericAndBranch(left, right); |
| 1642 } else { | 1641 } else { |
| 1643 ASSERT(r.IsDouble()); | 1642 ASSERT(r.IsDouble()); |
| 1644 ASSERT(instr->left()->representation().IsDouble()); | 1643 ASSERT(instr->left()->representation().IsDouble()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1655 left = UseRegisterAtStart(instr->left()); | 1654 left = UseRegisterAtStart(instr->left()); |
| 1656 right = UseRegisterAtStart(instr->right()); | 1655 right = UseRegisterAtStart(instr->right()); |
| 1657 } | 1656 } |
| 1658 return new(zone()) LCompareNumericAndBranch(left, right); | 1657 return new(zone()) LCompareNumericAndBranch(left, right); |
| 1659 } | 1658 } |
| 1660 } | 1659 } |
| 1661 | 1660 |
| 1662 | 1661 |
| 1663 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( | 1662 LInstruction* LChunkBuilder::DoCompareObjectEqAndBranch( |
| 1664 HCompareObjectEqAndBranch* instr) { | 1663 HCompareObjectEqAndBranch* instr) { |
| 1665 LInstruction* goto_instr = CheckElideControlInstruction(instr); | |
| 1666 if (goto_instr != NULL) return goto_instr; | |
| 1667 LOperand* left = UseRegisterAtStart(instr->left()); | 1664 LOperand* left = UseRegisterAtStart(instr->left()); |
| 1668 LOperand* right = UseOrConstantAtStart(instr->right()); | 1665 LOperand* right = UseOrConstantAtStart(instr->right()); |
| 1669 return new(zone()) LCmpObjectEqAndBranch(left, right); | 1666 return new(zone()) LCmpObjectEqAndBranch(left, right); |
| 1670 } | 1667 } |
| 1671 | 1668 |
| 1672 | 1669 |
| 1673 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( | 1670 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( |
| 1674 HCompareHoleAndBranch* instr) { | 1671 HCompareHoleAndBranch* instr) { |
| 1675 LOperand* value = UseRegisterAtStart(instr->value()); | 1672 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1676 return new(zone()) LCmpHoleAndBranch(value); | 1673 return new(zone()) LCmpHoleAndBranch(value); |
| 1677 } | 1674 } |
| 1678 | 1675 |
| 1679 | 1676 |
| 1680 LInstruction* LChunkBuilder::DoCompareMinusZeroAndBranch( | 1677 LInstruction* LChunkBuilder::DoCompareMinusZeroAndBranch( |
| 1681 HCompareMinusZeroAndBranch* instr) { | 1678 HCompareMinusZeroAndBranch* instr) { |
| 1682 LInstruction* goto_instr = CheckElideControlInstruction(instr); | |
| 1683 if (goto_instr != NULL) return goto_instr; | |
| 1684 LOperand* value = UseRegister(instr->value()); | 1679 LOperand* value = UseRegister(instr->value()); |
| 1685 LOperand* scratch = TempRegister(); | 1680 LOperand* scratch = TempRegister(); |
| 1686 return new(zone()) LCompareMinusZeroAndBranch(value, scratch); | 1681 return new(zone()) LCompareMinusZeroAndBranch(value, scratch); |
| 1687 } | 1682 } |
| 1688 | 1683 |
| 1689 | 1684 |
| 1690 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { | 1685 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { |
| 1691 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 1686 ASSERT(instr->value()->representation().IsSmiOrTagged()); |
| 1692 LOperand* temp = TempRegister(); | 1687 LOperand* temp = TempRegister(); |
| 1693 return new(zone()) LIsObjectAndBranch(UseRegister(instr->value()), temp); | 1688 return new(zone()) LIsObjectAndBranch(UseRegister(instr->value()), temp); |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2538 | 2533 |
| 2539 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 2534 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
| 2540 LOperand* context = UseFixed(instr->context(), esi); | 2535 LOperand* context = UseFixed(instr->context(), esi); |
| 2541 LOperand* value = UseAtStart(instr->value()); | 2536 LOperand* value = UseAtStart(instr->value()); |
| 2542 LTypeof* result = new(zone()) LTypeof(context, value); | 2537 LTypeof* result = new(zone()) LTypeof(context, value); |
| 2543 return MarkAsCall(DefineFixed(result, eax), instr); | 2538 return MarkAsCall(DefineFixed(result, eax), instr); |
| 2544 } | 2539 } |
| 2545 | 2540 |
| 2546 | 2541 |
| 2547 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { | 2542 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { |
| 2548 LInstruction* goto_instr = CheckElideControlInstruction(instr); | |
| 2549 if (goto_instr != NULL) return goto_instr; | |
| 2550 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); | 2543 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); |
| 2551 } | 2544 } |
| 2552 | 2545 |
| 2553 | 2546 |
| 2554 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2547 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| 2555 HIsConstructCallAndBranch* instr) { | 2548 HIsConstructCallAndBranch* instr) { |
| 2556 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2549 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
| 2557 } | 2550 } |
| 2558 | 2551 |
| 2559 | 2552 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2642 LOperand* index = UseTempRegister(instr->index()); | 2635 LOperand* index = UseTempRegister(instr->index()); |
| 2643 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2636 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
| 2644 LInstruction* result = DefineSameAsFirst(load); | 2637 LInstruction* result = DefineSameAsFirst(load); |
| 2645 return AssignPointerMap(result); | 2638 return AssignPointerMap(result); |
| 2646 } | 2639 } |
| 2647 | 2640 |
| 2648 | 2641 |
| 2649 } } // namespace v8::internal | 2642 } } // namespace v8::internal |
| 2650 | 2643 |
| 2651 #endif // V8_TARGET_ARCH_X87 | 2644 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |