| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/crankshaft/ia32/lithium-ia32.h" | 5 #include "src/crankshaft/ia32/lithium-ia32.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
| 10 | 10 |
| (...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2196 ElementsKind elements_kind = instr->elements_kind(); | 2196 ElementsKind elements_kind = instr->elements_kind(); |
| 2197 bool clobbers_key = ExternalArrayOpRequiresTemp( | 2197 bool clobbers_key = ExternalArrayOpRequiresTemp( |
| 2198 instr->key()->representation(), elements_kind); | 2198 instr->key()->representation(), elements_kind); |
| 2199 LOperand* key = clobbers_key | 2199 LOperand* key = clobbers_key |
| 2200 ? UseTempRegister(instr->key()) | 2200 ? UseTempRegister(instr->key()) |
| 2201 : UseRegisterOrConstantAtStart(instr->key()); | 2201 : UseRegisterOrConstantAtStart(instr->key()); |
| 2202 LInstruction* result = NULL; | 2202 LInstruction* result = NULL; |
| 2203 | 2203 |
| 2204 if (!instr->is_fixed_typed_array()) { | 2204 if (!instr->is_fixed_typed_array()) { |
| 2205 LOperand* obj = UseRegisterAtStart(instr->elements()); | 2205 LOperand* obj = UseRegisterAtStart(instr->elements()); |
| 2206 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); | 2206 result = DefineAsRegister(new (zone()) LLoadKeyed(obj, key, nullptr)); |
| 2207 } else { | 2207 } else { |
| 2208 DCHECK( | 2208 DCHECK( |
| 2209 (instr->representation().IsInteger32() && | 2209 (instr->representation().IsInteger32() && |
| 2210 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || | 2210 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || |
| 2211 (instr->representation().IsDouble() && | 2211 (instr->representation().IsDouble() && |
| 2212 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); | 2212 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); |
| 2213 LOperand* backing_store = UseRegister(instr->elements()); | 2213 LOperand* backing_store = UseRegister(instr->elements()); |
| 2214 result = DefineAsRegister(new(zone()) LLoadKeyed(backing_store, key)); | 2214 LOperand* backing_store_owner = UseAny(instr->backing_store_owner()); |
| 2215 result = DefineAsRegister( |
| 2216 new (zone()) LLoadKeyed(backing_store, key, backing_store_owner)); |
| 2215 } | 2217 } |
| 2216 | 2218 |
| 2217 bool needs_environment; | 2219 bool needs_environment; |
| 2218 if (instr->is_fixed_typed_array()) { | 2220 if (instr->is_fixed_typed_array()) { |
| 2219 // see LCodeGen::DoLoadKeyedExternalArray | 2221 // see LCodeGen::DoLoadKeyedExternalArray |
| 2220 needs_environment = elements_kind == UINT32_ELEMENTS && | 2222 needs_environment = elements_kind == UINT32_ELEMENTS && |
| 2221 !instr->CheckFlag(HInstruction::kUint32); | 2223 !instr->CheckFlag(HInstruction::kUint32); |
| 2222 } else { | 2224 } else { |
| 2223 // see LCodeGen::DoLoadKeyedFixedDoubleArray and | 2225 // see LCodeGen::DoLoadKeyedFixedDoubleArray and |
| 2224 // LCodeGen::DoLoadKeyedFixedArray | 2226 // LCodeGen::DoLoadKeyedFixedArray |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2269 if (!instr->is_fixed_typed_array()) { | 2271 if (!instr->is_fixed_typed_array()) { |
| 2270 DCHECK(instr->elements()->representation().IsTagged()); | 2272 DCHECK(instr->elements()->representation().IsTagged()); |
| 2271 DCHECK(instr->key()->representation().IsInteger32() || | 2273 DCHECK(instr->key()->representation().IsInteger32() || |
| 2272 instr->key()->representation().IsSmi()); | 2274 instr->key()->representation().IsSmi()); |
| 2273 | 2275 |
| 2274 if (instr->value()->representation().IsDouble()) { | 2276 if (instr->value()->representation().IsDouble()) { |
| 2275 LOperand* object = UseRegisterAtStart(instr->elements()); | 2277 LOperand* object = UseRegisterAtStart(instr->elements()); |
| 2276 LOperand* val = NULL; | 2278 LOperand* val = NULL; |
| 2277 val = UseRegisterAtStart(instr->value()); | 2279 val = UseRegisterAtStart(instr->value()); |
| 2278 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2280 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 2279 return new(zone()) LStoreKeyed(object, key, val); | 2281 return new (zone()) LStoreKeyed(object, key, val, nullptr); |
| 2280 } else { | 2282 } else { |
| 2281 DCHECK(instr->value()->representation().IsSmiOrTagged()); | 2283 DCHECK(instr->value()->representation().IsSmiOrTagged()); |
| 2282 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2284 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2283 | 2285 |
| 2284 LOperand* obj = UseRegister(instr->elements()); | 2286 LOperand* obj = UseRegister(instr->elements()); |
| 2285 LOperand* val; | 2287 LOperand* val; |
| 2286 LOperand* key; | 2288 LOperand* key; |
| 2287 if (needs_write_barrier) { | 2289 if (needs_write_barrier) { |
| 2288 val = UseTempRegister(instr->value()); | 2290 val = UseTempRegister(instr->value()); |
| 2289 key = UseTempRegister(instr->key()); | 2291 key = UseTempRegister(instr->key()); |
| 2290 } else { | 2292 } else { |
| 2291 val = UseRegisterOrConstantAtStart(instr->value()); | 2293 val = UseRegisterOrConstantAtStart(instr->value()); |
| 2292 key = UseRegisterOrConstantAtStart(instr->key()); | 2294 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2293 } | 2295 } |
| 2294 return new(zone()) LStoreKeyed(obj, key, val); | 2296 return new (zone()) LStoreKeyed(obj, key, val, nullptr); |
| 2295 } | 2297 } |
| 2296 } | 2298 } |
| 2297 | 2299 |
| 2298 ElementsKind elements_kind = instr->elements_kind(); | 2300 ElementsKind elements_kind = instr->elements_kind(); |
| 2299 DCHECK( | 2301 DCHECK( |
| 2300 (instr->value()->representation().IsInteger32() && | 2302 (instr->value()->representation().IsInteger32() && |
| 2301 !IsDoubleOrFloatElementsKind(elements_kind)) || | 2303 !IsDoubleOrFloatElementsKind(elements_kind)) || |
| 2302 (instr->value()->representation().IsDouble() && | 2304 (instr->value()->representation().IsDouble() && |
| 2303 IsDoubleOrFloatElementsKind(elements_kind))); | 2305 IsDoubleOrFloatElementsKind(elements_kind))); |
| 2304 DCHECK(instr->elements()->representation().IsExternal()); | 2306 DCHECK(instr->elements()->representation().IsExternal()); |
| 2305 | 2307 |
| 2306 LOperand* backing_store = UseRegister(instr->elements()); | 2308 LOperand* backing_store = UseRegister(instr->elements()); |
| 2309 LOperand* backing_store_owner = UseAny(instr->backing_store_owner()); |
| 2307 LOperand* val = GetStoreKeyedValueOperand(instr); | 2310 LOperand* val = GetStoreKeyedValueOperand(instr); |
| 2308 bool clobbers_key = ExternalArrayOpRequiresTemp( | 2311 bool clobbers_key = ExternalArrayOpRequiresTemp( |
| 2309 instr->key()->representation(), elements_kind); | 2312 instr->key()->representation(), elements_kind); |
| 2310 LOperand* key = clobbers_key | 2313 LOperand* key = clobbers_key |
| 2311 ? UseTempRegister(instr->key()) | 2314 ? UseTempRegister(instr->key()) |
| 2312 : UseRegisterOrConstantAtStart(instr->key()); | 2315 : UseRegisterOrConstantAtStart(instr->key()); |
| 2313 return new(zone()) LStoreKeyed(backing_store, key, val); | 2316 return new (zone()) LStoreKeyed(backing_store, key, val, backing_store_owner); |
| 2314 } | 2317 } |
| 2315 | 2318 |
| 2316 | 2319 |
| 2317 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2320 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 2318 LOperand* context = UseFixed(instr->context(), esi); | 2321 LOperand* context = UseFixed(instr->context(), esi); |
| 2319 LOperand* object = | 2322 LOperand* object = |
| 2320 UseFixed(instr->object(), StoreDescriptor::ReceiverRegister()); | 2323 UseFixed(instr->object(), StoreDescriptor::ReceiverRegister()); |
| 2321 LOperand* key = UseFixed(instr->key(), StoreDescriptor::NameRegister()); | 2324 LOperand* key = UseFixed(instr->key(), StoreDescriptor::NameRegister()); |
| 2322 LOperand* value = UseFixed(instr->value(), StoreDescriptor::ValueRegister()); | 2325 LOperand* value = UseFixed(instr->value(), StoreDescriptor::ValueRegister()); |
| 2323 | 2326 |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2720 LAllocateBlockContext* result = | 2723 LAllocateBlockContext* result = |
| 2721 new(zone()) LAllocateBlockContext(context, function); | 2724 new(zone()) LAllocateBlockContext(context, function); |
| 2722 return MarkAsCall(DefineFixed(result, esi), instr); | 2725 return MarkAsCall(DefineFixed(result, esi), instr); |
| 2723 } | 2726 } |
| 2724 | 2727 |
| 2725 | 2728 |
| 2726 } // namespace internal | 2729 } // namespace internal |
| 2727 } // namespace v8 | 2730 } // namespace v8 |
| 2728 | 2731 |
| 2729 #endif // V8_TARGET_ARCH_IA32 | 2732 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |