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 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2103 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); | 2103 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); |
2104 } | 2104 } |
2105 | 2105 |
2106 | 2106 |
2107 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { | 2107 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { |
2108 return DefineAsRegister(new(zone()) LLoadRoot); | 2108 return DefineAsRegister(new(zone()) LLoadRoot); |
2109 } | 2109 } |
2110 | 2110 |
2111 | 2111 |
2112 void LChunkBuilder::FindDehoistedKeyDefinitions(HValue* candidate) { | 2112 void LChunkBuilder::FindDehoistedKeyDefinitions(HValue* candidate) { |
| 2113 // We sign extend the dehoisted key at the definition point when the pointer |
| 2114 // size is 64-bit. For x32 port, we sign extend the dehoisted key at the use |
| 2115 // points and should not invoke this function. We can't use STATIC_ASSERT |
| 2116 // here as the pointer size is 32-bit for x32. |
| 2117 ASSERT(kPointerSize == kInt64Size); |
2113 BitVector* dehoisted_key_ids = chunk_->GetDehoistedKeyIds(); | 2118 BitVector* dehoisted_key_ids = chunk_->GetDehoistedKeyIds(); |
2114 if (dehoisted_key_ids->Contains(candidate->id())) return; | 2119 if (dehoisted_key_ids->Contains(candidate->id())) return; |
2115 dehoisted_key_ids->Add(candidate->id()); | 2120 dehoisted_key_ids->Add(candidate->id()); |
2116 if (!candidate->IsPhi()) return; | 2121 if (!candidate->IsPhi()) return; |
2117 for (int i = 0; i < candidate->OperandCount(); ++i) { | 2122 for (int i = 0; i < candidate->OperandCount(); ++i) { |
2118 FindDehoistedKeyDefinitions(candidate->OperandAt(i)); | 2123 FindDehoistedKeyDefinitions(candidate->OperandAt(i)); |
2119 } | 2124 } |
2120 } | 2125 } |
2121 | 2126 |
2122 | 2127 |
2123 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 2128 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
2124 ASSERT(instr->key()->representation().IsInteger32()); | 2129 ASSERT(instr->key()->representation().IsInteger32()); |
2125 ElementsKind elements_kind = instr->elements_kind(); | 2130 ElementsKind elements_kind = instr->elements_kind(); |
2126 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 2131 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
2127 LInstruction* result = NULL; | 2132 LInstruction* result = NULL; |
2128 | 2133 |
2129 if (instr->IsDehoisted()) { | 2134 if ((kPointerSize == kInt64Size) && instr->IsDehoisted()) { |
2130 FindDehoistedKeyDefinitions(instr->key()); | 2135 FindDehoistedKeyDefinitions(instr->key()); |
2131 } | 2136 } |
2132 | 2137 |
2133 if (!instr->is_typed_elements()) { | 2138 if (!instr->is_typed_elements()) { |
2134 LOperand* obj = UseRegisterAtStart(instr->elements()); | 2139 LOperand* obj = UseRegisterAtStart(instr->elements()); |
2135 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); | 2140 result = DefineAsRegister(new(zone()) LLoadKeyed(obj, key)); |
2136 } else { | 2141 } else { |
2137 ASSERT( | 2142 ASSERT( |
2138 (instr->representation().IsInteger32() && | 2143 (instr->representation().IsInteger32() && |
2139 !(IsDoubleOrFloatElementsKind(elements_kind))) || | 2144 !(IsDoubleOrFloatElementsKind(elements_kind))) || |
(...skipping 24 matching lines...) Expand all Loading... |
2164 | 2169 |
2165 LLoadKeyedGeneric* result = | 2170 LLoadKeyedGeneric* result = |
2166 new(zone()) LLoadKeyedGeneric(context, object, key); | 2171 new(zone()) LLoadKeyedGeneric(context, object, key); |
2167 return MarkAsCall(DefineFixed(result, rax), instr); | 2172 return MarkAsCall(DefineFixed(result, rax), instr); |
2168 } | 2173 } |
2169 | 2174 |
2170 | 2175 |
2171 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2176 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
2172 ElementsKind elements_kind = instr->elements_kind(); | 2177 ElementsKind elements_kind = instr->elements_kind(); |
2173 | 2178 |
2174 if (instr->IsDehoisted()) { | 2179 if ((kPointerSize == kInt64Size) && instr->IsDehoisted()) { |
2175 FindDehoistedKeyDefinitions(instr->key()); | 2180 FindDehoistedKeyDefinitions(instr->key()); |
2176 } | 2181 } |
2177 | 2182 |
2178 if (!instr->is_typed_elements()) { | 2183 if (!instr->is_typed_elements()) { |
2179 ASSERT(instr->elements()->representation().IsTagged()); | 2184 ASSERT(instr->elements()->representation().IsTagged()); |
2180 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2185 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2181 LOperand* object = NULL; | 2186 LOperand* object = NULL; |
2182 LOperand* key = NULL; | 2187 LOperand* key = NULL; |
2183 LOperand* val = NULL; | 2188 LOperand* val = NULL; |
2184 | 2189 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2597 LOperand* function = UseRegisterAtStart(instr->function()); | 2602 LOperand* function = UseRegisterAtStart(instr->function()); |
2598 LAllocateBlockContext* result = | 2603 LAllocateBlockContext* result = |
2599 new(zone()) LAllocateBlockContext(context, function); | 2604 new(zone()) LAllocateBlockContext(context, function); |
2600 return MarkAsCall(DefineFixed(result, rsi), instr); | 2605 return MarkAsCall(DefineFixed(result, rsi), instr); |
2601 } | 2606 } |
2602 | 2607 |
2603 | 2608 |
2604 } } // namespace v8::internal | 2609 } } // namespace v8::internal |
2605 | 2610 |
2606 #endif // V8_TARGET_ARCH_X64 | 2611 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |