| 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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 ASSERT(!next->IsBlockEntry()); | 734 ASSERT(!next->IsBlockEntry()); |
| 735 ASSERT(!IsControlInstruction()); | 735 ASSERT(!IsControlInstruction()); |
| 736 ASSERT(!next->block()->IsStartBlock()); | 736 ASSERT(!next->block()->IsStartBlock()); |
| 737 ASSERT(next->previous_ != NULL); | 737 ASSERT(next->previous_ != NULL); |
| 738 HInstruction* prev = next->previous(); | 738 HInstruction* prev = next->previous(); |
| 739 prev->next_ = this; | 739 prev->next_ = this; |
| 740 next->previous_ = this; | 740 next->previous_ = this; |
| 741 next_ = next; | 741 next_ = next; |
| 742 previous_ = prev; | 742 previous_ = prev; |
| 743 SetBlock(next->block()); | 743 SetBlock(next->block()); |
| 744 if (position() == RelocInfo::kNoPosition && |
| 745 next->position() != RelocInfo::kNoPosition) { |
| 746 set_position(next->position()); |
| 747 } |
| 744 } | 748 } |
| 745 | 749 |
| 746 | 750 |
| 747 void HInstruction::InsertAfter(HInstruction* previous) { | 751 void HInstruction::InsertAfter(HInstruction* previous) { |
| 748 ASSERT(!IsLinked()); | 752 ASSERT(!IsLinked()); |
| 749 ASSERT(!previous->IsControlInstruction()); | 753 ASSERT(!previous->IsControlInstruction()); |
| 750 ASSERT(!IsControlInstruction() || previous->next_ == NULL); | 754 ASSERT(!IsControlInstruction() || previous->next_ == NULL); |
| 751 HBasicBlock* block = previous->block(); | 755 HBasicBlock* block = previous->block(); |
| 752 // Never insert anything except constants into the start block after finishing | 756 // Never insert anything except constants into the start block after finishing |
| 753 // it. | 757 // it. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 768 } | 772 } |
| 769 | 773 |
| 770 previous_ = previous; | 774 previous_ = previous; |
| 771 next_ = next; | 775 next_ = next; |
| 772 SetBlock(block); | 776 SetBlock(block); |
| 773 previous->next_ = this; | 777 previous->next_ = this; |
| 774 if (next != NULL) next->previous_ = this; | 778 if (next != NULL) next->previous_ = this; |
| 775 if (block->last() == previous) { | 779 if (block->last() == previous) { |
| 776 block->set_last(this); | 780 block->set_last(this); |
| 777 } | 781 } |
| 782 if (position() == RelocInfo::kNoPosition && |
| 783 previous->position() != RelocInfo::kNoPosition) { |
| 784 set_position(previous->position()); |
| 785 } |
| 778 } | 786 } |
| 779 | 787 |
| 780 | 788 |
| 781 #ifdef DEBUG | 789 #ifdef DEBUG |
| 782 void HInstruction::Verify() { | 790 void HInstruction::Verify() { |
| 783 // Verify that input operands are defined before use. | 791 // Verify that input operands are defined before use. |
| 784 HBasicBlock* cur_block = block(); | 792 HBasicBlock* cur_block = block(); |
| 785 for (int i = 0; i < OperandCount(); ++i) { | 793 for (int i = 0; i < OperandCount(); ++i) { |
| 786 HValue* other_operand = OperandAt(i); | 794 HValue* other_operand = OperandAt(i); |
| 787 if (other_operand == NULL) continue; | 795 if (other_operand == NULL) continue; |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 Range* HConstant::InferRange(Zone* zone) { | 1593 Range* HConstant::InferRange(Zone* zone) { |
| 1586 if (has_int32_value_) { | 1594 if (has_int32_value_) { |
| 1587 Range* result = new(zone) Range(int32_value_, int32_value_); | 1595 Range* result = new(zone) Range(int32_value_, int32_value_); |
| 1588 result->set_can_be_minus_zero(false); | 1596 result->set_can_be_minus_zero(false); |
| 1589 return result; | 1597 return result; |
| 1590 } | 1598 } |
| 1591 return HValue::InferRange(zone); | 1599 return HValue::InferRange(zone); |
| 1592 } | 1600 } |
| 1593 | 1601 |
| 1594 | 1602 |
| 1603 int HPhi::position() const { |
| 1604 return block()->first()->position(); |
| 1605 } |
| 1606 |
| 1607 |
| 1595 Range* HPhi::InferRange(Zone* zone) { | 1608 Range* HPhi::InferRange(Zone* zone) { |
| 1596 Representation r = representation(); | 1609 Representation r = representation(); |
| 1597 if (r.IsSmiOrInteger32()) { | 1610 if (r.IsSmiOrInteger32()) { |
| 1598 if (block()->IsLoopHeader()) { | 1611 if (block()->IsLoopHeader()) { |
| 1599 Range* range = r.IsSmi() | 1612 Range* range = r.IsSmi() |
| 1600 ? new(zone) Range(Smi::kMinValue, Smi::kMaxValue) | 1613 ? new(zone) Range(Smi::kMinValue, Smi::kMaxValue) |
| 1601 : new(zone) Range(kMinInt, kMaxInt); | 1614 : new(zone) Range(kMinInt, kMaxInt); |
| 1602 return range; | 1615 return range; |
| 1603 } else { | 1616 } else { |
| 1604 Range* range = OperandAt(0)->range()->Copy(zone); | 1617 Range* range = OperandAt(0)->range()->Copy(zone); |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2389 // same capture id in the current and all outer environments. | 2402 // same capture id in the current and all outer environments. |
| 2390 void HCapturedObject::ReplayEnvironment(HEnvironment* env) { | 2403 void HCapturedObject::ReplayEnvironment(HEnvironment* env) { |
| 2391 ASSERT(env != NULL); | 2404 ASSERT(env != NULL); |
| 2392 while (env != NULL) { | 2405 while (env != NULL) { |
| 2393 ReplayEnvironmentNested(env->values(), this); | 2406 ReplayEnvironmentNested(env->values(), this); |
| 2394 env = env->outer(); | 2407 env = env->outer(); |
| 2395 } | 2408 } |
| 2396 } | 2409 } |
| 2397 | 2410 |
| 2398 | 2411 |
| 2412 void HCapturedObject::PrintDataTo(StringStream* stream) { |
| 2413 stream->Add("#%d ", capture_id()); |
| 2414 HDematerializedObject::PrintDataTo(stream); |
| 2415 } |
| 2416 |
| 2417 |
| 2399 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, | 2418 void HEnterInlined::RegisterReturnTarget(HBasicBlock* return_target, |
| 2400 Zone* zone) { | 2419 Zone* zone) { |
| 2401 ASSERT(return_target->IsInlineReturnTarget()); | 2420 ASSERT(return_target->IsInlineReturnTarget()); |
| 2402 return_targets_.Add(return_target, zone); | 2421 return_targets_.Add(return_target, zone); |
| 2403 } | 2422 } |
| 2404 | 2423 |
| 2405 | 2424 |
| 2406 void HEnterInlined::PrintDataTo(StringStream* stream) { | 2425 void HEnterInlined::PrintDataTo(StringStream* stream) { |
| 2407 SmartArrayPointer<char> name = function()->debug_name()->ToCString(); | 2426 SmartArrayPointer<char> name = function()->debug_name()->ToCString(); |
| 2408 stream->Add("%s, id=%d", *name, function()->id().ToInt()); | 2427 stream->Add("%s, id=%d", *name, function()->id().ToInt()); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2550 } | 2569 } |
| 2551 set_representation(r); | 2570 set_representation(r); |
| 2552 SetFlag(kUseGVN); | 2571 SetFlag(kUseGVN); |
| 2553 } | 2572 } |
| 2554 | 2573 |
| 2555 | 2574 |
| 2556 bool HConstant::EmitAtUses() { | 2575 bool HConstant::EmitAtUses() { |
| 2557 ASSERT(IsLinked()); | 2576 ASSERT(IsLinked()); |
| 2558 if (block()->graph()->has_osr() && | 2577 if (block()->graph()->has_osr() && |
| 2559 block()->graph()->IsStandardConstant(this)) { | 2578 block()->graph()->IsStandardConstant(this)) { |
| 2579 // TODO(titzer): this seems like a hack that should be fixed by custom OSR. |
| 2560 return true; | 2580 return true; |
| 2561 } | 2581 } |
| 2562 if (UseCount() == 0) return true; | 2582 if (UseCount() == 0) return true; |
| 2563 if (IsCell()) return false; | 2583 if (IsCell()) return false; |
| 2564 if (representation().IsDouble()) return false; | 2584 if (representation().IsDouble()) return false; |
| 2565 return true; | 2585 return true; |
| 2566 } | 2586 } |
| 2567 | 2587 |
| 2568 | 2588 |
| 2569 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const { | 2589 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const { |
| (...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4271 break; | 4291 break; |
| 4272 case kExternalMemory: | 4292 case kExternalMemory: |
| 4273 stream->Add("[external-memory]"); | 4293 stream->Add("[external-memory]"); |
| 4274 break; | 4294 break; |
| 4275 } | 4295 } |
| 4276 | 4296 |
| 4277 stream->Add("@%d", offset()); | 4297 stream->Add("@%d", offset()); |
| 4278 } | 4298 } |
| 4279 | 4299 |
| 4280 } } // namespace v8::internal | 4300 } } // namespace v8::internal |
| OLD | NEW |