| 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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { | 940 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { |
| 941 return new(zone()) LDebugBreak(); | 941 return new(zone()) LDebugBreak(); |
| 942 } | 942 } |
| 943 | 943 |
| 944 | 944 |
| 945 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 945 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
| 946 LInstruction* goto_instr = CheckElideControlInstruction(instr); | 946 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| 947 if (goto_instr != NULL) return goto_instr; | 947 if (goto_instr != NULL) return goto_instr; |
| 948 | 948 |
| 949 HValue* value = instr->value(); | 949 HValue* value = instr->value(); |
| 950 LBranch* result = new(zone()) LBranch(UseRegister(value)); | 950 Representation r = value->representation(); |
| 951 // Tagged values that are not known smis or booleans require a | 951 HType type = value->type(); |
| 952 // deoptimization environment. If the instruction is generic no | |
| 953 // environment is needed since all cases are handled. | |
| 954 ToBooleanStub::Types expected = instr->expected_input_types(); | 952 ToBooleanStub::Types expected = instr->expected_input_types(); |
| 955 Representation rep = value->representation(); | 953 if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic(); |
| 956 HType type = value->type(); | 954 |
| 957 if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean() && | 955 bool easy_case = !r.IsTagged() || type.IsBoolean() || type.IsSmi() || |
| 958 !expected.IsGeneric()) { | 956 type.IsJSArray() || type.IsHeapNumber() || type.IsString(); |
| 959 return AssignEnvironment(result); | 957 LInstruction* branch = new(zone()) LBranch(UseRegister(value)); |
| 958 if (!easy_case && |
| 959 ((!expected.Contains(ToBooleanStub::SMI) && expected.NeedsMap()) || |
| 960 !expected.IsGeneric())) { |
| 961 branch = AssignEnvironment(branch); |
| 960 } | 962 } |
| 961 return result; | 963 return branch; |
| 962 } | 964 } |
| 963 | 965 |
| 964 | 966 |
| 965 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 967 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
| 966 LInstruction* goto_instr = CheckElideControlInstruction(instr); | 968 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
| 967 if (goto_instr != NULL) return goto_instr; | 969 if (goto_instr != NULL) return goto_instr; |
| 968 | 970 |
| 969 ASSERT(instr->value()->representation().IsTagged()); | 971 ASSERT(instr->value()->representation().IsTagged()); |
| 970 LOperand* value = UseRegisterAtStart(instr->value()); | 972 LOperand* value = UseRegisterAtStart(instr->value()); |
| 971 return new(zone()) LCmpMapAndBranch(value); | 973 return new(zone()) LCmpMapAndBranch(value); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 LOperand* input = UseRegister(instr->value()); | 1138 LOperand* input = UseRegister(instr->value()); |
| 1137 LOperand* temp = FixedTemp(xmm4); | 1139 LOperand* temp = FixedTemp(xmm4); |
| 1138 LMathRound* result = new(zone()) LMathRound(input, temp); | 1140 LMathRound* result = new(zone()) LMathRound(input, temp); |
| 1139 return AssignEnvironment(DefineAsRegister(result)); | 1141 return AssignEnvironment(DefineAsRegister(result)); |
| 1140 } | 1142 } |
| 1141 | 1143 |
| 1142 | 1144 |
| 1143 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { | 1145 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { |
| 1144 LOperand* context = UseAny(instr->context()); | 1146 LOperand* context = UseAny(instr->context()); |
| 1145 LOperand* input = UseRegisterAtStart(instr->value()); | 1147 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1146 LMathAbs* result = new(zone()) LMathAbs(context, input); | 1148 LInstruction* result = |
| 1147 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1149 DefineSameAsFirst(new(zone()) LMathAbs(context, input)); |
| 1150 Representation r = instr->value()->representation(); |
| 1151 if (!r.IsDouble() && !r.IsSmiOrInteger32()) result = AssignPointerMap(result); |
| 1152 if (!r.IsDouble()) result = AssignEnvironment(result); |
| 1153 return result; |
| 1148 } | 1154 } |
| 1149 | 1155 |
| 1150 | 1156 |
| 1151 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1157 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
| 1152 ASSERT(instr->representation().IsDouble()); | 1158 ASSERT(instr->representation().IsDouble()); |
| 1153 ASSERT(instr->value()->representation().IsDouble()); | 1159 ASSERT(instr->value()->representation().IsDouble()); |
| 1154 LOperand* input = UseRegisterAtStart(instr->value()); | 1160 LOperand* input = UseRegisterAtStart(instr->value()); |
| 1155 return MarkAsCall(DefineSameAsFirst(new(zone()) LMathLog(input)), instr); | 1161 return MarkAsCall(DefineSameAsFirst(new(zone()) LMathLog(input)), instr); |
| 1156 } | 1162 } |
| 1157 | 1163 |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1791 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1797 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
| 1792 } | 1798 } |
| 1793 from = Representation::Tagged(); | 1799 from = Representation::Tagged(); |
| 1794 } | 1800 } |
| 1795 // Only mark conversions that might need to allocate as calling rather than | 1801 // Only mark conversions that might need to allocate as calling rather than |
| 1796 // all changes. This makes simple, non-allocating conversion not have to force | 1802 // all changes. This makes simple, non-allocating conversion not have to force |
| 1797 // building a stack frame. | 1803 // building a stack frame. |
| 1798 if (from.IsTagged()) { | 1804 if (from.IsTagged()) { |
| 1799 if (to.IsDouble()) { | 1805 if (to.IsDouble()) { |
| 1800 LOperand* value = UseRegister(instr->value()); | 1806 LOperand* value = UseRegister(instr->value()); |
| 1801 LNumberUntagD* res = new(zone()) LNumberUntagD(value); | 1807 LInstruction* res = DefineAsRegister(new(zone()) LNumberUntagD(value)); |
| 1802 return AssignEnvironment(DefineAsRegister(res)); | 1808 if (!instr->value()->representation().IsSmi()) { |
| 1809 res = AssignEnvironment(res); |
| 1810 } |
| 1811 return res; |
| 1803 } else if (to.IsSmi()) { | 1812 } else if (to.IsSmi()) { |
| 1804 HValue* val = instr->value(); | 1813 HValue* val = instr->value(); |
| 1805 LOperand* value = UseRegister(val); | 1814 LOperand* value = UseRegister(val); |
| 1806 if (val->type().IsSmi()) { | 1815 if (val->type().IsSmi()) { |
| 1807 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1816 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
| 1808 } | 1817 } |
| 1809 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 1818 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
| 1810 } else { | 1819 } else { |
| 1811 ASSERT(to.IsInteger32()); | 1820 ASSERT(to.IsInteger32()); |
| 1812 HValue* val = instr->value(); | 1821 HValue* val = instr->value(); |
| 1813 LOperand* value = UseRegister(val); | 1822 LOperand* value = UseRegister(val); |
| 1814 if (val->type().IsSmi() || val->representation().IsSmi()) { | 1823 if (val->type().IsSmi() || val->representation().IsSmi()) { |
| 1815 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); | 1824 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); |
| 1816 } else { | 1825 } else { |
| 1817 bool truncating = instr->CanTruncateToInt32(); | 1826 bool truncating = instr->CanTruncateToInt32(); |
| 1818 LOperand* xmm_temp = truncating ? NULL : FixedTemp(xmm1); | 1827 LOperand* xmm_temp = truncating ? NULL : FixedTemp(xmm1); |
| 1819 LTaggedToI* res = new(zone()) LTaggedToI(value, xmm_temp); | 1828 LInstruction* res = |
| 1820 return AssignEnvironment(DefineSameAsFirst(res)); | 1829 DefineSameAsFirst(new(zone()) LTaggedToI(value, xmm_temp)); |
| 1830 if (!instr->value()->representation().IsSmi()) { |
| 1831 // Note: Only deopts in deferred code. |
| 1832 res = AssignEnvironment(res); |
| 1833 } |
| 1834 return res; |
| 1821 } | 1835 } |
| 1822 } | 1836 } |
| 1823 } else if (from.IsDouble()) { | 1837 } else if (from.IsDouble()) { |
| 1824 if (to.IsTagged()) { | 1838 if (to.IsTagged()) { |
| 1825 info()->MarkAsDeferredCalling(); | 1839 info()->MarkAsDeferredCalling(); |
| 1826 LOperand* value = UseRegister(instr->value()); | 1840 LOperand* value = UseRegister(instr->value()); |
| 1827 LOperand* temp = TempRegister(); | 1841 LOperand* temp = TempRegister(); |
| 1828 | 1842 |
| 1829 // Make sure that temp and result_temp are different registers. | 1843 // Make sure that temp and result_temp are different registers. |
| 1830 LUnallocated* result_temp = TempRegister(); | 1844 LUnallocated* result_temp = TempRegister(); |
| 1831 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); | 1845 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); |
| 1832 return AssignPointerMap(Define(result, result_temp)); | 1846 return AssignPointerMap(Define(result, result_temp)); |
| 1833 } else if (to.IsSmi()) { | 1847 } else if (to.IsSmi()) { |
| 1834 LOperand* value = UseRegister(instr->value()); | 1848 LOperand* value = UseRegister(instr->value()); |
| 1835 return AssignEnvironment( | 1849 return AssignEnvironment( |
| 1836 DefineAsRegister(new(zone()) LDoubleToSmi(value))); | 1850 DefineAsRegister(new(zone()) LDoubleToSmi(value))); |
| 1837 } else { | 1851 } else { |
| 1838 ASSERT(to.IsInteger32()); | 1852 ASSERT(to.IsInteger32()); |
| 1839 LOperand* value = UseRegister(instr->value()); | 1853 LOperand* value = UseRegister(instr->value()); |
| 1840 return AssignEnvironment( | 1854 LInstruction* result = DefineAsRegister(new(zone()) LDoubleToI(value)); |
| 1841 DefineAsRegister(new(zone()) LDoubleToI(value))); | 1855 if (!instr->CanTruncateToInt32()) { |
| 1856 result = AssignEnvironment(result); |
| 1857 } |
| 1858 return result; |
| 1842 } | 1859 } |
| 1843 } else if (from.IsInteger32()) { | 1860 } else if (from.IsInteger32()) { |
| 1844 info()->MarkAsDeferredCalling(); | 1861 info()->MarkAsDeferredCalling(); |
| 1845 if (to.IsTagged()) { | 1862 if (to.IsTagged()) { |
| 1846 HValue* val = instr->value(); | 1863 HValue* val = instr->value(); |
| 1847 LOperand* value = UseRegister(val); | 1864 LOperand* value = UseRegister(val); |
| 1848 if (!instr->CheckFlag(HValue::kCanOverflow)) { | 1865 if (!instr->CheckFlag(HValue::kCanOverflow)) { |
| 1849 return DefineAsRegister(new(zone()) LSmiTag(value)); | 1866 return DefineAsRegister(new(zone()) LSmiTag(value)); |
| 1850 } else if (val->CheckFlag(HInstruction::kUint32)) { | 1867 } else if (val->CheckFlag(HInstruction::kUint32)) { |
| 1851 LOperand* temp1 = TempRegister(); | 1868 LOperand* temp1 = TempRegister(); |
| 1852 LOperand* temp2 = FixedTemp(xmm1); | 1869 LOperand* temp2 = FixedTemp(xmm1); |
| 1853 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2); | 1870 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2); |
| 1854 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1871 return AssignPointerMap(DefineSameAsFirst(result)); |
| 1855 } else { | 1872 } else { |
| 1856 LNumberTagI* result = new(zone()) LNumberTagI(value); | 1873 LNumberTagI* result = new(zone()) LNumberTagI(value); |
| 1857 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1874 return AssignPointerMap(DefineSameAsFirst(result)); |
| 1858 } | 1875 } |
| 1859 } else if (to.IsSmi()) { | 1876 } else if (to.IsSmi()) { |
| 1860 HValue* val = instr->value(); | 1877 HValue* val = instr->value(); |
| 1861 LOperand* value = UseRegister(val); | 1878 LOperand* value = UseRegister(val); |
| 1862 LInstruction* result = DefineAsRegister(new(zone()) LSmiTag(value)); | 1879 LInstruction* result = DefineAsRegister(new(zone()) LSmiTag(value)); |
| 1863 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1880 if (instr->CheckFlag(HValue::kCanOverflow)) { |
| 1864 ASSERT(val->CheckFlag(HValue::kUint32)); | 1881 ASSERT(val->CheckFlag(HValue::kUint32)); |
| 1865 result = AssignEnvironment(result); | 1882 result = AssignEnvironment(result); |
| 1866 } | 1883 } |
| 1867 return result; | 1884 return result; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 | 1925 |
| 1909 | 1926 |
| 1910 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) { | 1927 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) { |
| 1911 LOperand* value = NULL; | 1928 LOperand* value = NULL; |
| 1912 if (!instr->CanOmitMapChecks()) { | 1929 if (!instr->CanOmitMapChecks()) { |
| 1913 value = UseRegisterAtStart(instr->value()); | 1930 value = UseRegisterAtStart(instr->value()); |
| 1914 if (instr->has_migration_target()) info()->MarkAsDeferredCalling(); | 1931 if (instr->has_migration_target()) info()->MarkAsDeferredCalling(); |
| 1915 } | 1932 } |
| 1916 LCheckMaps* result = new(zone()) LCheckMaps(value); | 1933 LCheckMaps* result = new(zone()) LCheckMaps(value); |
| 1917 if (!instr->CanOmitMapChecks()) { | 1934 if (!instr->CanOmitMapChecks()) { |
| 1935 // Note: Only deopts in deferred code. |
| 1918 AssignEnvironment(result); | 1936 AssignEnvironment(result); |
| 1919 if (instr->has_migration_target()) return AssignPointerMap(result); | 1937 if (instr->has_migration_target()) return AssignPointerMap(result); |
| 1920 } | 1938 } |
| 1921 return result; | 1939 return result; |
| 1922 } | 1940 } |
| 1923 | 1941 |
| 1924 | 1942 |
| 1925 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { | 1943 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { |
| 1926 HValue* value = instr->value(); | 1944 HValue* value = instr->value(); |
| 1927 Representation input_rep = value->representation(); | 1945 Representation input_rep = value->representation(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2007 return instr->RequiresHoleCheck() | 2025 return instr->RequiresHoleCheck() |
| 2008 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) | 2026 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) |
| 2009 : new(zone()) LStoreGlobalCell(value, NULL); | 2027 : new(zone()) LStoreGlobalCell(value, NULL); |
| 2010 } | 2028 } |
| 2011 | 2029 |
| 2012 | 2030 |
| 2013 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { | 2031 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { |
| 2014 LOperand* context = UseRegisterAtStart(instr->value()); | 2032 LOperand* context = UseRegisterAtStart(instr->value()); |
| 2015 LInstruction* result = | 2033 LInstruction* result = |
| 2016 DefineAsRegister(new(zone()) LLoadContextSlot(context)); | 2034 DefineAsRegister(new(zone()) LLoadContextSlot(context)); |
| 2017 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2035 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) { |
| 2036 result = AssignEnvironment(result); |
| 2037 } |
| 2038 return result; |
| 2018 } | 2039 } |
| 2019 | 2040 |
| 2020 | 2041 |
| 2021 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { | 2042 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { |
| 2022 LOperand* context; | 2043 LOperand* context; |
| 2023 LOperand* value; | 2044 LOperand* value; |
| 2024 LOperand* temp; | 2045 LOperand* temp; |
| 2025 context = UseRegister(instr->context()); | 2046 context = UseRegister(instr->context()); |
| 2026 if (instr->NeedsWriteBarrier()) { | 2047 if (instr->NeedsWriteBarrier()) { |
| 2027 value = UseTempRegister(instr->value()); | 2048 value = UseTempRegister(instr->value()); |
| 2028 temp = TempRegister(); | 2049 temp = TempRegister(); |
| 2029 } else { | 2050 } else { |
| 2030 value = UseRegister(instr->value()); | 2051 value = UseRegister(instr->value()); |
| 2031 temp = NULL; | 2052 temp = NULL; |
| 2032 } | 2053 } |
| 2033 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); | 2054 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); |
| 2034 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2055 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) { |
| 2056 result = AssignEnvironment(result); |
| 2057 } |
| 2058 return result; |
| 2035 } | 2059 } |
| 2036 | 2060 |
| 2037 | 2061 |
| 2038 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 2062 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
| 2039 // Use the special mov rax, moffs64 encoding for external | 2063 // Use the special mov rax, moffs64 encoding for external |
| 2040 // memory accesses with 64-bit word-sized values. | 2064 // memory accesses with 64-bit word-sized values. |
| 2041 if (instr->access().IsExternalMemory() && | 2065 if (instr->access().IsExternalMemory() && |
| 2042 instr->access().offset() == 0 && | 2066 instr->access().offset() == 0 && |
| 2043 (instr->access().representation().IsSmi() || | 2067 (instr->access().representation().IsSmi() || |
| 2044 instr->access().representation().IsTagged() || | 2068 instr->access().representation().IsTagged() || |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2069 | 2093 |
| 2070 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { | 2094 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { |
| 2071 return DefineAsRegister(new(zone()) LLoadRoot); | 2095 return DefineAsRegister(new(zone()) LLoadRoot); |
| 2072 } | 2096 } |
| 2073 | 2097 |
| 2074 | 2098 |
| 2075 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2099 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 2076 ASSERT(instr->key()->representation().IsInteger32()); | 2100 ASSERT(instr->key()->representation().IsInteger32()); |
| 2077 ElementsKind elements_kind = instr->elements_kind(); | 2101 ElementsKind elements_kind = instr->elements_kind(); |
| 2078 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2102 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2079 LLoadKeyed* result = NULL; | 2103 LInstruction* result = NULL; |
| 2080 | 2104 |
| 2081 if (!instr->is_typed_elements()) { | 2105 if (!instr->is_typed_elements()) { |
| 2082 LOperand* obj = UseRegisterAtStart(instr->elements()); | 2106 LOperand* obj = UseRegisterAtStart(instr->elements()); |
| 2083 result = new(zone()) LLoadKeyed(obj, key); | 2107 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); |
| 2084 } else { | 2108 } else { |
| 2085 ASSERT( | 2109 ASSERT( |
| 2086 (instr->representation().IsInteger32() && | 2110 (instr->representation().IsInteger32() && |
| 2087 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || | 2111 !(IsDoubleOrFloatElementsKind(elements_kind))) || |
| 2088 (instr->representation().IsDouble() && | 2112 (instr->representation().IsDouble() && |
| 2089 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); | 2113 (IsDoubleOrFloatElementsKind(elements_kind)))); |
| 2090 LOperand* backing_store = UseRegister(instr->elements()); | 2114 LOperand* backing_store = UseRegister(instr->elements()); |
| 2091 result = new(zone()) LLoadKeyed(backing_store, key); | 2115 result = DefineAsRegister(new(zone()) LLoadKeyed(backing_store, key)); |
| 2092 } | 2116 } |
| 2093 | 2117 |
| 2094 DefineAsRegister(result); | 2118 if ((instr->is_external() || instr->is_fixed_typed_array()) ? |
| 2095 bool can_deoptimize = instr->RequiresHoleCheck() || | 2119 // see LCodeGen::DoLoadKeyedExternalArray |
| 2096 (elements_kind == EXTERNAL_UINT32_ELEMENTS) || | 2120 ((elements_kind == EXTERNAL_UINT32_ELEMENTS || |
| 2097 (elements_kind == UINT32_ELEMENTS); | 2121 elements_kind == UINT32_ELEMENTS) && |
| 2098 // An unsigned int array load might overflow and cause a deopt, make sure it | 2122 !instr->CheckFlag(HInstruction::kUint32)) : |
| 2099 // has an environment. | 2123 // see LCodeGen::DoLoadKeyedFixedDoubleArray and |
| 2100 return can_deoptimize ? AssignEnvironment(result) : result; | 2124 // LCodeGen::DoLoadKeyedFixedArray |
| 2125 instr->RequiresHoleCheck()) { |
| 2126 result = AssignEnvironment(result); |
| 2127 } |
| 2128 return result; |
| 2101 } | 2129 } |
| 2102 | 2130 |
| 2103 | 2131 |
| 2104 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 2132 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 2105 LOperand* context = UseFixed(instr->context(), rsi); | 2133 LOperand* context = UseFixed(instr->context(), rsi); |
| 2106 LOperand* object = UseFixed(instr->object(), rdx); | 2134 LOperand* object = UseFixed(instr->object(), rdx); |
| 2107 LOperand* key = UseFixed(instr->key(), rax); | 2135 LOperand* key = UseFixed(instr->key(), rax); |
| 2108 | 2136 |
| 2109 LLoadKeyedGeneric* result = | 2137 LLoadKeyedGeneric* result = |
| 2110 new(zone()) LLoadKeyedGeneric(context, object, key); | 2138 new(zone()) LLoadKeyedGeneric(context, object, key); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2251 val = UseRegisterAtStart(instr->value()); | 2279 val = UseRegisterAtStart(instr->value()); |
| 2252 } else { | 2280 } else { |
| 2253 val = UseRegister(instr->value()); | 2281 val = UseRegister(instr->value()); |
| 2254 } | 2282 } |
| 2255 | 2283 |
| 2256 // We only need a scratch register if we have a write barrier or we | 2284 // We only need a scratch register if we have a write barrier or we |
| 2257 // have a store into the properties array (not in-object-property). | 2285 // have a store into the properties array (not in-object-property). |
| 2258 LOperand* temp = (!is_in_object || needs_write_barrier || | 2286 LOperand* temp = (!is_in_object || needs_write_barrier || |
| 2259 needs_write_barrier_for_map) ? TempRegister() : NULL; | 2287 needs_write_barrier_for_map) ? TempRegister() : NULL; |
| 2260 | 2288 |
| 2261 LStoreNamedField* result = new(zone()) LStoreNamedField(obj, val, temp); | 2289 LInstruction* result = new(zone()) LStoreNamedField(obj, val, temp); |
| 2262 if (instr->field_representation().IsHeapObject()) { | 2290 if (!instr->access().IsExternalMemory() && |
| 2263 if (!instr->value()->type().IsHeapObject()) { | 2291 instr->field_representation().IsHeapObject() && |
| 2264 return AssignEnvironment(result); | 2292 (val->IsConstantOperand() |
| 2265 } | 2293 ? HConstant::cast(instr->value())->HasSmiValue() |
| 2294 : !instr->value()->type().IsHeapObject())) { |
| 2295 result = AssignEnvironment(result); |
| 2266 } | 2296 } |
| 2267 return result; | 2297 return result; |
| 2268 } | 2298 } |
| 2269 | 2299 |
| 2270 | 2300 |
| 2271 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { | 2301 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
| 2272 LOperand* context = UseFixed(instr->context(), rsi); | 2302 LOperand* context = UseFixed(instr->context(), rsi); |
| 2273 LOperand* object = UseFixed(instr->object(), rdx); | 2303 LOperand* object = UseFixed(instr->object(), rdx); |
| 2274 LOperand* value = UseFixed(instr->value(), rax); | 2304 LOperand* value = UseFixed(instr->value(), rax); |
| 2275 | 2305 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2287 DefineFixed(new(zone()) LStringAdd(context, left, right), rax), instr); | 2317 DefineFixed(new(zone()) LStringAdd(context, left, right), rax), instr); |
| 2288 } | 2318 } |
| 2289 | 2319 |
| 2290 | 2320 |
| 2291 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2321 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
| 2292 LOperand* string = UseTempRegister(instr->string()); | 2322 LOperand* string = UseTempRegister(instr->string()); |
| 2293 LOperand* index = UseTempRegister(instr->index()); | 2323 LOperand* index = UseTempRegister(instr->index()); |
| 2294 LOperand* context = UseAny(instr->context()); | 2324 LOperand* context = UseAny(instr->context()); |
| 2295 LStringCharCodeAt* result = | 2325 LStringCharCodeAt* result = |
| 2296 new(zone()) LStringCharCodeAt(context, string, index); | 2326 new(zone()) LStringCharCodeAt(context, string, index); |
| 2297 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2327 return AssignPointerMap(DefineAsRegister(result)); |
| 2298 } | 2328 } |
| 2299 | 2329 |
| 2300 | 2330 |
| 2301 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { | 2331 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
| 2302 LOperand* char_code = UseRegister(instr->value()); | 2332 LOperand* char_code = UseRegister(instr->value()); |
| 2303 LOperand* context = UseAny(instr->context()); | 2333 LOperand* context = UseAny(instr->context()); |
| 2304 LStringCharFromCode* result = | 2334 LStringCharFromCode* result = |
| 2305 new(zone()) LStringCharFromCode(context, char_code); | 2335 new(zone()) LStringCharFromCode(context, char_code); |
| 2306 return AssignPointerMap(DefineAsRegister(result)); | 2336 return AssignPointerMap(DefineAsRegister(result)); |
| 2307 } | 2337 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2527 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2557 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2528 LOperand* object = UseRegister(instr->object()); | 2558 LOperand* object = UseRegister(instr->object()); |
| 2529 LOperand* index = UseTempRegister(instr->index()); | 2559 LOperand* index = UseTempRegister(instr->index()); |
| 2530 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2560 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2531 } | 2561 } |
| 2532 | 2562 |
| 2533 | 2563 |
| 2534 } } // namespace v8::internal | 2564 } } // namespace v8::internal |
| 2535 | 2565 |
| 2536 #endif // V8_TARGET_ARCH_X64 | 2566 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |