| OLD | NEW |
| 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 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 } | 861 } |
| 862 | 862 |
| 863 | 863 |
| 864 void LChunkBuilder::VisitInstruction(HInstruction* current) { | 864 void LChunkBuilder::VisitInstruction(HInstruction* current) { |
| 865 HInstruction* old_current = current_instruction_; | 865 HInstruction* old_current = current_instruction_; |
| 866 current_instruction_ = current; | 866 current_instruction_ = current; |
| 867 if (current->has_position()) position_ = current->position(); | 867 if (current->has_position()) position_ = current->position(); |
| 868 | 868 |
| 869 LInstruction* instr = NULL; | 869 LInstruction* instr = NULL; |
| 870 if (current->CanReplaceWithDummyUses()) { | 870 if (current->CanReplaceWithDummyUses()) { |
| 871 HValue* first_operand = current->OperandCount() == 0 | 871 if (current->OperandCount() == 0) { |
| 872 ? graph()->GetConstant1() | 872 instr = DefineAsRegister(new(zone()) LDummy()); |
| 873 : current->OperandAt(0); | 873 } else { |
| 874 instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand))); | 874 instr = DefineAsRegister(new(zone()) |
| 875 LDummyUse(UseAny(current->OperandAt(0)))); |
| 876 } |
| 875 for (int i = 1; i < current->OperandCount(); ++i) { | 877 for (int i = 1; i < current->OperandCount(); ++i) { |
| 876 LInstruction* dummy = | 878 LInstruction* dummy = |
| 877 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); | 879 new(zone()) LDummyUse(UseAny(current->OperandAt(i))); |
| 878 dummy->set_hydrogen_value(current); | 880 dummy->set_hydrogen_value(current); |
| 879 chunk_->AddInstruction(dummy, current_block_); | 881 chunk_->AddInstruction(dummy, current_block_); |
| 880 } | 882 } |
| 881 } else { | 883 } else { |
| 882 instr = current->CompileToLithium(this); | 884 instr = current->CompileToLithium(this); |
| 883 } | 885 } |
| 884 | 886 |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 } | 1696 } |
| 1695 | 1697 |
| 1696 | 1698 |
| 1697 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( | 1699 LInstruction* LChunkBuilder::DoCompareHoleAndBranch( |
| 1698 HCompareHoleAndBranch* instr) { | 1700 HCompareHoleAndBranch* instr) { |
| 1699 LOperand* value = UseRegisterAtStart(instr->value()); | 1701 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1700 return new(zone()) LCmpHoleAndBranch(value); | 1702 return new(zone()) LCmpHoleAndBranch(value); |
| 1701 } | 1703 } |
| 1702 | 1704 |
| 1703 | 1705 |
| 1706 LInstruction* LChunkBuilder::DoCompareMinusZeroAndBranch( |
| 1707 HCompareMinusZeroAndBranch* instr) { |
| 1708 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| 1709 if (goto_instr != NULL) return goto_instr; |
| 1710 LOperand* value = UseRegister(instr->value()); |
| 1711 LOperand* scratch = TempRegister(); |
| 1712 return new(zone()) LCompareMinusZeroAndBranch(value, scratch); |
| 1713 } |
| 1714 |
| 1715 |
| 1704 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { | 1716 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { |
| 1705 ASSERT(instr->value()->representation().IsTagged()); | 1717 ASSERT(instr->value()->representation().IsTagged()); |
| 1706 LOperand* temp = TempRegister(); | 1718 LOperand* temp = TempRegister(); |
| 1707 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()), | 1719 return new(zone()) LIsObjectAndBranch(UseRegisterAtStart(instr->value()), |
| 1708 temp); | 1720 temp); |
| 1709 } | 1721 } |
| 1710 | 1722 |
| 1711 | 1723 |
| 1712 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { | 1724 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { |
| 1713 ASSERT(instr->value()->representation().IsTagged()); | 1725 ASSERT(instr->value()->representation().IsTagged()); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1797 | 1809 |
| 1798 | 1810 |
| 1799 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) { | 1811 LInstruction* LChunkBuilder::DoDateField(HDateField* instr) { |
| 1800 LOperand* object = UseFixed(instr->value(), a0); | 1812 LOperand* object = UseFixed(instr->value(), a0); |
| 1801 LDateField* result = | 1813 LDateField* result = |
| 1802 new(zone()) LDateField(object, FixedTemp(a1), instr->index()); | 1814 new(zone()) LDateField(object, FixedTemp(a1), instr->index()); |
| 1803 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY); | 1815 return MarkAsCall(DefineFixed(result, v0), instr, CAN_DEOPTIMIZE_EAGERLY); |
| 1804 } | 1816 } |
| 1805 | 1817 |
| 1806 | 1818 |
| 1819 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) { |
| 1820 LOperand* string = UseRegisterAtStart(instr->string()); |
| 1821 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); |
| 1822 return DefineAsRegister(new(zone()) LSeqStringGetChar(string, index)); |
| 1823 } |
| 1824 |
| 1825 |
| 1807 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { | 1826 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { |
| 1808 LOperand* string = UseRegister(instr->string()); | 1827 LOperand* string = UseRegister(instr->string()); |
| 1809 LOperand* index = UseRegisterOrConstant(instr->index()); | 1828 LOperand* index = UseRegisterOrConstant(instr->index()); |
| 1810 LOperand* value = UseRegister(instr->value()); | 1829 LOperand* value = UseRegister(instr->value()); |
| 1811 return new(zone()) LSeqStringSetChar(instr->encoding(), string, index, value); | 1830 return new(zone()) LSeqStringSetChar(string, index, value); |
| 1812 } | 1831 } |
| 1813 | 1832 |
| 1814 | 1833 |
| 1815 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1834 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
| 1816 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); | 1835 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); |
| 1817 LOperand* length = UseRegister(instr->length()); | 1836 LOperand* length = UseRegister(instr->length()); |
| 1818 return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); | 1837 return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); |
| 1819 } | 1838 } |
| 1820 | 1839 |
| 1821 | 1840 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1946 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); |
| 1928 } else if (val->HasRange() && val->range()->IsInSmiRange()) { | 1947 } else if (val->HasRange() && val->range()->IsInSmiRange()) { |
| 1929 return DefineAsRegister(new(zone()) LSmiTag(value)); | 1948 return DefineAsRegister(new(zone()) LSmiTag(value)); |
| 1930 } else { | 1949 } else { |
| 1931 LNumberTagI* result = new(zone()) LNumberTagI(value); | 1950 LNumberTagI* result = new(zone()) LNumberTagI(value); |
| 1932 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1951 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1933 } | 1952 } |
| 1934 } else if (to.IsSmi()) { | 1953 } else if (to.IsSmi()) { |
| 1935 HValue* val = instr->value(); | 1954 HValue* val = instr->value(); |
| 1936 LOperand* value = UseRegister(val); | 1955 LOperand* value = UseRegister(val); |
| 1937 LInstruction* result = | 1956 LInstruction* result = val->CheckFlag(HInstruction::kUint32) |
| 1938 DefineSameAsFirst(new(zone()) LInteger32ToSmi(value)); | 1957 ? DefineSameAsFirst(new(zone()) LUint32ToSmi(value)) |
| 1958 : DefineSameAsFirst(new(zone()) LInteger32ToSmi(value)); |
| 1939 if (val->HasRange() && val->range()->IsInSmiRange()) { | 1959 if (val->HasRange() && val->range()->IsInSmiRange()) { |
| 1940 return result; | 1960 return result; |
| 1941 } | 1961 } |
| 1942 return AssignEnvironment(result); | 1962 return AssignEnvironment(result); |
| 1943 } else { | 1963 } else { |
| 1944 ASSERT(to.IsDouble()); | 1964 ASSERT(to.IsDouble()); |
| 1945 if (instr->value()->CheckFlag(HInstruction::kUint32)) { | 1965 if (instr->value()->CheckFlag(HInstruction::kUint32)) { |
| 1946 return DefineAsRegister( | 1966 return DefineAsRegister( |
| 1947 new(zone()) LUint32ToDouble(UseRegister(instr->value()))); | 1967 new(zone()) LUint32ToDouble(UseRegister(instr->value()))); |
| 1948 } else { | 1968 } else { |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2318 LOperand* obj = UseFixed(instr->object(), a1); | 2338 LOperand* obj = UseFixed(instr->object(), a1); |
| 2319 LOperand* val = UseFixed(instr->value(), a0); | 2339 LOperand* val = UseFixed(instr->value(), a0); |
| 2320 | 2340 |
| 2321 LInstruction* result = new(zone()) LStoreNamedGeneric(context, obj, val); | 2341 LInstruction* result = new(zone()) LStoreNamedGeneric(context, obj, val); |
| 2322 return MarkAsCall(result, instr); | 2342 return MarkAsCall(result, instr); |
| 2323 } | 2343 } |
| 2324 | 2344 |
| 2325 | 2345 |
| 2326 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { | 2346 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { |
| 2327 LOperand* context = UseFixed(instr->context(), cp); | 2347 LOperand* context = UseFixed(instr->context(), cp); |
| 2328 LOperand* left = UseRegisterAtStart(instr->left()); | 2348 LOperand* left = FLAG_new_string_add |
| 2329 LOperand* right = UseRegisterAtStart(instr->right()); | 2349 ? UseFixed(instr->left(), a1) |
| 2350 : UseRegisterAtStart(instr->left()); |
| 2351 LOperand* right = FLAG_new_string_add |
| 2352 ? UseFixed(instr->right(), a0) |
| 2353 : UseRegisterAtStart(instr->right()); |
| 2330 return MarkAsCall( | 2354 return MarkAsCall( |
| 2331 DefineFixed(new(zone()) LStringAdd(context, left, right), v0), | 2355 DefineFixed(new(zone()) LStringAdd(context, left, right), v0), |
| 2332 instr); | 2356 instr); |
| 2333 } | 2357 } |
| 2334 | 2358 |
| 2335 | 2359 |
| 2336 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2360 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
| 2337 LOperand* string = UseTempRegister(instr->string()); | 2361 LOperand* string = UseTempRegister(instr->string()); |
| 2338 LOperand* index = UseTempRegister(instr->index()); | 2362 LOperand* index = UseTempRegister(instr->index()); |
| 2339 LOperand* context = UseAny(instr->context()); | 2363 LOperand* context = UseAny(instr->context()); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2580 | 2604 |
| 2581 | 2605 |
| 2582 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2606 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2583 LOperand* object = UseRegister(instr->object()); | 2607 LOperand* object = UseRegister(instr->object()); |
| 2584 LOperand* index = UseRegister(instr->index()); | 2608 LOperand* index = UseRegister(instr->index()); |
| 2585 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2609 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2586 } | 2610 } |
| 2587 | 2611 |
| 2588 | 2612 |
| 2589 } } // namespace v8::internal | 2613 } } // namespace v8::internal |
| OLD | NEW |