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