| 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::Dominates(HValue* dominator, HValue* dominated) { |
| 368 if (dominator->block() != dominated->block()) { |
| 369 // If they are in different blocks we can use the dominance relation |
| 370 // between the blocks. |
| 371 return dominator->block()->Dominates(dominated->block()); |
| 372 } else { |
| 373 // Otherwise we must see which instruction comes first, considering |
| 374 // that phis always precede regular instructions. |
| 375 if (dominator->IsInstruction()) { |
| 376 if (dominated->IsInstruction()) { |
| 377 for (HInstruction* next = HInstruction::cast(dominator)->next(); |
| 378 next != NULL; |
| 379 next = next->next()) { |
| 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::TestDominanceUsingProcessedFlag(HValue* dominator, |
| 404 HValue* dominated) { |
| 405 if (dominator->block() != dominated->block()) { |
| 406 return dominator->block()->Dominates(dominated->block()); |
| 407 } else { |
| 408 // If both arguments are in the same block we check if "dominator" has |
| 409 // already been processed or if it is a phi: if yes it dominates the other. |
| 410 return dominator->CheckFlag(kIDefsProcessingDone) || dominator->IsPhi(); |
| 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 |