| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #undef DEFINE_COMPILE | 53 #undef DEFINE_COMPILE |
| 54 | 54 |
| 55 | 55 |
| 56 const char* Representation::Mnemonic() const { | 56 const char* Representation::Mnemonic() const { |
| 57 switch (kind_) { | 57 switch (kind_) { |
| 58 case kNone: return "v"; | 58 case kNone: return "v"; |
| 59 case kTagged: return "t"; | 59 case kTagged: return "t"; |
| 60 case kDouble: return "d"; | 60 case kDouble: return "d"; |
| 61 case kInteger32: return "i"; | 61 case kInteger32: return "i"; |
| 62 case kExternal: return "x"; | 62 case kExternal: return "x"; |
| 63 case kNumRepresentations: | 63 default: |
| 64 UNREACHABLE(); | 64 UNREACHABLE(); |
| 65 return NULL; | 65 return NULL; |
| 66 } | 66 } |
| 67 UNREACHABLE(); | |
| 68 return NULL; | |
| 69 } | 67 } |
| 70 | 68 |
| 71 | 69 |
| 72 static int32_t ConvertAndSetOverflow(int64_t result, bool* overflow) { | 70 static int32_t ConvertAndSetOverflow(int64_t result, bool* overflow) { |
| 73 if (result > kMaxInt) { | 71 if (result > kMaxInt) { |
| 74 *overflow = true; | 72 *overflow = true; |
| 75 return kMaxInt; | 73 return kMaxInt; |
| 76 } | 74 } |
| 77 if (result < kMinInt) { | 75 if (result < kMinInt) { |
| 78 *overflow = true; | 76 *overflow = true; |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 393 |
| 396 void HValue::SetBlock(HBasicBlock* block) { | 394 void HValue::SetBlock(HBasicBlock* block) { |
| 397 ASSERT(block_ == NULL || block == NULL); | 395 ASSERT(block_ == NULL || block == NULL); |
| 398 block_ = block; | 396 block_ = block; |
| 399 if (id_ == kNoNumber && block != NULL) { | 397 if (id_ == kNoNumber && block != NULL) { |
| 400 id_ = block->graph()->GetNextValueID(this); | 398 id_ = block->graph()->GetNextValueID(this); |
| 401 } | 399 } |
| 402 } | 400 } |
| 403 | 401 |
| 404 | 402 |
| 405 void HValue::PrintTypeTo(HType type, StringStream* stream) { | 403 void HValue::PrintTypeTo(StringStream* stream) { |
| 406 stream->Add(type.ToShortString()); | 404 if (!representation().IsTagged() || type().Equals(HType::Tagged())) return; |
| 405 stream->Add(" type[%s]", type().ToString()); |
| 406 } |
| 407 |
| 408 |
| 409 void HValue::PrintRangeTo(StringStream* stream) { |
| 410 if (range() == NULL || range()->IsMostGeneric()) return; |
| 411 stream->Add(" range[%d,%d,m0=%d]", |
| 412 range()->lower(), |
| 413 range()->upper(), |
| 414 static_cast<int>(range()->CanBeMinusZero())); |
| 415 } |
| 416 |
| 417 |
| 418 void HValue::PrintChangesTo(StringStream* stream) { |
| 419 int changes_flags = (flags() & HValue::ChangesFlagsMask()); |
| 420 if (changes_flags == 0) return; |
| 421 stream->Add(" changes["); |
| 422 if (changes_flags == AllSideEffects()) { |
| 423 stream->Add("*"); |
| 424 } else { |
| 425 bool add_comma = false; |
| 426 #define PRINT_DO(type) \ |
| 427 if (changes_flags & (1 << kChanges##type)) { \ |
| 428 if (add_comma) stream->Add(","); \ |
| 429 add_comma = true; \ |
| 430 stream->Add(#type); \ |
| 431 } |
| 432 GVN_FLAG_LIST(PRINT_DO); |
| 433 #undef PRINT_DO |
| 434 } |
| 435 stream->Add("]"); |
| 407 } | 436 } |
| 408 | 437 |
| 409 | 438 |
| 410 void HValue::PrintNameTo(StringStream* stream) { | 439 void HValue::PrintNameTo(StringStream* stream) { |
| 411 stream->Add("%s%d", representation_.Mnemonic(), id()); | 440 stream->Add("%s%d", representation_.Mnemonic(), id()); |
| 412 } | 441 } |
| 413 | 442 |
| 414 | 443 |
| 415 bool HValue::UpdateInferredType() { | 444 bool HValue::UpdateInferredType() { |
| 416 HType type = CalculateInferredType(); | 445 HType type = CalculateInferredType(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 | 487 |
| 459 | 488 |
| 460 void HValue::ComputeInitialRange() { | 489 void HValue::ComputeInitialRange() { |
| 461 ASSERT(!HasRange()); | 490 ASSERT(!HasRange()); |
| 462 range_ = InferRange(); | 491 range_ = InferRange(); |
| 463 ASSERT(HasRange()); | 492 ASSERT(HasRange()); |
| 464 } | 493 } |
| 465 | 494 |
| 466 | 495 |
| 467 void HInstruction::PrintTo(StringStream* stream) { | 496 void HInstruction::PrintTo(StringStream* stream) { |
| 497 PrintMnemonicTo(stream); |
| 498 PrintDataTo(stream); |
| 499 PrintRangeTo(stream); |
| 500 PrintChangesTo(stream); |
| 501 PrintTypeTo(stream); |
| 502 } |
| 503 |
| 504 |
| 505 void HInstruction::PrintMnemonicTo(StringStream* stream) { |
| 468 stream->Add("%s", Mnemonic()); | 506 stream->Add("%s", Mnemonic()); |
| 469 if (HasSideEffects()) stream->Add("*"); | 507 if (HasSideEffects()) stream->Add("*"); |
| 470 stream->Add(" "); | 508 stream->Add(" "); |
| 471 PrintDataTo(stream); | |
| 472 | |
| 473 if (range() != NULL && | |
| 474 !range()->IsMostGeneric() && | |
| 475 !range()->CanBeMinusZero()) { | |
| 476 stream->Add(" range[%d,%d,m0=%d]", | |
| 477 range()->lower(), | |
| 478 range()->upper(), | |
| 479 static_cast<int>(range()->CanBeMinusZero())); | |
| 480 } | |
| 481 | |
| 482 int changes_flags = (flags() & HValue::ChangesFlagsMask()); | |
| 483 if (changes_flags != 0) { | |
| 484 stream->Add(" changes[0x%x]", changes_flags); | |
| 485 } | |
| 486 | |
| 487 if (representation().IsTagged() && !type().Equals(HType::Tagged())) { | |
| 488 stream->Add(" type[%s]", type().ToString()); | |
| 489 } | |
| 490 } | 509 } |
| 491 | 510 |
| 492 | 511 |
| 493 void HInstruction::Unlink() { | 512 void HInstruction::Unlink() { |
| 494 ASSERT(IsLinked()); | 513 ASSERT(IsLinked()); |
| 495 ASSERT(!IsControlInstruction()); // Must never move control instructions. | 514 ASSERT(!IsControlInstruction()); // Must never move control instructions. |
| 496 ASSERT(!IsBlockEntry()); // Doesn't make sense to delete these. | 515 ASSERT(!IsBlockEntry()); // Doesn't make sense to delete these. |
| 497 ASSERT(previous_ != NULL); | 516 ASSERT(previous_ != NULL); |
| 498 previous_->next_ = next_; | 517 previous_->next_ = next_; |
| 499 if (next_ == NULL) { | 518 if (next_ == NULL) { |
| (...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1723 | 1742 |
| 1724 | 1743 |
| 1725 void HCheckPrototypeMaps::Verify() { | 1744 void HCheckPrototypeMaps::Verify() { |
| 1726 HInstruction::Verify(); | 1745 HInstruction::Verify(); |
| 1727 ASSERT(HasNoUses()); | 1746 ASSERT(HasNoUses()); |
| 1728 } | 1747 } |
| 1729 | 1748 |
| 1730 #endif | 1749 #endif |
| 1731 | 1750 |
| 1732 } } // namespace v8::internal | 1751 } } // namespace v8::internal |
| OLD | NEW |