Chromium Code Reviews| 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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 753 } | 753 } |
| 754 | 754 |
| 755 | 755 |
| 756 void HBoundsCheck::PrintDataTo(StringStream* stream) { | 756 void HBoundsCheck::PrintDataTo(StringStream* stream) { |
| 757 index()->PrintNameTo(stream); | 757 index()->PrintNameTo(stream); |
| 758 stream->Add(" "); | 758 stream->Add(" "); |
| 759 length()->PrintNameTo(stream); | 759 length()->PrintNameTo(stream); |
| 760 } | 760 } |
| 761 | 761 |
| 762 | 762 |
| 763 void HBoundsCheck::BuildSsi() { | |
| 764 HInstruction* current = this; | |
| 765 | |
| 766 current = HSsiDefinition::New( | |
| 767 length(), current, HSsiDefinition::IF_TAGGED_IS_SMI, length()); | |
|
danno
2012/12/28 10:42:41
I don't think we want to handle "SMI-ness" here wi
| |
| 768 | |
| 769 current = HSsiDefinition::New( | |
| 770 index(), current, HSsiDefinition::IF_TAGGED_IS_SMI, index()); | |
| 771 current = HSsiDefinition::New( | |
| 772 current, current, HSsiDefinition::GE, | |
| 773 block()->graph()->GetConstant0()); | |
| 774 HSsiDefinition::New( | |
| 775 current, current, HSsiDefinition::LT, | |
| 776 length()); | |
| 777 } | |
| 778 | |
| 779 | |
| 763 void HCallConstantFunction::PrintDataTo(StringStream* stream) { | 780 void HCallConstantFunction::PrintDataTo(StringStream* stream) { |
| 764 if (IsApplyFunction()) { | 781 if (IsApplyFunction()) { |
| 765 stream->Add("optimized apply "); | 782 stream->Add("optimized apply "); |
| 766 } else { | 783 } else { |
| 767 stream->Add("%o ", function()->shared()->DebugName()); | 784 stream->Add("%o ", function()->shared()->DebugName()); |
| 768 } | 785 } |
| 769 stream->Add("#%d", argument_count()); | 786 stream->Add("#%d", argument_count()); |
| 770 } | 787 } |
| 771 | 788 |
| 772 | 789 |
| (...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2230 | 2247 |
| 2231 | 2248 |
| 2232 // Implementation of type inference and type conversions. Calculates | 2249 // Implementation of type inference and type conversions. Calculates |
| 2233 // the inferred type of this instruction based on the input operands. | 2250 // the inferred type of this instruction based on the input operands. |
| 2234 | 2251 |
| 2235 HType HValue::CalculateInferredType() { | 2252 HType HValue::CalculateInferredType() { |
| 2236 return type_; | 2253 return type_; |
| 2237 } | 2254 } |
| 2238 | 2255 |
| 2239 | 2256 |
| 2257 HSsiDefinition* HSsiDefinition::New(HValue* previous_definition, | |
| 2258 HInstruction* insertion_point, | |
| 2259 ValueInfoRelation relation, | |
| 2260 HValue* constraint, | |
| 2261 int delta) { | |
| 2262 return new (previous_definition->block()->zone()) HSsiDefinition( | |
| 2263 previous_definition, insertion_point, relation, constraint, delta); | |
| 2264 } | |
| 2265 | |
| 2266 | |
| 2267 HSsiDefinition::HSsiDefinition(HValue* previous_definition, | |
| 2268 HInstruction* insertion_point, | |
| 2269 ValueInfoRelation relation, | |
|
danno
2012/12/28 10:42:41
I think I would pre just a bit more abstraction he
| |
| 2270 HValue* constraint, | |
| 2271 int delta) | |
| 2272 : HUnaryOperation(previous_definition), | |
| 2273 value_before_ssi_(previous_definition->ValueBeforeSsi()), | |
| 2274 relation_(relation), | |
| 2275 constraint_(constraint), | |
| 2276 delta_(delta) { | |
| 2277 set_representation(value_before_ssi_->representation()); | |
| 2278 InsertAfter(insertion_point); | |
| 2279 | |
| 2280 // Set the flag so while adjusting uses "this" will appear not to be | |
| 2281 // dominated by itself: previous_definition_ in "this" must not be changed. | |
| 2282 SetFlag(kProcessedBySsi); | |
| 2283 | |
| 2284 HUseIterator uses = previous_definition->uses(); | |
| 2285 while (!uses.Done()) { | |
| 2286 HValue* use = uses.value(); | |
| 2287 int index = uses.index(); | |
| 2288 uses.Advance(); | |
| 2289 | |
| 2290 // We need to update all dominated uses. | |
| 2291 // If the use is in the same block as the definition we check if is has | |
| 2292 // already been processed by SSI or if it is a phi: if not it is dominated. | |
| 2293 if ((block() == use->block() && ! | |
| 2294 (use->CheckFlag(kProcessedBySsi) || use->IsPhi())) || | |
| 2295 block()->Dominates(use->block())) { | |
| 2296 use->SetOperandAt(index, this); | |
| 2297 } | |
| 2298 } | |
| 2299 } | |
| 2300 | |
| 2301 | |
| 2302 void HSsiDefinition::PrintDataTo(StringStream* stream) { | |
| 2303 stream->Add("(previous: "); | |
| 2304 previous_definition()->PrintNameTo(stream); | |
| 2305 stream->Add(", relation: "); | |
| 2306 ValueBeforeSsi()->PrintNameTo(stream); | |
| 2307 stream->Add(" %s ", RelationName(relation_)); | |
| 2308 constraint()->PrintNameTo(stream); | |
| 2309 stream->Add(")"); | |
| 2310 } | |
| 2311 | |
| 2312 | |
| 2240 HType HCheckMaps::CalculateInferredType() { | 2313 HType HCheckMaps::CalculateInferredType() { |
| 2241 return value()->type(); | 2314 return value()->type(); |
| 2242 } | 2315 } |
| 2243 | 2316 |
| 2244 | 2317 |
| 2245 HType HCheckFunction::CalculateInferredType() { | 2318 HType HCheckFunction::CalculateInferredType() { |
| 2246 return value()->type(); | 2319 return value()->type(); |
| 2247 } | 2320 } |
| 2248 | 2321 |
| 2249 | 2322 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2786 | 2859 |
| 2787 | 2860 |
| 2788 void HCheckFunction::Verify() { | 2861 void HCheckFunction::Verify() { |
| 2789 HInstruction::Verify(); | 2862 HInstruction::Verify(); |
| 2790 ASSERT(HasNoUses()); | 2863 ASSERT(HasNoUses()); |
| 2791 } | 2864 } |
| 2792 | 2865 |
| 2793 #endif | 2866 #endif |
| 2794 | 2867 |
| 2795 } } // namespace v8::internal | 2868 } } // namespace v8::internal |
| OLD | NEW |