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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 result = HType::Boolean(); | 357 result = HType::Boolean(); |
358 } else if (value->IsJSObject()) { | 358 } else if (value->IsJSObject()) { |
359 result = HType::JSObject(); | 359 result = HType::JSObject(); |
360 } else if (value->IsJSArray()) { | 360 } else if (value->IsJSArray()) { |
361 result = HType::JSArray(); | 361 result = HType::JSArray(); |
362 } | 362 } |
363 return result; | 363 return result; |
364 } | 364 } |
365 | 365 |
366 | 366 |
367 bool HValue::CheckDominanceFollowingDefinitionList( | |
368 HValue* dominator, HValue* dominated) { | |
369 if (dominator->block() != dominated->block()) { | |
370 // If they are in different blocks we can use the dominance relation | |
371 // between the blocks. | |
372 return dominator->block()->Dominates(dominated->block()); | |
373 } else { | |
374 // Otherwise we must see which instruction comes first, considering | |
375 // that phis always precede regular instructions. | |
376 if (dominator->IsInstruction()) { | |
377 if (dominated->IsInstruction()) { | |
378 HInstruction* next = HInstruction::cast(dominator)->next(); | |
379 while (next != NULL) { | |
Jakob Kummerow
2013/01/31 14:06:43
I don't like endless loops very much.
Massi
2013/01/31 17:16:19
Done (and it was actually an embarrassing bug...).
| |
380 if (next == dominated) return true; | |
381 } | |
382 return false; | |
383 } else if (dominated->IsPhi()) { | |
384 return false; | |
385 } else { | |
386 UNREACHABLE(); | |
387 } | |
388 } else if (dominator->IsPhi()) { | |
389 if (dominated->IsInstruction()) { | |
390 return true; | |
391 } else { | |
392 // We cannot compare which phi comes first. | |
393 UNREACHABLE(); | |
394 } | |
395 } else { | |
396 UNREACHABLE(); | |
397 } | |
398 return false; | |
399 } | |
400 } | |
401 | |
402 | |
403 bool HValue::CheckDominanceUsingProcessedFlag( | |
404 HValue* dominator, HValue* dominated) { | |
405 if (dominator->block() != dominated->block()) { | |
406 return dominator->block()->Dominates(dominated->block()); | |
407 } else { | |
408 // If "dominated" is in the same block as the definition we check if is | |
409 // has already been processed or if it is a phi: if not it is dominated. | |
410 return dominated->CheckFlag(kIDefsProcessingDone) || dominated->IsPhi(); | |
Jakob Kummerow
2013/01/31 14:06:43
I think this condition is the wrong way round: it'
Massi
2013/01/31 17:16:19
Done.
| |
411 } | |
412 } | |
413 | |
414 | |
367 bool HValue::IsDefinedAfter(HBasicBlock* other) const { | 415 bool HValue::IsDefinedAfter(HBasicBlock* other) const { |
368 return block()->block_id() > other->block_id(); | 416 return block()->block_id() > other->block_id(); |
369 } | 417 } |
370 | 418 |
371 | 419 |
372 HUseListNode* HUseListNode::tail() { | 420 HUseListNode* HUseListNode::tail() { |
373 // Skip and remove dead items in the use list. | 421 // Skip and remove dead items in the use list. |
374 while (tail_ != NULL && tail_->value()->CheckFlag(HValue::kIsDead)) { | 422 while (tail_ != NULL && tail_->value()->CheckFlag(HValue::kIsDead)) { |
375 tail_ = tail_->tail_; | 423 tail_ = tail_->tail_; |
376 } | 424 } |
(...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2861 | 2909 |
2862 | 2910 |
2863 void HCheckFunction::Verify() { | 2911 void HCheckFunction::Verify() { |
2864 HInstruction::Verify(); | 2912 HInstruction::Verify(); |
2865 ASSERT(HasNoUses()); | 2913 ASSERT(HasNoUses()); |
2866 } | 2914 } |
2867 | 2915 |
2868 #endif | 2916 #endif |
2869 | 2917 |
2870 } } // namespace v8::internal | 2918 } } // namespace v8::internal |
OLD | NEW |