| 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 <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_X87 | 9 #if V8_TARGET_ARCH_X87 |
| 10 | 10 |
| (...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2233 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2233 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 2234 DCHECK(instr->key()->representation().IsSmiOrInteger32()); | 2234 DCHECK(instr->key()->representation().IsSmiOrInteger32()); |
| 2235 ElementsKind elements_kind = instr->elements_kind(); | 2235 ElementsKind elements_kind = instr->elements_kind(); |
| 2236 bool clobbers_key = ExternalArrayOpRequiresTemp( | 2236 bool clobbers_key = ExternalArrayOpRequiresTemp( |
| 2237 instr->key()->representation(), elements_kind); | 2237 instr->key()->representation(), elements_kind); |
| 2238 LOperand* key = clobbers_key | 2238 LOperand* key = clobbers_key |
| 2239 ? UseTempRegister(instr->key()) | 2239 ? UseTempRegister(instr->key()) |
| 2240 : UseRegisterOrConstantAtStart(instr->key()); | 2240 : UseRegisterOrConstantAtStart(instr->key()); |
| 2241 LInstruction* result = NULL; | 2241 LInstruction* result = NULL; |
| 2242 | 2242 |
| 2243 if (!instr->is_typed_elements()) { | 2243 if (!instr->is_fixed_typed_array()) { |
| 2244 LOperand* obj = UseRegisterAtStart(instr->elements()); | 2244 LOperand* obj = UseRegisterAtStart(instr->elements()); |
| 2245 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); | 2245 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); |
| 2246 } else { | 2246 } else { |
| 2247 DCHECK( | 2247 DCHECK( |
| 2248 (instr->representation().IsInteger32() && | 2248 (instr->representation().IsInteger32() && |
| 2249 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || | 2249 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || |
| 2250 (instr->representation().IsDouble() && | 2250 (instr->representation().IsDouble() && |
| 2251 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); | 2251 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); |
| 2252 LOperand* backing_store = UseRegister(instr->elements()); | 2252 LOperand* backing_store = UseRegister(instr->elements()); |
| 2253 result = DefineAsRegister(new(zone()) LLoadKeyed(backing_store, key)); | 2253 result = DefineAsRegister(new(zone()) LLoadKeyed(backing_store, key)); |
| 2254 } | 2254 } |
| 2255 | 2255 |
| 2256 bool needs_environment; | 2256 bool needs_environment; |
| 2257 if (instr->is_external() || instr->is_fixed_typed_array()) { | 2257 if (instr->is_fixed_typed_array()) { |
| 2258 // see LCodeGen::DoLoadKeyedExternalArray | 2258 // see LCodeGen::DoLoadKeyedExternalArray |
| 2259 needs_environment = (elements_kind == EXTERNAL_UINT32_ELEMENTS || | 2259 needs_environment = elements_kind == UINT32_ELEMENTS && |
| 2260 elements_kind == UINT32_ELEMENTS) && | |
| 2261 !instr->CheckFlag(HInstruction::kUint32); | 2260 !instr->CheckFlag(HInstruction::kUint32); |
| 2262 } else { | 2261 } else { |
| 2263 // see LCodeGen::DoLoadKeyedFixedDoubleArray and | 2262 // see LCodeGen::DoLoadKeyedFixedDoubleArray and |
| 2264 // LCodeGen::DoLoadKeyedFixedArray | 2263 // LCodeGen::DoLoadKeyedFixedArray |
| 2265 needs_environment = | 2264 needs_environment = |
| 2266 instr->RequiresHoleCheck() || | 2265 instr->RequiresHoleCheck() || |
| 2267 (instr->hole_mode() == CONVERT_HOLE_TO_UNDEFINED && info()->IsStub()); | 2266 (instr->hole_mode() == CONVERT_HOLE_TO_UNDEFINED && info()->IsStub()); |
| 2268 } | 2267 } |
| 2269 | 2268 |
| 2270 if (needs_environment) { | 2269 if (needs_environment) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2287 new(zone()) LLoadKeyedGeneric(context, object, key, vector); | 2286 new(zone()) LLoadKeyedGeneric(context, object, key, vector); |
| 2288 return MarkAsCall(DefineFixed(result, eax), instr); | 2287 return MarkAsCall(DefineFixed(result, eax), instr); |
| 2289 } | 2288 } |
| 2290 | 2289 |
| 2291 | 2290 |
| 2292 LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) { | 2291 LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) { |
| 2293 ElementsKind elements_kind = instr->elements_kind(); | 2292 ElementsKind elements_kind = instr->elements_kind(); |
| 2294 | 2293 |
| 2295 // Determine if we need a byte register in this case for the value. | 2294 // Determine if we need a byte register in this case for the value. |
| 2296 bool val_is_fixed_register = | 2295 bool val_is_fixed_register = |
| 2297 elements_kind == EXTERNAL_INT8_ELEMENTS || | |
| 2298 elements_kind == EXTERNAL_UINT8_ELEMENTS || | |
| 2299 elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || | |
| 2300 elements_kind == UINT8_ELEMENTS || | 2296 elements_kind == UINT8_ELEMENTS || |
| 2301 elements_kind == INT8_ELEMENTS || | 2297 elements_kind == INT8_ELEMENTS || |
| 2302 elements_kind == UINT8_CLAMPED_ELEMENTS; | 2298 elements_kind == UINT8_CLAMPED_ELEMENTS; |
| 2303 if (val_is_fixed_register) { | 2299 if (val_is_fixed_register) { |
| 2304 return UseFixed(instr->value(), eax); | 2300 return UseFixed(instr->value(), eax); |
| 2305 } | 2301 } |
| 2306 | 2302 |
| 2307 if (IsDoubleOrFloatElementsKind(elements_kind)) { | 2303 if (IsDoubleOrFloatElementsKind(elements_kind)) { |
| 2308 return UseRegisterAtStart(instr->value()); | 2304 return UseRegisterAtStart(instr->value()); |
| 2309 } | 2305 } |
| 2310 | 2306 |
| 2311 return UseRegister(instr->value()); | 2307 return UseRegister(instr->value()); |
| 2312 } | 2308 } |
| 2313 | 2309 |
| 2314 | 2310 |
| 2315 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2311 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2316 if (!instr->is_typed_elements()) { | 2312 if (!instr->is_fixed_typed_array()) { |
| 2317 DCHECK(instr->elements()->representation().IsTagged()); | 2313 DCHECK(instr->elements()->representation().IsTagged()); |
| 2318 DCHECK(instr->key()->representation().IsInteger32() || | 2314 DCHECK(instr->key()->representation().IsInteger32() || |
| 2319 instr->key()->representation().IsSmi()); | 2315 instr->key()->representation().IsSmi()); |
| 2320 | 2316 |
| 2321 if (instr->value()->representation().IsDouble()) { | 2317 if (instr->value()->representation().IsDouble()) { |
| 2322 LOperand* object = UseRegisterAtStart(instr->elements()); | 2318 LOperand* object = UseRegisterAtStart(instr->elements()); |
| 2323 // For storing double hole, no fp register required. | 2319 // For storing double hole, no fp register required. |
| 2324 LOperand* val = instr->IsConstantHoleStore() | 2320 LOperand* val = instr->IsConstantHoleStore() |
| 2325 ? NULL | 2321 ? NULL |
| 2326 : UseRegisterAtStart(instr->value()); | 2322 : UseRegisterAtStart(instr->value()); |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2789 LAllocateBlockContext* result = | 2785 LAllocateBlockContext* result = |
| 2790 new(zone()) LAllocateBlockContext(context, function); | 2786 new(zone()) LAllocateBlockContext(context, function); |
| 2791 return MarkAsCall(DefineFixed(result, esi), instr); | 2787 return MarkAsCall(DefineFixed(result, esi), instr); |
| 2792 } | 2788 } |
| 2793 | 2789 |
| 2794 | 2790 |
| 2795 } // namespace internal | 2791 } // namespace internal |
| 2796 } // namespace v8 | 2792 } // namespace v8 |
| 2797 | 2793 |
| 2798 #endif // V8_TARGET_ARCH_X87 | 2794 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |