| 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 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 LOperand* context = UseFixed(instr->context(), esi); | 1403 LOperand* context = UseFixed(instr->context(), esi); |
| 1404 LOperand* constructor = UseFixed(instr->constructor(), edi); | 1404 LOperand* constructor = UseFixed(instr->constructor(), edi); |
| 1405 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); | 1405 LCallNewArray* result = new(zone()) LCallNewArray(context, constructor); |
| 1406 return MarkAsCall(DefineFixed(result, eax), instr); | 1406 return MarkAsCall(DefineFixed(result, eax), instr); |
| 1407 } | 1407 } |
| 1408 | 1408 |
| 1409 | 1409 |
| 1410 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { | 1410 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { |
| 1411 LOperand* context = UseFixed(instr->context(), esi); | 1411 LOperand* context = UseFixed(instr->context(), esi); |
| 1412 LOperand* function = UseFixed(instr->function(), edi); | 1412 LOperand* function = UseFixed(instr->function(), edi); |
| 1413 LCallFunction* result = new(zone()) LCallFunction(context, function); | 1413 LCallFunction* call = new(zone()) LCallFunction(context, function); |
| 1414 return MarkAsCall(DefineFixed(result, eax), instr); | 1414 LInstruction* result = DefineFixed(call, eax); |
| 1415 if (instr->IsTailCall()) return result; |
| 1416 return MarkAsCall(result, instr); |
| 1415 } | 1417 } |
| 1416 | 1418 |
| 1417 | 1419 |
| 1418 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { | 1420 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { |
| 1419 LOperand* context = UseFixed(instr->context(), esi); | 1421 LOperand* context = UseFixed(instr->context(), esi); |
| 1420 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), eax), instr); | 1422 return MarkAsCall(DefineFixed(new(zone()) LCallRuntime(context), eax), instr); |
| 1421 } | 1423 } |
| 1422 | 1424 |
| 1423 | 1425 |
| 1424 LInstruction* LChunkBuilder::DoRor(HRor* instr) { | 1426 LInstruction* LChunkBuilder::DoRor(HRor* instr) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 if (instr->HasPowerOf2Divisor()) { | 1551 if (instr->HasPowerOf2Divisor()) { |
| 1550 ASSERT(!right->CanBeZero()); | 1552 ASSERT(!right->CanBeZero()); |
| 1551 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), | 1553 LModI* mod = new(zone()) LModI(UseRegisterAtStart(left), |
| 1552 UseOrConstant(right), | 1554 UseOrConstant(right), |
| 1553 NULL); | 1555 NULL); |
| 1554 LInstruction* result = DefineSameAsFirst(mod); | 1556 LInstruction* result = DefineSameAsFirst(mod); |
| 1555 return (left->CanBeNegative() && | 1557 return (left->CanBeNegative() && |
| 1556 instr->CheckFlag(HValue::kBailoutOnMinusZero)) | 1558 instr->CheckFlag(HValue::kBailoutOnMinusZero)) |
| 1557 ? AssignEnvironment(result) | 1559 ? AssignEnvironment(result) |
| 1558 : result; | 1560 : result; |
| 1559 } else if (instr->fixed_right_arg().has_value) { | |
| 1560 LModI* mod = new(zone()) LModI(UseRegister(left), | |
| 1561 UseRegisterAtStart(right), | |
| 1562 NULL); | |
| 1563 return AssignEnvironment(DefineSameAsFirst(mod)); | 1561 return AssignEnvironment(DefineSameAsFirst(mod)); |
| 1564 } else { | 1562 } else { |
| 1565 // The temporary operand is necessary to ensure that right is not | 1563 // The temporary operand is necessary to ensure that right is not |
| 1566 // allocated into edx. | 1564 // allocated into edx. |
| 1567 LModI* mod = new(zone()) LModI(UseFixed(left, eax), | 1565 LModI* mod = new(zone()) LModI(UseFixed(left, eax), |
| 1568 UseRegister(right), | 1566 UseRegister(right), |
| 1569 FixedTemp(edx)); | 1567 FixedTemp(edx)); |
| 1570 LInstruction* result = DefineFixed(mod, edx); | 1568 LInstruction* result = DefineFixed(mod, edx); |
| 1571 return (right->CanBeZero() || | 1569 return (right->CanBeZero() || |
| 1572 (left->RangeCanInclude(kMinInt) && | 1570 (left->RangeCanInclude(kMinInt) && |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 LOperand* left = UseFixedDouble(instr->left(), xmm2); | 1688 LOperand* left = UseFixedDouble(instr->left(), xmm2); |
| 1691 LOperand* right = exponent_type.IsDouble() ? | 1689 LOperand* right = exponent_type.IsDouble() ? |
| 1692 UseFixedDouble(instr->right(), xmm1) : | 1690 UseFixedDouble(instr->right(), xmm1) : |
| 1693 UseFixed(instr->right(), eax); | 1691 UseFixed(instr->right(), eax); |
| 1694 LPower* result = new(zone()) LPower(left, right); | 1692 LPower* result = new(zone()) LPower(left, right); |
| 1695 return MarkAsCall(DefineFixedDouble(result, xmm3), instr, | 1693 return MarkAsCall(DefineFixedDouble(result, xmm3), instr, |
| 1696 CAN_DEOPTIMIZE_EAGERLY); | 1694 CAN_DEOPTIMIZE_EAGERLY); |
| 1697 } | 1695 } |
| 1698 | 1696 |
| 1699 | 1697 |
| 1700 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { | |
| 1701 ASSERT(instr->representation().IsDouble()); | |
| 1702 ASSERT(instr->global_object()->representation().IsTagged()); | |
| 1703 LOperand* global_object = UseTempRegister(instr->global_object()); | |
| 1704 LOperand* scratch = TempRegister(); | |
| 1705 LOperand* scratch2 = TempRegister(); | |
| 1706 LOperand* scratch3 = TempRegister(); | |
| 1707 LRandom* result = new(zone()) LRandom( | |
| 1708 global_object, scratch, scratch2, scratch3); | |
| 1709 return DefineFixedDouble(result, xmm1); | |
| 1710 } | |
| 1711 | |
| 1712 | |
| 1713 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { | 1698 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { |
| 1714 ASSERT(instr->left()->representation().IsSmiOrTagged()); | 1699 ASSERT(instr->left()->representation().IsSmiOrTagged()); |
| 1715 ASSERT(instr->right()->representation().IsSmiOrTagged()); | 1700 ASSERT(instr->right()->representation().IsSmiOrTagged()); |
| 1716 LOperand* context = UseFixed(instr->context(), esi); | 1701 LOperand* context = UseFixed(instr->context(), esi); |
| 1717 LOperand* left = UseFixed(instr->left(), edx); | 1702 LOperand* left = UseFixed(instr->left(), edx); |
| 1718 LOperand* right = UseFixed(instr->right(), eax); | 1703 LOperand* right = UseFixed(instr->right(), eax); |
| 1719 LCmpT* result = new(zone()) LCmpT(context, left, right); | 1704 LCmpT* result = new(zone()) LCmpT(context, left, right); |
| 1720 return MarkAsCall(DefineFixed(result, eax), instr); | 1705 return MarkAsCall(DefineFixed(result, eax), instr); |
| 1721 } | 1706 } |
| 1722 | 1707 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1883 } | 1868 } |
| 1884 | 1869 |
| 1885 | 1870 |
| 1886 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) { | 1871 LInstruction* LChunkBuilder::DoSeqStringGetChar(HSeqStringGetChar* instr) { |
| 1887 LOperand* string = UseRegisterAtStart(instr->string()); | 1872 LOperand* string = UseRegisterAtStart(instr->string()); |
| 1888 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); | 1873 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); |
| 1889 return DefineAsRegister(new(zone()) LSeqStringGetChar(string, index)); | 1874 return DefineAsRegister(new(zone()) LSeqStringGetChar(string, index)); |
| 1890 } | 1875 } |
| 1891 | 1876 |
| 1892 | 1877 |
| 1878 LOperand* LChunkBuilder::GetSeqStringSetCharOperand(HSeqStringSetChar* instr) { |
| 1879 if (instr->encoding() == String::ONE_BYTE_ENCODING) { |
| 1880 if (FLAG_debug_code) { |
| 1881 return UseFixed(instr->value(), eax); |
| 1882 } else { |
| 1883 return UseFixedOrConstant(instr->value(), eax); |
| 1884 } |
| 1885 } else { |
| 1886 if (FLAG_debug_code) { |
| 1887 return UseRegisterAtStart(instr->value()); |
| 1888 } else { |
| 1889 return UseRegisterOrConstantAtStart(instr->value()); |
| 1890 } |
| 1891 } |
| 1892 } |
| 1893 |
| 1894 |
| 1893 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { | 1895 LInstruction* LChunkBuilder::DoSeqStringSetChar(HSeqStringSetChar* instr) { |
| 1894 LOperand* string = UseRegisterAtStart(instr->string()); | 1896 LOperand* string = UseRegisterAtStart(instr->string()); |
| 1895 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); | 1897 LOperand* index = FLAG_debug_code |
| 1896 LOperand* value = (instr->encoding() == String::ONE_BYTE_ENCODING) | 1898 ? UseRegisterAtStart(instr->index()) |
| 1897 ? UseFixedOrConstant(instr->value(), eax) | 1899 : UseRegisterOrConstantAtStart(instr->index()); |
| 1898 : UseRegisterOrConstantAtStart(instr->value()); | 1900 LOperand* value = GetSeqStringSetCharOperand(instr); |
| 1899 return new(zone()) LSeqStringSetChar(string, index, value); | 1901 LOperand* context = FLAG_debug_code ? UseFixed(instr->context(), esi) : NULL; |
| 1902 LInstruction* result = new(zone()) LSeqStringSetChar(context, string, |
| 1903 index, value); |
| 1904 if (FLAG_debug_code) { |
| 1905 result = MarkAsCall(result, instr); |
| 1906 } |
| 1907 return result; |
| 1900 } | 1908 } |
| 1901 | 1909 |
| 1902 | 1910 |
| 1903 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 1911 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
| 1904 return AssignEnvironment(new(zone()) LBoundsCheck( | 1912 return AssignEnvironment(new(zone()) LBoundsCheck( |
| 1905 UseRegisterOrConstantAtStart(instr->index()), | 1913 UseRegisterOrConstantAtStart(instr->index()), |
| 1906 UseAtStart(instr->length()))); | 1914 UseAtStart(instr->length()))); |
| 1907 } | 1915 } |
| 1908 | 1916 |
| 1909 | 1917 |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2647 | 2655 |
| 2648 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { | 2656 LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) { |
| 2649 LOperand* context = UseFixed(instr->context(), esi); | 2657 LOperand* context = UseFixed(instr->context(), esi); |
| 2650 LOperand* value = UseAtStart(instr->value()); | 2658 LOperand* value = UseAtStart(instr->value()); |
| 2651 LTypeof* result = new(zone()) LTypeof(context, value); | 2659 LTypeof* result = new(zone()) LTypeof(context, value); |
| 2652 return MarkAsCall(DefineFixed(result, eax), instr); | 2660 return MarkAsCall(DefineFixed(result, eax), instr); |
| 2653 } | 2661 } |
| 2654 | 2662 |
| 2655 | 2663 |
| 2656 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { | 2664 LInstruction* LChunkBuilder::DoTypeofIsAndBranch(HTypeofIsAndBranch* instr) { |
| 2665 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| 2666 if (goto_instr != NULL) return goto_instr; |
| 2657 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); | 2667 return new(zone()) LTypeofIsAndBranch(UseTempRegister(instr->value())); |
| 2658 } | 2668 } |
| 2659 | 2669 |
| 2660 | 2670 |
| 2661 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 2671 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
| 2662 HIsConstructCallAndBranch* instr) { | 2672 HIsConstructCallAndBranch* instr) { |
| 2663 return new(zone()) LIsConstructCallAndBranch(TempRegister()); | 2673 return new(zone()) LIsConstructCallAndBranch(TempRegister()); |
| 2664 } | 2674 } |
| 2665 | 2675 |
| 2666 | 2676 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2763 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2773 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2764 LOperand* object = UseRegister(instr->object()); | 2774 LOperand* object = UseRegister(instr->object()); |
| 2765 LOperand* index = UseTempRegister(instr->index()); | 2775 LOperand* index = UseTempRegister(instr->index()); |
| 2766 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2776 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2767 } | 2777 } |
| 2768 | 2778 |
| 2769 | 2779 |
| 2770 } } // namespace v8::internal | 2780 } } // namespace v8::internal |
| 2771 | 2781 |
| 2772 #endif // V8_TARGET_ARCH_IA32 | 2782 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |