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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
998 | 998 |
999 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { | 999 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { |
1000 return new(zone()) LGoto(instr->FirstSuccessor()); | 1000 return new(zone()) LGoto(instr->FirstSuccessor()); |
1001 } | 1001 } |
1002 | 1002 |
1003 | 1003 |
1004 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 1004 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
1005 LInstruction* goto_instr = CheckElideControlInstruction(instr); | 1005 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
1006 if (goto_instr != NULL) return goto_instr; | 1006 if (goto_instr != NULL) return goto_instr; |
1007 | 1007 |
1008 HValue* value = instr->value(); | |
1009 Representation r = value->representation(); | |
1010 HType type = value->type(); | |
1008 ToBooleanStub::Types expected = instr->expected_input_types(); | 1011 ToBooleanStub::Types expected = instr->expected_input_types(); |
1012 if (expected.IsEmpty()) expected = ToBooleanStub::Types::Generic(); | |
1009 | 1013 |
1010 // Tagged values that are not known smis or booleans require a | 1014 bool easy_case = !r.IsTagged() || type.IsBoolean() || type.IsSmi() || |
1011 // deoptimization environment. If the instruction is generic no | 1015 type.IsJSArray() || type.IsHeapNumber() || type.IsString(); |
1012 // environment is needed since all cases are handled. | 1016 LOperand* temp = !easy_case && expected.NeedsMap() ? TempRegister() : NULL; |
1013 HValue* value = instr->value(); | 1017 LInstruction* branch = new(zone()) LBranch(UseRegister(value), temp); |
1014 Representation rep = value->representation(); | 1018 if (!easy_case && |
1015 HType type = value->type(); | 1019 ((!expected.Contains(ToBooleanStub::SMI) && expected.NeedsMap()) || |
1016 if (!rep.IsTagged() || type.IsSmi() || type.IsBoolean()) { | 1020 !expected.IsGeneric())) { |
1017 return new(zone()) LBranch(UseRegister(value), NULL); | 1021 branch = AssignEnvironment(branch); |
1018 } | 1022 } |
1019 | 1023 return branch; |
1020 bool needs_temp = expected.NeedsMap() || expected.IsEmpty(); | |
1021 LOperand* temp = needs_temp ? TempRegister() : NULL; | |
1022 | |
1023 // The Generic stub does not have a deopt, so we need no environment. | |
1024 if (expected.IsGeneric()) { | |
1025 return new(zone()) LBranch(UseRegister(value), temp); | |
1026 } | |
1027 | |
1028 // We need a temporary register when we have to access the map *or* we have | |
1029 // no type info yet, in which case we handle all cases (including the ones | |
1030 // involving maps). | |
1031 return AssignEnvironment(new(zone()) LBranch(UseRegister(value), temp)); | |
1032 } | 1024 } |
1033 | 1025 |
1034 | 1026 |
1035 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { | 1027 LInstruction* LChunkBuilder::DoDebugBreak(HDebugBreak* instr) { |
1036 return new(zone()) LDebugBreak(); | 1028 return new(zone()) LDebugBreak(); |
1037 } | 1029 } |
1038 | 1030 |
1039 | 1031 |
1040 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 1032 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
1041 LInstruction* goto_instr = CheckElideControlInstruction(instr); | 1033 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1214 LOperand* input = UseRegister(instr->value()); | 1206 LOperand* input = UseRegister(instr->value()); |
1215 LOperand* temp = FixedTemp(xmm4); | 1207 LOperand* temp = FixedTemp(xmm4); |
1216 LMathRound* result = new(zone()) LMathRound(input, temp); | 1208 LMathRound* result = new(zone()) LMathRound(input, temp); |
1217 return AssignEnvironment(DefineAsRegister(result)); | 1209 return AssignEnvironment(DefineAsRegister(result)); |
1218 } | 1210 } |
1219 | 1211 |
1220 | 1212 |
1221 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { | 1213 LInstruction* LChunkBuilder::DoMathAbs(HUnaryMathOperation* instr) { |
1222 LOperand* context = UseAny(instr->context()); // Deferred use. | 1214 LOperand* context = UseAny(instr->context()); // Deferred use. |
1223 LOperand* input = UseRegisterAtStart(instr->value()); | 1215 LOperand* input = UseRegisterAtStart(instr->value()); |
1224 LMathAbs* result = new(zone()) LMathAbs(context, input); | 1216 LInstruction* result = |
1225 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1217 DefineSameAsFirst(new(zone()) LMathAbs(context, input)); |
1218 Representation r = instr->value()->representation(); | |
1219 if (!r.IsDouble() && !r.IsSmiOrInteger32()) result = AssignPointerMap(result); | |
1220 if (!r.IsDouble()) result = AssignEnvironment(result); | |
1221 return result; | |
1226 } | 1222 } |
1227 | 1223 |
1228 | 1224 |
1229 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { | 1225 LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* instr) { |
1230 ASSERT(instr->representation().IsDouble()); | 1226 ASSERT(instr->representation().IsDouble()); |
1231 ASSERT(instr->value()->representation().IsDouble()); | 1227 ASSERT(instr->value()->representation().IsDouble()); |
1232 LOperand* input = UseRegisterAtStart(instr->value()); | 1228 LOperand* input = UseRegisterAtStart(instr->value()); |
1233 return MarkAsCall(DefineSameAsFirst(new(zone()) LMathLog(input)), instr); | 1229 return MarkAsCall(DefineSameAsFirst(new(zone()) LMathLog(input)), instr); |
1234 } | 1230 } |
1235 | 1231 |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1894 from = Representation::Tagged(); | 1890 from = Representation::Tagged(); |
1895 } | 1891 } |
1896 // Only mark conversions that might need to allocate as calling rather than | 1892 // Only mark conversions that might need to allocate as calling rather than |
1897 // all changes. This makes simple, non-allocating conversion not have to force | 1893 // all changes. This makes simple, non-allocating conversion not have to force |
1898 // building a stack frame. | 1894 // building a stack frame. |
1899 if (from.IsTagged()) { | 1895 if (from.IsTagged()) { |
1900 if (to.IsDouble()) { | 1896 if (to.IsDouble()) { |
1901 LOperand* value = UseRegister(instr->value()); | 1897 LOperand* value = UseRegister(instr->value()); |
1902 // Temp register only necessary for minus zero check. | 1898 // Temp register only necessary for minus zero check. |
1903 LOperand* temp = TempRegister(); | 1899 LOperand* temp = TempRegister(); |
1904 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); | 1900 LInstruction* result = DefineAsRegister( |
1905 return AssignEnvironment(DefineAsRegister(res)); | 1901 new(zone()) LNumberUntagD(value, temp)); |
1902 if (!instr->value()->representation().IsSmi()) { | |
1903 result = AssignEnvironment(result); | |
1904 } | |
1905 return result; | |
1906 } else if (to.IsSmi()) { | 1906 } else if (to.IsSmi()) { |
1907 HValue* val = instr->value(); | 1907 HValue* val = instr->value(); |
1908 LOperand* value = UseRegister(val); | 1908 LOperand* value = UseRegister(val); |
1909 if (val->type().IsSmi()) { | 1909 if (val->type().IsSmi()) { |
1910 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1910 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
1911 } | 1911 } |
1912 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 1912 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
1913 } else { | 1913 } else { |
1914 ASSERT(to.IsInteger32()); | 1914 ASSERT(to.IsInteger32()); |
1915 HValue* val = instr->value(); | 1915 HValue* val = instr->value(); |
1916 if (val->type().IsSmi() || val->representation().IsSmi()) { | 1916 if (val->type().IsSmi() || val->representation().IsSmi()) { |
1917 LOperand* value = UseRegister(val); | 1917 LOperand* value = UseRegister(val); |
1918 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); | 1918 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); |
1919 } else { | 1919 } else { |
1920 bool truncating = instr->CanTruncateToInt32(); | 1920 bool truncating = instr->CanTruncateToInt32(); |
1921 LOperand* xmm_temp = | 1921 LOperand* xmm_temp = |
1922 (CpuFeatures::IsSafeForSnapshot(SSE2) && !truncating) | 1922 (CpuFeatures::IsSafeForSnapshot(SSE2) && !truncating) |
1923 ? FixedTemp(xmm1) : NULL; | 1923 ? FixedTemp(xmm1) : NULL; |
1924 LTaggedToI* res = new(zone()) LTaggedToI(UseRegister(val), xmm_temp); | 1924 LInstruction* result = DefineSameAsFirst( |
1925 return AssignEnvironment(DefineSameAsFirst(res)); | 1925 new(zone()) LTaggedToI(UseRegister(val), xmm_temp)); |
1926 if (!instr->value()->representation().IsSmi()) { | |
1927 // Note: Only deopts in deferred code. | |
1928 result = AssignEnvironment(result); | |
1929 } | |
1930 return result; | |
1926 } | 1931 } |
1927 } | 1932 } |
1928 } else if (from.IsDouble()) { | 1933 } else if (from.IsDouble()) { |
1929 if (to.IsTagged()) { | 1934 if (to.IsTagged()) { |
1930 info()->MarkAsDeferredCalling(); | 1935 info()->MarkAsDeferredCalling(); |
1931 LOperand* value = UseRegisterAtStart(instr->value()); | 1936 LOperand* value = UseRegisterAtStart(instr->value()); |
1932 LOperand* temp = FLAG_inline_new ? TempRegister() : NULL; | 1937 LOperand* temp = FLAG_inline_new ? TempRegister() : NULL; |
1933 | 1938 |
1934 // Make sure that temp and result_temp are different registers. | 1939 // Make sure that temp and result_temp are different registers. |
1935 LUnallocated* result_temp = TempRegister(); | 1940 LUnallocated* result_temp = TempRegister(); |
1936 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); | 1941 LNumberTagD* result = new(zone()) LNumberTagD(value, temp); |
1937 return AssignPointerMap(Define(result, result_temp)); | 1942 return AssignPointerMap(Define(result, result_temp)); |
1938 } else if (to.IsSmi()) { | 1943 } else if (to.IsSmi()) { |
1939 LOperand* value = UseRegister(instr->value()); | 1944 LOperand* value = UseRegister(instr->value()); |
1940 return AssignEnvironment( | 1945 return AssignEnvironment( |
1941 DefineAsRegister(new(zone()) LDoubleToSmi(value))); | 1946 DefineAsRegister(new(zone()) LDoubleToSmi(value))); |
1942 } else { | 1947 } else { |
1943 ASSERT(to.IsInteger32()); | 1948 ASSERT(to.IsInteger32()); |
1944 bool truncating = instr->CanTruncateToInt32(); | 1949 bool truncating = instr->CanTruncateToInt32(); |
1945 bool needs_temp = CpuFeatures::IsSafeForSnapshot(SSE2) && !truncating; | 1950 bool needs_temp = CpuFeatures::IsSafeForSnapshot(SSE2) && !truncating; |
1946 LOperand* value = needs_temp ? | 1951 LOperand* value = needs_temp ? |
1947 UseTempRegister(instr->value()) : UseRegister(instr->value()); | 1952 UseTempRegister(instr->value()) : UseRegister(instr->value()); |
1948 LOperand* temp = needs_temp ? TempRegister() : NULL; | 1953 LOperand* temp = needs_temp ? TempRegister() : NULL; |
1949 return AssignEnvironment( | 1954 LInstruction* result = |
1950 DefineAsRegister(new(zone()) LDoubleToI(value, temp))); | 1955 DefineAsRegister(new(zone()) LDoubleToI(value, temp)); |
1956 if (!instr->CanTruncateToInt32()) { | |
Yang
2014/03/25 09:58:24
we defined the bool "truncating" that we could reu
Sven Panne
2014/03/25 10:05:10
Done.
| |
1957 result = AssignEnvironment(result); | |
1958 } | |
1959 return result; | |
1951 } | 1960 } |
1952 } else if (from.IsInteger32()) { | 1961 } else if (from.IsInteger32()) { |
1953 info()->MarkAsDeferredCalling(); | 1962 info()->MarkAsDeferredCalling(); |
1954 if (to.IsTagged()) { | 1963 if (to.IsTagged()) { |
1955 HValue* val = instr->value(); | 1964 HValue* val = instr->value(); |
1956 LOperand* value = UseRegister(val); | 1965 LOperand* value = UseRegister(val); |
1957 if (!instr->CheckFlag(HValue::kCanOverflow)) { | 1966 if (!instr->CheckFlag(HValue::kCanOverflow)) { |
1958 return DefineSameAsFirst(new(zone()) LSmiTag(value)); | 1967 return DefineSameAsFirst(new(zone()) LSmiTag(value)); |
1959 } else if (val->CheckFlag(HInstruction::kUint32)) { | 1968 } else if (val->CheckFlag(HInstruction::kUint32)) { |
1960 LOperand* temp1 = TempRegister(); | 1969 LOperand* temp1 = TempRegister(); |
1961 LOperand* temp2 = CpuFeatures::IsSupported(SSE2) ? FixedTemp(xmm1) | 1970 LOperand* temp2 = CpuFeatures::IsSupported(SSE2) ? FixedTemp(xmm1) |
1962 : NULL; | 1971 : NULL; |
1963 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2); | 1972 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2); |
1964 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1973 return AssignPointerMap(DefineSameAsFirst(result)); |
1965 } else { | 1974 } else { |
1966 LOperand* temp = TempRegister(); | 1975 LOperand* temp = TempRegister(); |
1967 LNumberTagI* result = new(zone()) LNumberTagI(value, temp); | 1976 LNumberTagI* result = new(zone()) LNumberTagI(value, temp); |
1968 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); | 1977 return AssignPointerMap(DefineSameAsFirst(result)); |
1969 } | 1978 } |
1970 } else if (to.IsSmi()) { | 1979 } else if (to.IsSmi()) { |
1971 HValue* val = instr->value(); | 1980 HValue* val = instr->value(); |
1972 LOperand* value = UseRegister(val); | 1981 LOperand* value = UseRegister(val); |
1973 LInstruction* result = DefineSameAsFirst(new(zone()) LSmiTag(value)); | 1982 LInstruction* result = DefineSameAsFirst(new(zone()) LSmiTag(value)); |
1974 if (instr->CheckFlag(HValue::kCanOverflow)) { | 1983 if (instr->CheckFlag(HValue::kCanOverflow)) { |
1975 result = AssignEnvironment(result); | 1984 result = AssignEnvironment(result); |
1976 } | 1985 } |
1977 return result; | 1986 return result; |
1978 } else { | 1987 } else { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2024 | 2033 |
2025 | 2034 |
2026 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) { | 2035 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) { |
2027 LOperand* value = NULL; | 2036 LOperand* value = NULL; |
2028 if (!instr->CanOmitMapChecks()) { | 2037 if (!instr->CanOmitMapChecks()) { |
2029 value = UseRegisterAtStart(instr->value()); | 2038 value = UseRegisterAtStart(instr->value()); |
2030 if (instr->has_migration_target()) info()->MarkAsDeferredCalling(); | 2039 if (instr->has_migration_target()) info()->MarkAsDeferredCalling(); |
2031 } | 2040 } |
2032 LCheckMaps* result = new(zone()) LCheckMaps(value); | 2041 LCheckMaps* result = new(zone()) LCheckMaps(value); |
2033 if (!instr->CanOmitMapChecks()) { | 2042 if (!instr->CanOmitMapChecks()) { |
2043 // Note: Only deopts in deferred code. | |
2034 AssignEnvironment(result); | 2044 AssignEnvironment(result); |
2035 if (instr->has_migration_target()) return AssignPointerMap(result); | 2045 if (instr->has_migration_target()) return AssignPointerMap(result); |
2036 } | 2046 } |
2037 return result; | 2047 return result; |
2038 } | 2048 } |
2039 | 2049 |
2040 | 2050 |
2041 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { | 2051 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { |
2042 HValue* value = instr->value(); | 2052 HValue* value = instr->value(); |
2043 Representation input_rep = value->representation(); | 2053 Representation input_rep = value->representation(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2132 LStoreGlobalCell* result = | 2142 LStoreGlobalCell* result = |
2133 new(zone()) LStoreGlobalCell(UseRegister(instr->value())); | 2143 new(zone()) LStoreGlobalCell(UseRegister(instr->value())); |
2134 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2144 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
2135 } | 2145 } |
2136 | 2146 |
2137 | 2147 |
2138 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { | 2148 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { |
2139 LOperand* context = UseRegisterAtStart(instr->value()); | 2149 LOperand* context = UseRegisterAtStart(instr->value()); |
2140 LInstruction* result = | 2150 LInstruction* result = |
2141 DefineAsRegister(new(zone()) LLoadContextSlot(context)); | 2151 DefineAsRegister(new(zone()) LLoadContextSlot(context)); |
2142 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2152 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) { |
2153 result = AssignEnvironment(result); | |
2154 } | |
2155 return result; | |
2143 } | 2156 } |
2144 | 2157 |
2145 | 2158 |
2146 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { | 2159 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { |
2147 LOperand* value; | 2160 LOperand* value; |
2148 LOperand* temp; | 2161 LOperand* temp; |
2149 LOperand* context = UseRegister(instr->context()); | 2162 LOperand* context = UseRegister(instr->context()); |
2150 if (instr->NeedsWriteBarrier()) { | 2163 if (instr->NeedsWriteBarrier()) { |
2151 value = UseTempRegister(instr->value()); | 2164 value = UseTempRegister(instr->value()); |
2152 temp = TempRegister(); | 2165 temp = TempRegister(); |
2153 } else { | 2166 } else { |
2154 value = UseRegister(instr->value()); | 2167 value = UseRegister(instr->value()); |
2155 temp = NULL; | 2168 temp = NULL; |
2156 } | 2169 } |
2157 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); | 2170 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); |
2158 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2171 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) { |
2172 result = AssignEnvironment(result); | |
2173 } | |
2174 return result; | |
2159 } | 2175 } |
2160 | 2176 |
2161 | 2177 |
2162 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { | 2178 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { |
2163 LOperand* obj = (instr->access().IsExternalMemory() && | 2179 LOperand* obj = (instr->access().IsExternalMemory() && |
2164 instr->access().offset() == 0) | 2180 instr->access().offset() == 0) |
2165 ? UseRegisterOrConstantAtStart(instr->object()) | 2181 ? UseRegisterOrConstantAtStart(instr->object()) |
2166 : UseRegisterAtStart(instr->object()); | 2182 : UseRegisterAtStart(instr->object()); |
2167 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); | 2183 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); |
2168 } | 2184 } |
(...skipping 21 matching lines...) Expand all Loading... | |
2190 | 2206 |
2191 | 2207 |
2192 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2208 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
2193 ASSERT(instr->key()->representation().IsSmiOrInteger32()); | 2209 ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
2194 ElementsKind elements_kind = instr->elements_kind(); | 2210 ElementsKind elements_kind = instr->elements_kind(); |
2195 bool clobbers_key = ExternalArrayOpRequiresTemp( | 2211 bool clobbers_key = ExternalArrayOpRequiresTemp( |
2196 instr->key()->representation(), elements_kind); | 2212 instr->key()->representation(), elements_kind); |
2197 LOperand* key = clobbers_key | 2213 LOperand* key = clobbers_key |
2198 ? UseTempRegister(instr->key()) | 2214 ? UseTempRegister(instr->key()) |
2199 : UseRegisterOrConstantAtStart(instr->key()); | 2215 : UseRegisterOrConstantAtStart(instr->key()); |
2200 LLoadKeyed* result = NULL; | 2216 LInstruction* result = NULL; |
2201 | 2217 |
2202 if (!instr->is_typed_elements()) { | 2218 if (!instr->is_typed_elements()) { |
2203 LOperand* obj = UseRegisterAtStart(instr->elements()); | 2219 LOperand* obj = UseRegisterAtStart(instr->elements()); |
2204 result = new(zone()) LLoadKeyed(obj, key); | 2220 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); |
2205 } else { | 2221 } else { |
2206 ASSERT( | 2222 ASSERT( |
2207 (instr->representation().IsInteger32() && | 2223 (instr->representation().IsInteger32() && |
2208 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || | 2224 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || |
2209 (instr->representation().IsDouble() && | 2225 (instr->representation().IsDouble() && |
2210 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); | 2226 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); |
2211 LOperand* backing_store = UseRegister(instr->elements()); | 2227 LOperand* backing_store = UseRegister(instr->elements()); |
2212 result = new(zone()) LLoadKeyed(backing_store, key); | 2228 result = DefineAsRegister(new(zone()) LLoadKeyed(backing_store, key)); |
2213 } | 2229 } |
2214 | 2230 |
2215 DefineAsRegister(result); | 2231 if ((instr->is_external() || instr->is_fixed_typed_array()) ? |
2216 bool can_deoptimize = instr->RequiresHoleCheck() || | 2232 // see LCodeGen::DoLoadKeyedExternalArray |
2217 (elements_kind == EXTERNAL_UINT32_ELEMENTS); | 2233 ((instr->elements_kind() == EXTERNAL_UINT32_ELEMENTS || |
2218 // An unsigned int array load might overflow and cause a deopt, make sure it | 2234 instr->elements_kind() == UINT32_ELEMENTS) && |
2219 // has an environment. | 2235 !instr->CheckFlag(HInstruction::kUint32)) : |
2220 return can_deoptimize ? AssignEnvironment(result) : result; | 2236 // see LCodeGen::DoLoadKeyedFixedDoubleArray and |
2237 // LCodeGen::DoLoadKeyedFixedArray | |
2238 instr->RequiresHoleCheck()) { | |
2239 result = AssignEnvironment(result); | |
2240 } | |
2241 return result; | |
2221 } | 2242 } |
2222 | 2243 |
2223 | 2244 |
2224 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 2245 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
2225 LOperand* context = UseFixed(instr->context(), esi); | 2246 LOperand* context = UseFixed(instr->context(), esi); |
2226 LOperand* object = UseFixed(instr->object(), edx); | 2247 LOperand* object = UseFixed(instr->object(), edx); |
2227 LOperand* key = UseFixed(instr->key(), ecx); | 2248 LOperand* key = UseFixed(instr->key(), ecx); |
2228 | 2249 |
2229 LLoadKeyedGeneric* result = | 2250 LLoadKeyedGeneric* result = |
2230 new(zone()) LLoadKeyedGeneric(context, object, key); | 2251 new(zone()) LLoadKeyedGeneric(context, object, key); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2401 } | 2422 } |
2402 | 2423 |
2403 // We only need a scratch register if we have a write barrier or we | 2424 // We only need a scratch register if we have a write barrier or we |
2404 // have a store into the properties array (not in-object-property). | 2425 // have a store into the properties array (not in-object-property). |
2405 LOperand* temp = (!is_in_object || needs_write_barrier || | 2426 LOperand* temp = (!is_in_object || needs_write_barrier || |
2406 needs_write_barrier_for_map) ? TempRegister() : NULL; | 2427 needs_write_barrier_for_map) ? TempRegister() : NULL; |
2407 | 2428 |
2408 // We need a temporary register for write barrier of the map field. | 2429 // We need a temporary register for write barrier of the map field. |
2409 LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL; | 2430 LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL; |
2410 | 2431 |
2411 LStoreNamedField* result = | 2432 LInstruction* result = |
2412 new(zone()) LStoreNamedField(obj, val, temp, temp_map); | 2433 new(zone()) LStoreNamedField(obj, val, temp, temp_map); |
2413 if (instr->field_representation().IsHeapObject()) { | 2434 if (!instr->access().IsExternalMemory() && |
2414 if (!instr->value()->type().IsHeapObject()) { | 2435 instr->field_representation().IsHeapObject() && |
2415 return AssignEnvironment(result); | 2436 (val->IsConstantOperand() |
2416 } | 2437 ? HConstant::cast(instr->value())->HasSmiValue() |
2438 : !instr->value()->type().IsHeapObject())) { | |
2439 result = AssignEnvironment(result); | |
2417 } | 2440 } |
2418 return result; | 2441 return result; |
2419 } | 2442 } |
2420 | 2443 |
2421 | 2444 |
2422 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { | 2445 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { |
2423 LOperand* context = UseFixed(instr->context(), esi); | 2446 LOperand* context = UseFixed(instr->context(), esi); |
2424 LOperand* object = UseFixed(instr->object(), edx); | 2447 LOperand* object = UseFixed(instr->object(), edx); |
2425 LOperand* value = UseFixed(instr->value(), eax); | 2448 LOperand* value = UseFixed(instr->value(), eax); |
2426 | 2449 |
(...skipping 11 matching lines...) Expand all Loading... | |
2438 return MarkAsCall(DefineFixed(string_add, eax), instr); | 2461 return MarkAsCall(DefineFixed(string_add, eax), instr); |
2439 } | 2462 } |
2440 | 2463 |
2441 | 2464 |
2442 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2465 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
2443 LOperand* string = UseTempRegister(instr->string()); | 2466 LOperand* string = UseTempRegister(instr->string()); |
2444 LOperand* index = UseTempRegister(instr->index()); | 2467 LOperand* index = UseTempRegister(instr->index()); |
2445 LOperand* context = UseAny(instr->context()); | 2468 LOperand* context = UseAny(instr->context()); |
2446 LStringCharCodeAt* result = | 2469 LStringCharCodeAt* result = |
2447 new(zone()) LStringCharCodeAt(context, string, index); | 2470 new(zone()) LStringCharCodeAt(context, string, index); |
2448 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2471 return AssignPointerMap(DefineAsRegister(result)); |
2449 } | 2472 } |
2450 | 2473 |
2451 | 2474 |
2452 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { | 2475 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
2453 LOperand* char_code = UseRegister(instr->value()); | 2476 LOperand* char_code = UseRegister(instr->value()); |
2454 LOperand* context = UseAny(instr->context()); | 2477 LOperand* context = UseAny(instr->context()); |
2455 LStringCharFromCode* result = | 2478 LStringCharFromCode* result = |
2456 new(zone()) LStringCharFromCode(context, char_code); | 2479 new(zone()) LStringCharFromCode(context, char_code); |
2457 return AssignPointerMap(DefineAsRegister(result)); | 2480 return AssignPointerMap(DefineAsRegister(result)); |
2458 } | 2481 } |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2681 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2704 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2682 LOperand* object = UseRegister(instr->object()); | 2705 LOperand* object = UseRegister(instr->object()); |
2683 LOperand* index = UseTempRegister(instr->index()); | 2706 LOperand* index = UseTempRegister(instr->index()); |
2684 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2707 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2685 } | 2708 } |
2686 | 2709 |
2687 | 2710 |
2688 } } // namespace v8::internal | 2711 } } // namespace v8::internal |
2689 | 2712 |
2690 #endif // V8_TARGET_ARCH_IA32 | 2713 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |