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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/lithium-allocator-inl.h" | 9 #include "src/lithium-allocator-inl.h" |
10 #include "src/x64/lithium-x64.h" | 10 #include "src/x64/lithium-x64.h" |
(...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 if (dehoisted_key_ids->Contains(candidate->id())) return; | 2119 if (dehoisted_key_ids->Contains(candidate->id())) return; |
2120 dehoisted_key_ids->Add(candidate->id()); | 2120 dehoisted_key_ids->Add(candidate->id()); |
2121 if (!candidate->IsPhi()) return; | 2121 if (!candidate->IsPhi()) return; |
2122 for (int i = 0; i < candidate->OperandCount(); ++i) { | 2122 for (int i = 0; i < candidate->OperandCount(); ++i) { |
2123 FindDehoistedKeyDefinitions(candidate->OperandAt(i)); | 2123 FindDehoistedKeyDefinitions(candidate->OperandAt(i)); |
2124 } | 2124 } |
2125 } | 2125 } |
2126 | 2126 |
2127 | 2127 |
2128 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2128 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
2129 ASSERT(instr->key()->representation().IsInteger32()); | 2129 ASSERT((kPointerSize == kInt64Size && |
| 2130 instr->key()->representation().IsInteger32()) || |
| 2131 (kPointerSize == kInt32Size && |
| 2132 instr->key()->representation().IsSmiOrInteger32())); |
2130 ElementsKind elements_kind = instr->elements_kind(); | 2133 ElementsKind elements_kind = instr->elements_kind(); |
2131 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2134 LOperand* key = NULL; |
2132 LInstruction* result = NULL; | 2135 LInstruction* result = NULL; |
2133 | 2136 |
| 2137 if (kPointerSize == kInt64Size) { |
| 2138 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2139 } else { |
| 2140 bool clobbers_key = ExternalArrayOpRequiresTemp( |
| 2141 instr->key()->representation(), elements_kind); |
| 2142 key = clobbers_key |
| 2143 ? UseTempRegister(instr->key()) |
| 2144 : UseRegisterOrConstantAtStart(instr->key()); |
| 2145 } |
| 2146 |
2134 if ((kPointerSize == kInt64Size) && instr->IsDehoisted()) { | 2147 if ((kPointerSize == kInt64Size) && instr->IsDehoisted()) { |
2135 FindDehoistedKeyDefinitions(instr->key()); | 2148 FindDehoistedKeyDefinitions(instr->key()); |
2136 } | 2149 } |
2137 | 2150 |
2138 if (!instr->is_typed_elements()) { | 2151 if (!instr->is_typed_elements()) { |
2139 LOperand* obj = UseRegisterAtStart(instr->elements()); | 2152 LOperand* obj = UseRegisterAtStart(instr->elements()); |
2140 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); | 2153 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); |
2141 } else { | 2154 } else { |
2142 ASSERT( | 2155 ASSERT( |
2143 (instr->representation().IsInteger32() && | 2156 (instr->representation().IsInteger32() && |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2217 ASSERT((instr->is_fixed_typed_array() && | 2230 ASSERT((instr->is_fixed_typed_array() && |
2218 instr->elements()->representation().IsTagged()) || | 2231 instr->elements()->representation().IsTagged()) || |
2219 (instr->is_external() && | 2232 (instr->is_external() && |
2220 instr->elements()->representation().IsExternal())); | 2233 instr->elements()->representation().IsExternal())); |
2221 bool val_is_temp_register = | 2234 bool val_is_temp_register = |
2222 elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || | 2235 elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || |
2223 elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 2236 elements_kind == EXTERNAL_FLOAT32_ELEMENTS || |
2224 elements_kind == FLOAT32_ELEMENTS; | 2237 elements_kind == FLOAT32_ELEMENTS; |
2225 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) | 2238 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) |
2226 : UseRegister(instr->value()); | 2239 : UseRegister(instr->value()); |
2227 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2240 LOperand* key = NULL; |
| 2241 if (kPointerSize == kInt64Size) { |
| 2242 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2243 } else { |
| 2244 bool clobbers_key = ExternalArrayOpRequiresTemp( |
| 2245 instr->key()->representation(), elements_kind); |
| 2246 key = clobbers_key |
| 2247 ? UseTempRegister(instr->key()) |
| 2248 : UseRegisterOrConstantAtStart(instr->key()); |
| 2249 } |
2228 LOperand* backing_store = UseRegister(instr->elements()); | 2250 LOperand* backing_store = UseRegister(instr->elements()); |
2229 return new(zone()) LStoreKeyed(backing_store, key, val); | 2251 return new(zone()) LStoreKeyed(backing_store, key, val); |
2230 } | 2252 } |
2231 | 2253 |
2232 | 2254 |
2233 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2255 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
2234 LOperand* context = UseFixed(instr->context(), rsi); | 2256 LOperand* context = UseFixed(instr->context(), rsi); |
2235 LOperand* object = UseFixed(instr->object(), rdx); | 2257 LOperand* object = UseFixed(instr->object(), rdx); |
2236 LOperand* key = UseFixed(instr->key(), rcx); | 2258 LOperand* key = UseFixed(instr->key(), rcx); |
2237 LOperand* value = UseFixed(instr->value(), rax); | 2259 LOperand* value = UseFixed(instr->value(), rax); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2602 LOperand* function = UseRegisterAtStart(instr->function()); | 2624 LOperand* function = UseRegisterAtStart(instr->function()); |
2603 LAllocateBlockContext* result = | 2625 LAllocateBlockContext* result = |
2604 new(zone()) LAllocateBlockContext(context, function); | 2626 new(zone()) LAllocateBlockContext(context, function); |
2605 return MarkAsCall(DefineFixed(result, rsi), instr); | 2627 return MarkAsCall(DefineFixed(result, rsi), instr); |
2606 } | 2628 } |
2607 | 2629 |
2608 | 2630 |
2609 } } // namespace v8::internal | 2631 } } // namespace v8::internal |
2610 | 2632 |
2611 #endif // V8_TARGET_ARCH_X64 | 2633 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |