Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: src/ia32/lithium-ia32.cc

Issue 210783003: Only assign environments when they are actually needed. (ia32 only) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Feedback. Rebased. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 (!truncating) result = AssignEnvironment(result);
1957 return result;
1951 } 1958 }
1952 } else if (from.IsInteger32()) { 1959 } else if (from.IsInteger32()) {
1953 info()->MarkAsDeferredCalling(); 1960 info()->MarkAsDeferredCalling();
1954 if (to.IsTagged()) { 1961 if (to.IsTagged()) {
1955 HValue* val = instr->value(); 1962 HValue* val = instr->value();
1956 LOperand* value = UseRegister(val); 1963 LOperand* value = UseRegister(val);
1957 if (!instr->CheckFlag(HValue::kCanOverflow)) { 1964 if (!instr->CheckFlag(HValue::kCanOverflow)) {
1958 return DefineSameAsFirst(new(zone()) LSmiTag(value)); 1965 return DefineSameAsFirst(new(zone()) LSmiTag(value));
1959 } else if (val->CheckFlag(HInstruction::kUint32)) { 1966 } else if (val->CheckFlag(HInstruction::kUint32)) {
1960 LOperand* temp1 = TempRegister(); 1967 LOperand* temp1 = TempRegister();
1961 LOperand* temp2 = CpuFeatures::IsSupported(SSE2) ? FixedTemp(xmm1) 1968 LOperand* temp2 = CpuFeatures::IsSupported(SSE2) ? FixedTemp(xmm1)
1962 : NULL; 1969 : NULL;
1963 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2); 1970 LNumberTagU* result = new(zone()) LNumberTagU(value, temp1, temp2);
1964 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1971 return AssignPointerMap(DefineSameAsFirst(result));
1965 } else { 1972 } else {
1966 LOperand* temp = TempRegister(); 1973 LOperand* temp = TempRegister();
1967 LNumberTagI* result = new(zone()) LNumberTagI(value, temp); 1974 LNumberTagI* result = new(zone()) LNumberTagI(value, temp);
1968 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1975 return AssignPointerMap(DefineSameAsFirst(result));
1969 } 1976 }
1970 } else if (to.IsSmi()) { 1977 } else if (to.IsSmi()) {
1971 HValue* val = instr->value(); 1978 HValue* val = instr->value();
1972 LOperand* value = UseRegister(val); 1979 LOperand* value = UseRegister(val);
1973 LInstruction* result = DefineSameAsFirst(new(zone()) LSmiTag(value)); 1980 LInstruction* result = DefineSameAsFirst(new(zone()) LSmiTag(value));
1974 if (instr->CheckFlag(HValue::kCanOverflow)) { 1981 if (instr->CheckFlag(HValue::kCanOverflow)) {
1975 result = AssignEnvironment(result); 1982 result = AssignEnvironment(result);
1976 } 1983 }
1977 return result; 1984 return result;
1978 } else { 1985 } else {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 2031
2025 2032
2026 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) { 2033 LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
2027 LOperand* value = NULL; 2034 LOperand* value = NULL;
2028 if (!instr->CanOmitMapChecks()) { 2035 if (!instr->CanOmitMapChecks()) {
2029 value = UseRegisterAtStart(instr->value()); 2036 value = UseRegisterAtStart(instr->value());
2030 if (instr->has_migration_target()) info()->MarkAsDeferredCalling(); 2037 if (instr->has_migration_target()) info()->MarkAsDeferredCalling();
2031 } 2038 }
2032 LCheckMaps* result = new(zone()) LCheckMaps(value); 2039 LCheckMaps* result = new(zone()) LCheckMaps(value);
2033 if (!instr->CanOmitMapChecks()) { 2040 if (!instr->CanOmitMapChecks()) {
2041 // Note: Only deopts in deferred code.
2034 AssignEnvironment(result); 2042 AssignEnvironment(result);
2035 if (instr->has_migration_target()) return AssignPointerMap(result); 2043 if (instr->has_migration_target()) return AssignPointerMap(result);
2036 } 2044 }
2037 return result; 2045 return result;
2038 } 2046 }
2039 2047
2040 2048
2041 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { 2049 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) {
2042 HValue* value = instr->value(); 2050 HValue* value = instr->value();
2043 Representation input_rep = value->representation(); 2051 Representation input_rep = value->representation();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 LStoreGlobalCell* result = 2140 LStoreGlobalCell* result =
2133 new(zone()) LStoreGlobalCell(UseRegister(instr->value())); 2141 new(zone()) LStoreGlobalCell(UseRegister(instr->value()));
2134 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; 2142 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
2135 } 2143 }
2136 2144
2137 2145
2138 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { 2146 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
2139 LOperand* context = UseRegisterAtStart(instr->value()); 2147 LOperand* context = UseRegisterAtStart(instr->value());
2140 LInstruction* result = 2148 LInstruction* result =
2141 DefineAsRegister(new(zone()) LLoadContextSlot(context)); 2149 DefineAsRegister(new(zone()) LLoadContextSlot(context));
2142 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; 2150 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
2151 result = AssignEnvironment(result);
2152 }
2153 return result;
2143 } 2154 }
2144 2155
2145 2156
2146 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { 2157 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
2147 LOperand* value; 2158 LOperand* value;
2148 LOperand* temp; 2159 LOperand* temp;
2149 LOperand* context = UseRegister(instr->context()); 2160 LOperand* context = UseRegister(instr->context());
2150 if (instr->NeedsWriteBarrier()) { 2161 if (instr->NeedsWriteBarrier()) {
2151 value = UseTempRegister(instr->value()); 2162 value = UseTempRegister(instr->value());
2152 temp = TempRegister(); 2163 temp = TempRegister();
2153 } else { 2164 } else {
2154 value = UseRegister(instr->value()); 2165 value = UseRegister(instr->value());
2155 temp = NULL; 2166 temp = NULL;
2156 } 2167 }
2157 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp); 2168 LInstruction* result = new(zone()) LStoreContextSlot(context, value, temp);
2158 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; 2169 if (instr->RequiresHoleCheck() && instr->DeoptimizesOnHole()) {
2170 result = AssignEnvironment(result);
2171 }
2172 return result;
2159 } 2173 }
2160 2174
2161 2175
2162 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { 2176 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
2163 LOperand* obj = (instr->access().IsExternalMemory() && 2177 LOperand* obj = (instr->access().IsExternalMemory() &&
2164 instr->access().offset() == 0) 2178 instr->access().offset() == 0)
2165 ? UseRegisterOrConstantAtStart(instr->object()) 2179 ? UseRegisterOrConstantAtStart(instr->object())
2166 : UseRegisterAtStart(instr->object()); 2180 : UseRegisterAtStart(instr->object());
2167 return DefineAsRegister(new(zone()) LLoadNamedField(obj)); 2181 return DefineAsRegister(new(zone()) LLoadNamedField(obj));
2168 } 2182 }
(...skipping 21 matching lines...) Expand all
2190 2204
2191 2205
2192 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { 2206 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
2193 ASSERT(instr->key()->representation().IsSmiOrInteger32()); 2207 ASSERT(instr->key()->representation().IsSmiOrInteger32());
2194 ElementsKind elements_kind = instr->elements_kind(); 2208 ElementsKind elements_kind = instr->elements_kind();
2195 bool clobbers_key = ExternalArrayOpRequiresTemp( 2209 bool clobbers_key = ExternalArrayOpRequiresTemp(
2196 instr->key()->representation(), elements_kind); 2210 instr->key()->representation(), elements_kind);
2197 LOperand* key = clobbers_key 2211 LOperand* key = clobbers_key
2198 ? UseTempRegister(instr->key()) 2212 ? UseTempRegister(instr->key())
2199 : UseRegisterOrConstantAtStart(instr->key()); 2213 : UseRegisterOrConstantAtStart(instr->key());
2200 LLoadKeyed* result = NULL; 2214 LInstruction* result = NULL;
2201 2215
2202 if (!instr->is_typed_elements()) { 2216 if (!instr->is_typed_elements()) {
2203 LOperand* obj = UseRegisterAtStart(instr->elements()); 2217 LOperand* obj = UseRegisterAtStart(instr->elements());
2204 result = new(zone()) LLoadKeyed(obj, key); 2218 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key));
2205 } else { 2219 } else {
2206 ASSERT( 2220 ASSERT(
2207 (instr->representation().IsInteger32() && 2221 (instr->representation().IsInteger32() &&
2208 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || 2222 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) ||
2209 (instr->representation().IsDouble() && 2223 (instr->representation().IsDouble() &&
2210 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); 2224 (IsDoubleOrFloatElementsKind(instr->elements_kind()))));
2211 LOperand* backing_store = UseRegister(instr->elements()); 2225 LOperand* backing_store = UseRegister(instr->elements());
2212 result = new(zone()) LLoadKeyed(backing_store, key); 2226 result = DefineAsRegister(new(zone()) LLoadKeyed(backing_store, key));
2213 } 2227 }
2214 2228
2215 DefineAsRegister(result); 2229 if ((instr->is_external() || instr->is_fixed_typed_array()) ?
2216 bool can_deoptimize = instr->RequiresHoleCheck() || 2230 // see LCodeGen::DoLoadKeyedExternalArray
2217 (elements_kind == EXTERNAL_UINT32_ELEMENTS); 2231 ((instr->elements_kind() == EXTERNAL_UINT32_ELEMENTS ||
2218 // An unsigned int array load might overflow and cause a deopt, make sure it 2232 instr->elements_kind() == UINT32_ELEMENTS) &&
2219 // has an environment. 2233 !instr->CheckFlag(HInstruction::kUint32)) :
2220 return can_deoptimize ? AssignEnvironment(result) : result; 2234 // see LCodeGen::DoLoadKeyedFixedDoubleArray and
2235 // LCodeGen::DoLoadKeyedFixedArray
2236 instr->RequiresHoleCheck()) {
2237 result = AssignEnvironment(result);
2238 }
2239 return result;
2221 } 2240 }
2222 2241
2223 2242
2224 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 2243 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
2225 LOperand* context = UseFixed(instr->context(), esi); 2244 LOperand* context = UseFixed(instr->context(), esi);
2226 LOperand* object = UseFixed(instr->object(), edx); 2245 LOperand* object = UseFixed(instr->object(), edx);
2227 LOperand* key = UseFixed(instr->key(), ecx); 2246 LOperand* key = UseFixed(instr->key(), ecx);
2228 2247
2229 LLoadKeyedGeneric* result = 2248 LLoadKeyedGeneric* result =
2230 new(zone()) LLoadKeyedGeneric(context, object, key); 2249 new(zone()) LLoadKeyedGeneric(context, object, key);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2401 } 2420 }
2402 2421
2403 // We only need a scratch register if we have a write barrier or we 2422 // 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). 2423 // have a store into the properties array (not in-object-property).
2405 LOperand* temp = (!is_in_object || needs_write_barrier || 2424 LOperand* temp = (!is_in_object || needs_write_barrier ||
2406 needs_write_barrier_for_map) ? TempRegister() : NULL; 2425 needs_write_barrier_for_map) ? TempRegister() : NULL;
2407 2426
2408 // We need a temporary register for write barrier of the map field. 2427 // We need a temporary register for write barrier of the map field.
2409 LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL; 2428 LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL;
2410 2429
2411 LStoreNamedField* result = 2430 LInstruction* result =
2412 new(zone()) LStoreNamedField(obj, val, temp, temp_map); 2431 new(zone()) LStoreNamedField(obj, val, temp, temp_map);
2413 if (instr->field_representation().IsHeapObject()) { 2432 if (!instr->access().IsExternalMemory() &&
2414 if (!instr->value()->type().IsHeapObject()) { 2433 instr->field_representation().IsHeapObject() &&
2415 return AssignEnvironment(result); 2434 (val->IsConstantOperand()
2416 } 2435 ? HConstant::cast(instr->value())->HasSmiValue()
2436 : !instr->value()->type().IsHeapObject())) {
2437 result = AssignEnvironment(result);
2417 } 2438 }
2418 return result; 2439 return result;
2419 } 2440 }
2420 2441
2421 2442
2422 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { 2443 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
2423 LOperand* context = UseFixed(instr->context(), esi); 2444 LOperand* context = UseFixed(instr->context(), esi);
2424 LOperand* object = UseFixed(instr->object(), edx); 2445 LOperand* object = UseFixed(instr->object(), edx);
2425 LOperand* value = UseFixed(instr->value(), eax); 2446 LOperand* value = UseFixed(instr->value(), eax);
2426 2447
(...skipping 11 matching lines...) Expand all
2438 return MarkAsCall(DefineFixed(string_add, eax), instr); 2459 return MarkAsCall(DefineFixed(string_add, eax), instr);
2439 } 2460 }
2440 2461
2441 2462
2442 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { 2463 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
2443 LOperand* string = UseTempRegister(instr->string()); 2464 LOperand* string = UseTempRegister(instr->string());
2444 LOperand* index = UseTempRegister(instr->index()); 2465 LOperand* index = UseTempRegister(instr->index());
2445 LOperand* context = UseAny(instr->context()); 2466 LOperand* context = UseAny(instr->context());
2446 LStringCharCodeAt* result = 2467 LStringCharCodeAt* result =
2447 new(zone()) LStringCharCodeAt(context, string, index); 2468 new(zone()) LStringCharCodeAt(context, string, index);
2448 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); 2469 return AssignPointerMap(DefineAsRegister(result));
2449 } 2470 }
2450 2471
2451 2472
2452 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { 2473 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) {
2453 LOperand* char_code = UseRegister(instr->value()); 2474 LOperand* char_code = UseRegister(instr->value());
2454 LOperand* context = UseAny(instr->context()); 2475 LOperand* context = UseAny(instr->context());
2455 LStringCharFromCode* result = 2476 LStringCharFromCode* result =
2456 new(zone()) LStringCharFromCode(context, char_code); 2477 new(zone()) LStringCharFromCode(context, char_code);
2457 return AssignPointerMap(DefineAsRegister(result)); 2478 return AssignPointerMap(DefineAsRegister(result));
2458 } 2479 }
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2681 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2702 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2682 LOperand* object = UseRegister(instr->object()); 2703 LOperand* object = UseRegister(instr->object());
2683 LOperand* index = UseTempRegister(instr->index()); 2704 LOperand* index = UseTempRegister(instr->index());
2684 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2705 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2685 } 2706 }
2686 2707
2687 2708
2688 } } // namespace v8::internal 2709 } } // namespace v8::internal
2689 2710
2690 #endif // V8_TARGET_ARCH_IA32 2711 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698