| 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 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { | 2030 LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { |
| 2031 LOperand* value = UseRegister(instr->value()); | 2031 LOperand* value = UseRegister(instr->value()); |
| 2032 // Use a temp to check the value in the cell in the case where we perform | 2032 // Use a temp to check the value in the cell in the case where we perform |
| 2033 // a hole check. | 2033 // a hole check. |
| 2034 return instr->RequiresHoleCheck() | 2034 return instr->RequiresHoleCheck() |
| 2035 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) | 2035 ? AssignEnvironment(new(zone()) LStoreGlobalCell(value, TempRegister())) |
| 2036 : new(zone()) LStoreGlobalCell(value, NULL); | 2036 : new(zone()) LStoreGlobalCell(value, NULL); |
| 2037 } | 2037 } |
| 2038 | 2038 |
| 2039 | 2039 |
| 2040 LInstruction* LChunkBuilder::DoStoreGlobalGeneric(HStoreGlobalGeneric* instr) { | |
| 2041 LOperand* context = UseFixed(instr->context(), cp); | |
| 2042 LOperand* global_object = UseFixed(instr->global_object(), r1); | |
| 2043 LOperand* value = UseFixed(instr->value(), r0); | |
| 2044 LStoreGlobalGeneric* result = | |
| 2045 new(zone()) LStoreGlobalGeneric(context, global_object, value); | |
| 2046 return MarkAsCall(result, instr); | |
| 2047 } | |
| 2048 | |
| 2049 | |
| 2050 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { | 2040 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { |
| 2051 LOperand* context = UseRegisterAtStart(instr->value()); | 2041 LOperand* context = UseRegisterAtStart(instr->value()); |
| 2052 LInstruction* result = | 2042 LInstruction* result = |
| 2053 DefineAsRegister(new(zone()) LLoadContextSlot(context)); | 2043 DefineAsRegister(new(zone()) LLoadContextSlot(context)); |
| 2054 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; | 2044 return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result; |
| 2055 } | 2045 } |
| 2056 | 2046 |
| 2057 | 2047 |
| 2058 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { | 2048 LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) { |
| 2059 LOperand* context; | 2049 LOperand* context; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2103 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); | 2093 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); |
| 2104 } | 2094 } |
| 2105 | 2095 |
| 2106 | 2096 |
| 2107 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2097 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 2108 ASSERT(instr->key()->representation().IsSmiOrInteger32()); | 2098 ASSERT(instr->key()->representation().IsSmiOrInteger32()); |
| 2109 ElementsKind elements_kind = instr->elements_kind(); | 2099 ElementsKind elements_kind = instr->elements_kind(); |
| 2110 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2100 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2111 LLoadKeyed* result = NULL; | 2101 LLoadKeyed* result = NULL; |
| 2112 | 2102 |
| 2113 if (!instr->is_external()) { | 2103 if (!instr->is_typed_elements()) { |
| 2114 LOperand* obj = NULL; | 2104 LOperand* obj = NULL; |
| 2115 if (instr->representation().IsDouble()) { | 2105 if (instr->representation().IsDouble()) { |
| 2116 obj = UseRegister(instr->elements()); | 2106 obj = UseRegister(instr->elements()); |
| 2117 } else { | 2107 } else { |
| 2118 ASSERT(instr->representation().IsSmiOrTagged()); | 2108 ASSERT(instr->representation().IsSmiOrTagged()); |
| 2119 obj = UseRegisterAtStart(instr->elements()); | 2109 obj = UseRegisterAtStart(instr->elements()); |
| 2120 } | 2110 } |
| 2121 result = new(zone()) LLoadKeyed(obj, key); | 2111 result = new(zone()) LLoadKeyed(obj, key); |
| 2122 } else { | 2112 } else { |
| 2123 ASSERT( | 2113 ASSERT( |
| 2124 (instr->representation().IsInteger32() && | 2114 (instr->representation().IsInteger32() && |
| 2125 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | 2115 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
| 2126 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 2127 (instr->representation().IsDouble() && | 2116 (instr->representation().IsDouble() && |
| 2128 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | 2117 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
| 2129 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | 2118 LOperand* backing_store = UseRegister(instr->elements()); |
| 2130 LOperand* external_pointer = UseRegister(instr->elements()); | 2119 result = new(zone()) LLoadKeyed(backing_store, key); |
| 2131 result = new(zone()) LLoadKeyed(external_pointer, key); | |
| 2132 } | 2120 } |
| 2133 | 2121 |
| 2134 DefineAsRegister(result); | 2122 DefineAsRegister(result); |
| 2135 // An unsigned int array load might overflow and cause a deopt, make sure it | 2123 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 2136 // has an environment. | 2124 // has an environment. |
| 2137 bool can_deoptimize = instr->RequiresHoleCheck() || | 2125 bool can_deoptimize = instr->RequiresHoleCheck() || |
| 2138 (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS); | 2126 elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS || |
| 2127 elements_kind == UINT32_ELEMENTS; |
| 2139 return can_deoptimize ? AssignEnvironment(result) : result; | 2128 return can_deoptimize ? AssignEnvironment(result) : result; |
| 2140 } | 2129 } |
| 2141 | 2130 |
| 2142 | 2131 |
| 2143 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 2132 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 2144 LOperand* context = UseFixed(instr->context(), cp); | 2133 LOperand* context = UseFixed(instr->context(), cp); |
| 2145 LOperand* object = UseFixed(instr->object(), r1); | 2134 LOperand* object = UseFixed(instr->object(), r1); |
| 2146 LOperand* key = UseFixed(instr->key(), r0); | 2135 LOperand* key = UseFixed(instr->key(), r0); |
| 2147 | 2136 |
| 2148 LInstruction* result = | 2137 LInstruction* result = |
| 2149 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), r0); | 2138 DefineFixed(new(zone()) LLoadKeyedGeneric(context, object, key), r0); |
| 2150 return MarkAsCall(result, instr); | 2139 return MarkAsCall(result, instr); |
| 2151 } | 2140 } |
| 2152 | 2141 |
| 2153 | 2142 |
| 2154 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2143 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2155 if (!instr->is_external()) { | 2144 if (!instr->is_typed_elements()) { |
| 2156 ASSERT(instr->elements()->representation().IsTagged()); | 2145 ASSERT(instr->elements()->representation().IsTagged()); |
| 2157 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2146 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2158 LOperand* object = NULL; | 2147 LOperand* object = NULL; |
| 2159 LOperand* key = NULL; | 2148 LOperand* key = NULL; |
| 2160 LOperand* val = NULL; | 2149 LOperand* val = NULL; |
| 2161 | 2150 |
| 2162 if (instr->value()->representation().IsDouble()) { | 2151 if (instr->value()->representation().IsDouble()) { |
| 2163 object = UseRegisterAtStart(instr->elements()); | 2152 object = UseRegisterAtStart(instr->elements()); |
| 2164 val = UseRegister(instr->value()); | 2153 val = UseRegister(instr->value()); |
| 2165 key = UseRegisterOrConstantAtStart(instr->key()); | 2154 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2166 } else { | 2155 } else { |
| 2167 ASSERT(instr->value()->representation().IsSmiOrTagged()); | 2156 ASSERT(instr->value()->representation().IsSmiOrTagged()); |
| 2168 if (needs_write_barrier) { | 2157 if (needs_write_barrier) { |
| 2169 object = UseTempRegister(instr->elements()); | 2158 object = UseTempRegister(instr->elements()); |
| 2170 val = UseTempRegister(instr->value()); | 2159 val = UseTempRegister(instr->value()); |
| 2171 key = UseTempRegister(instr->key()); | 2160 key = UseTempRegister(instr->key()); |
| 2172 } else { | 2161 } else { |
| 2173 object = UseRegisterAtStart(instr->elements()); | 2162 object = UseRegisterAtStart(instr->elements()); |
| 2174 val = UseRegisterAtStart(instr->value()); | 2163 val = UseRegisterAtStart(instr->value()); |
| 2175 key = UseRegisterOrConstantAtStart(instr->key()); | 2164 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2176 } | 2165 } |
| 2177 } | 2166 } |
| 2178 | 2167 |
| 2179 return new(zone()) LStoreKeyed(object, key, val); | 2168 return new(zone()) LStoreKeyed(object, key, val); |
| 2180 } | 2169 } |
| 2181 | 2170 |
| 2182 ASSERT( | 2171 ASSERT( |
| 2183 (instr->value()->representation().IsInteger32() && | 2172 (instr->value()->representation().IsInteger32() && |
| 2184 (instr->elements_kind() != EXTERNAL_FLOAT_ELEMENTS) && | 2173 !IsDoubleOrFloatElementsKind(instr->elements_kind())) || |
| 2185 (instr->elements_kind() != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 2186 (instr->value()->representation().IsDouble() && | 2174 (instr->value()->representation().IsDouble() && |
| 2187 ((instr->elements_kind() == EXTERNAL_FLOAT_ELEMENTS) || | 2175 IsDoubleOrFloatElementsKind(instr->elements_kind()))); |
| 2188 (instr->elements_kind() == EXTERNAL_DOUBLE_ELEMENTS)))); | 2176 ASSERT((instr->is_fixed_typed_array() && |
| 2189 ASSERT(instr->elements()->representation().IsExternal()); | 2177 instr->elements()->representation().IsTagged()) || |
| 2178 (instr->is_external() && |
| 2179 instr->elements()->representation().IsExternal())); |
| 2190 LOperand* val = UseRegister(instr->value()); | 2180 LOperand* val = UseRegister(instr->value()); |
| 2191 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2181 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2192 LOperand* external_pointer = UseRegister(instr->elements()); | 2182 LOperand* backing_store = UseRegister(instr->elements()); |
| 2193 return new(zone()) LStoreKeyed(external_pointer, key, val); | 2183 return new(zone()) LStoreKeyed(backing_store, key, val); |
| 2194 } | 2184 } |
| 2195 | 2185 |
| 2196 | 2186 |
| 2197 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2187 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 2198 LOperand* context = UseFixed(instr->context(), cp); | 2188 LOperand* context = UseFixed(instr->context(), cp); |
| 2199 LOperand* obj = UseFixed(instr->object(), r2); | 2189 LOperand* obj = UseFixed(instr->object(), r2); |
| 2200 LOperand* key = UseFixed(instr->key(), r1); | 2190 LOperand* key = UseFixed(instr->key(), r1); |
| 2201 LOperand* val = UseFixed(instr->value(), r0); | 2191 LOperand* val = UseFixed(instr->value(), r0); |
| 2202 | 2192 |
| 2203 ASSERT(instr->object()->representation().IsTagged()); | 2193 ASSERT(instr->object()->representation().IsTagged()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2283 LOperand* obj = UseFixed(instr->object(), r1); | 2273 LOperand* obj = UseFixed(instr->object(), r1); |
| 2284 LOperand* val = UseFixed(instr->value(), r0); | 2274 LOperand* val = UseFixed(instr->value(), r0); |
| 2285 | 2275 |
| 2286 LInstruction* result = new(zone()) LStoreNamedGeneric(context, obj, val); | 2276 LInstruction* result = new(zone()) LStoreNamedGeneric(context, obj, val); |
| 2287 return MarkAsCall(result, instr); | 2277 return MarkAsCall(result, instr); |
| 2288 } | 2278 } |
| 2289 | 2279 |
| 2290 | 2280 |
| 2291 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { | 2281 LInstruction* LChunkBuilder::DoStringAdd(HStringAdd* instr) { |
| 2292 LOperand* context = UseFixed(instr->context(), cp); | 2282 LOperand* context = UseFixed(instr->context(), cp); |
| 2293 LOperand* left = FLAG_new_string_add | 2283 LOperand* left = UseFixed(instr->left(), r1); |
| 2294 ? UseFixed(instr->left(), r1) | 2284 LOperand* right = UseFixed(instr->right(), r0); |
| 2295 : UseRegisterAtStart(instr->left()); | |
| 2296 LOperand* right = FLAG_new_string_add | |
| 2297 ? UseFixed(instr->right(), r0) | |
| 2298 : UseRegisterAtStart(instr->right()); | |
| 2299 return MarkAsCall( | 2285 return MarkAsCall( |
| 2300 DefineFixed(new(zone()) LStringAdd(context, left, right), r0), | 2286 DefineFixed(new(zone()) LStringAdd(context, left, right), r0), |
| 2301 instr); | 2287 instr); |
| 2302 } | 2288 } |
| 2303 | 2289 |
| 2304 | 2290 |
| 2305 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 2291 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
| 2306 LOperand* string = UseTempRegister(instr->string()); | 2292 LOperand* string = UseTempRegister(instr->string()); |
| 2307 LOperand* index = UseTempRegister(instr->index()); | 2293 LOperand* index = UseTempRegister(instr->index()); |
| 2308 LOperand* context = UseAny(instr->context()); | 2294 LOperand* context = UseAny(instr->context()); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2543 } | 2529 } |
| 2544 | 2530 |
| 2545 | 2531 |
| 2546 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2532 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2547 LOperand* object = UseRegister(instr->object()); | 2533 LOperand* object = UseRegister(instr->object()); |
| 2548 LOperand* index = UseRegister(instr->index()); | 2534 LOperand* index = UseRegister(instr->index()); |
| 2549 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2535 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2550 } | 2536 } |
| 2551 | 2537 |
| 2552 } } // namespace v8::internal | 2538 } } // namespace v8::internal |
| OLD | NEW |