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 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2114 if (dehoisted_key_ids->Contains(candidate->id())) return; | 2114 if (dehoisted_key_ids->Contains(candidate->id())) return; |
2115 dehoisted_key_ids->Add(candidate->id()); | 2115 dehoisted_key_ids->Add(candidate->id()); |
2116 if (!candidate->IsPhi()) return; | 2116 if (!candidate->IsPhi()) return; |
2117 for (int i = 0; i < candidate->OperandCount(); ++i) { | 2117 for (int i = 0; i < candidate->OperandCount(); ++i) { |
2118 FindDehoistedKeyDefinitions(candidate->OperandAt(i)); | 2118 FindDehoistedKeyDefinitions(candidate->OperandAt(i)); |
2119 } | 2119 } |
2120 } | 2120 } |
2121 | 2121 |
2122 | 2122 |
2123 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2123 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
2124 ASSERT(instr->key()->representation().IsInteger32()); | 2124 ASSERT((kPointerSize == kInt64Size && |
| 2125 instr->key()->representation().IsInteger32()) || |
| 2126 (kPointerSize == kInt32Size && |
| 2127 instr->key()->representation().IsSmiOrInteger32())); |
2125 ElementsKind elements_kind = instr->elements_kind(); | 2128 ElementsKind elements_kind = instr->elements_kind(); |
2126 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2129 LOperand* key = NULL; |
2127 LInstruction* result = NULL; | 2130 LInstruction* result = NULL; |
2128 | 2131 |
| 2132 if (kPointerSize == kInt64Size) { |
| 2133 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2134 } else { |
| 2135 bool clobbers_key = KeyedLoadOrStoreRequiresTemp( |
| 2136 instr->key()->representation(), elements_kind); |
| 2137 key = clobbers_key |
| 2138 ? UseTempRegister(instr->key()) |
| 2139 : UseRegisterOrConstantAtStart(instr->key()); |
| 2140 } |
| 2141 |
2129 if (instr->IsDehoisted()) { | 2142 if (instr->IsDehoisted()) { |
2130 FindDehoistedKeyDefinitions(instr->key()); | 2143 FindDehoistedKeyDefinitions(instr->key()); |
2131 } | 2144 } |
2132 | 2145 |
2133 if (!instr->is_typed_elements()) { | 2146 if (!instr->is_typed_elements()) { |
2134 LOperand* obj = UseRegisterAtStart(instr->elements()); | 2147 LOperand* obj = UseRegisterAtStart(instr->elements()); |
2135 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); | 2148 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); |
2136 } else { | 2149 } else { |
2137 ASSERT( | 2150 ASSERT( |
2138 (instr->representation().IsInteger32() && | 2151 (instr->representation().IsInteger32() && |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2212 ASSERT((instr->is_fixed_typed_array() && | 2225 ASSERT((instr->is_fixed_typed_array() && |
2213 instr->elements()->representation().IsTagged()) || | 2226 instr->elements()->representation().IsTagged()) || |
2214 (instr->is_external() && | 2227 (instr->is_external() && |
2215 instr->elements()->representation().IsExternal())); | 2228 instr->elements()->representation().IsExternal())); |
2216 bool val_is_temp_register = | 2229 bool val_is_temp_register = |
2217 elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || | 2230 elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS || |
2218 elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 2231 elements_kind == EXTERNAL_FLOAT32_ELEMENTS || |
2219 elements_kind == FLOAT32_ELEMENTS; | 2232 elements_kind == FLOAT32_ELEMENTS; |
2220 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) | 2233 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) |
2221 : UseRegister(instr->value()); | 2234 : UseRegister(instr->value()); |
2222 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2235 LOperand* key = NULL; |
| 2236 if (kPointerSize == kInt64Size) { |
| 2237 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2238 } else { |
| 2239 bool clobbers_key = KeyedLoadOrStoreRequiresTemp( |
| 2240 instr->key()->representation(), elements_kind); |
| 2241 key = clobbers_key |
| 2242 ? UseTempRegister(instr->key()) |
| 2243 : UseRegisterOrConstantAtStart(instr->key()); |
| 2244 } |
2223 LOperand* backing_store = UseRegister(instr->elements()); | 2245 LOperand* backing_store = UseRegister(instr->elements()); |
2224 return new(zone()) LStoreKeyed(backing_store, key, val); | 2246 return new(zone()) LStoreKeyed(backing_store, key, val); |
2225 } | 2247 } |
2226 | 2248 |
2227 | 2249 |
2228 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2250 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
2229 LOperand* context = UseFixed(instr->context(), rsi); | 2251 LOperand* context = UseFixed(instr->context(), rsi); |
2230 LOperand* object = UseFixed(instr->object(), rdx); | 2252 LOperand* object = UseFixed(instr->object(), rdx); |
2231 LOperand* key = UseFixed(instr->key(), rcx); | 2253 LOperand* key = UseFixed(instr->key(), rcx); |
2232 LOperand* value = UseFixed(instr->value(), rax); | 2254 LOperand* value = UseFixed(instr->value(), rax); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2597 LOperand* function = UseRegisterAtStart(instr->function()); | 2619 LOperand* function = UseRegisterAtStart(instr->function()); |
2598 LAllocateBlockContext* result = | 2620 LAllocateBlockContext* result = |
2599 new(zone()) LAllocateBlockContext(context, function); | 2621 new(zone()) LAllocateBlockContext(context, function); |
2600 return MarkAsCall(DefineFixed(result, rsi), instr); | 2622 return MarkAsCall(DefineFixed(result, rsi), instr); |
2601 } | 2623 } |
2602 | 2624 |
2603 | 2625 |
2604 } } // namespace v8::internal | 2626 } } // namespace v8::internal |
2605 | 2627 |
2606 #endif // V8_TARGET_ARCH_X64 | 2628 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |