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