OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 return NULL; | 168 return NULL; |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 | 172 |
173 bool LGoto::HasInterestingComment(LCodeGen* gen) const { | 173 bool LGoto::HasInterestingComment(LCodeGen* gen) const { |
174 return !gen->IsNextEmittedBlock(block_id()); | 174 return !gen->IsNextEmittedBlock(block_id()); |
175 } | 175 } |
176 | 176 |
177 | 177 |
178 ArrayInstructionInterface* CheckLoadStroeKeyed(HValue* value) { | |
179 if (value->IsLoadKeyed()) return HLoadKeyed::cast(value); | |
180 if (value->IsStoreKeyed()) return HStoreKeyed::cast(value); | |
181 return NULL; | |
182 } | |
183 | |
184 | |
185 bool KeyForKeyedOpNeedsSignExtension(HValue* hinstr) { | |
186 if (hinstr->HasRange() && !hinstr->range()->CanBeNegative()) { | |
187 return false; | |
188 } | |
189 | |
190 ArrayInstructionInterface* array_operation; | |
191 for (HUseIterator it(hinstr->uses()); !it.Done(); it.Advance()) { | |
192 HValue* value = it.value(); | |
193 array_operation = CheckLoadStroeKeyed(value); | |
194 if (array_operation != NULL && array_operation->GetKey() == hinstr) { | |
195 if (array_operation->IsDehoisted()) { | |
196 return true; | |
197 } | |
198 } else if (value->IsPhi() && HPhi::cast(value)->HasRealUses()) { | |
199 for (HUseIterator itp(value->uses()); !itp.Done(); itp.Advance()) { | |
200 array_operation = CheckLoadStroeKeyed(itp.value()); | |
201 if (array_operation != NULL && array_operation->GetKey() == value) { | |
202 if (array_operation->IsDehoisted()) { | |
danno
2014/03/12 14:26:08
This doesn't work completely, if you have phi node
| |
203 return true; | |
204 } | |
205 } | |
206 } | |
207 } | |
208 } | |
209 | |
210 return false; | |
211 } | |
212 | |
213 | |
214 template<int R> | |
215 bool LTemplateResultInstruction<R>::MustSignExtendResult() const { | |
216 return this->hydrogen_value() != NULL && | |
217 KeyForKeyedOpNeedsSignExtension(this->hydrogen_value()); | |
218 } | |
219 | |
220 | |
178 void LGoto::PrintDataTo(StringStream* stream) { | 221 void LGoto::PrintDataTo(StringStream* stream) { |
179 stream->Add("B%d", block_id()); | 222 stream->Add("B%d", block_id()); |
180 } | 223 } |
181 | 224 |
182 | 225 |
183 void LBranch::PrintDataTo(StringStream* stream) { | 226 void LBranch::PrintDataTo(StringStream* stream) { |
184 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); | 227 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); |
185 value()->PrintTo(stream); | 228 value()->PrintTo(stream); |
186 } | 229 } |
187 | 230 |
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2010 if (!instr->is_typed_elements()) { | 2053 if (!instr->is_typed_elements()) { |
2011 ASSERT(instr->elements()->representation().IsTagged()); | 2054 ASSERT(instr->elements()->representation().IsTagged()); |
2012 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2055 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
2013 LOperand* object = NULL; | 2056 LOperand* object = NULL; |
2014 LOperand* key = NULL; | 2057 LOperand* key = NULL; |
2015 LOperand* val = NULL; | 2058 LOperand* val = NULL; |
2016 | 2059 |
2017 Representation value_representation = instr->value()->representation(); | 2060 Representation value_representation = instr->value()->representation(); |
2018 if (value_representation.IsDouble()) { | 2061 if (value_representation.IsDouble()) { |
2019 object = UseRegisterAtStart(instr->elements()); | 2062 object = UseRegisterAtStart(instr->elements()); |
2020 val = UseTempRegister(instr->value()); | 2063 val = UseRegisterAtStart(instr->value()); |
2021 key = UseRegisterOrConstantAtStart(instr->key()); | 2064 key = UseRegisterOrConstantAtStart(instr->key()); |
2022 } else { | 2065 } else { |
2023 ASSERT(value_representation.IsSmiOrTagged() || | 2066 ASSERT(value_representation.IsSmiOrTagged() || |
2024 value_representation.IsInteger32()); | 2067 value_representation.IsInteger32()); |
2025 if (needs_write_barrier) { | 2068 if (needs_write_barrier) { |
2026 object = UseTempRegister(instr->elements()); | 2069 object = UseTempRegister(instr->elements()); |
2027 val = UseTempRegister(instr->value()); | 2070 val = UseTempRegister(instr->value()); |
2028 key = UseTempRegister(instr->key()); | 2071 key = UseTempRegister(instr->key()); |
2029 } else { | 2072 } else { |
2030 object = UseRegisterAtStart(instr->elements()); | 2073 object = UseRegisterAtStart(instr->elements()); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2436 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2479 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2437 LOperand* object = UseRegister(instr->object()); | 2480 LOperand* object = UseRegister(instr->object()); |
2438 LOperand* index = UseTempRegister(instr->index()); | 2481 LOperand* index = UseTempRegister(instr->index()); |
2439 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2482 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2440 } | 2483 } |
2441 | 2484 |
2442 | 2485 |
2443 } } // namespace v8::internal | 2486 } } // namespace v8::internal |
2444 | 2487 |
2445 #endif // V8_TARGET_ARCH_X64 | 2488 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |