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