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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 626 HConstant* HGraph::GetConstantFalse() { | 626 HConstant* HGraph::GetConstantFalse() { |
| 627 return GetConstant(&constant_false_, isolate()->factory()->false_value()); | 627 return GetConstant(&constant_false_, isolate()->factory()->false_value()); |
| 628 } | 628 } |
| 629 | 629 |
| 630 | 630 |
| 631 HConstant* HGraph::GetConstantHole() { | 631 HConstant* HGraph::GetConstantHole() { |
| 632 return GetConstant(&constant_hole_, isolate()->factory()->the_hole_value()); | 632 return GetConstant(&constant_hole_, isolate()->factory()->the_hole_value()); |
| 633 } | 633 } |
| 634 | 634 |
| 635 | 635 |
| 636 HGraphBuilder::CheckBuilder::CheckBuilder(HGraphBuilder* builder, BailoutId id) | |
| 637 : builder_(builder), | |
| 638 finished_(false), | |
| 639 id_(id) { | |
| 640 HEnvironment* env = builder->environment(); | |
| 641 failure_block_ = builder->CreateBasicBlock(env->Copy()); | |
| 642 merge_block_ = builder->CreateBasicBlock(env->Copy()); | |
| 643 } | |
| 644 | |
| 645 | |
| 646 void HGraphBuilder::CheckBuilder::CheckNotUndefined(HValue* value) { | |
| 647 HEnvironment* env = builder_->environment(); | |
| 648 HIsNilAndBranch* compare = | |
| 649 new(zone()) HIsNilAndBranch(value, kStrictEquality, kUndefinedValue); | |
| 650 HBasicBlock* success_block = builder_->CreateBasicBlock(env->Copy()); | |
| 651 HBasicBlock* failure_block = builder_->CreateBasicBlock(env->Copy()); | |
| 652 compare->SetSuccessorAt(0, failure_block); | |
| 653 compare->SetSuccessorAt(1, success_block); | |
| 654 failure_block->Goto(failure_block_); | |
|
Jakob Kummerow
2013/02/08 12:45:49
This line looks weird. Too bad the edge split form
Michael Starzinger
2013/02/11 12:13:22
Yeah, I know, it also annoys me that we need this
| |
| 655 builder_->current_block()->Finish(compare); | |
| 656 builder_->set_current_block(success_block); | |
| 657 } | |
| 658 | |
| 659 | |
| 660 void HGraphBuilder::CheckBuilder::CheckIntegerEq(HValue* left, HValue* right) { | |
| 661 HEnvironment* env = builder_->environment(); | |
| 662 HCompareIDAndBranch* compare = | |
| 663 new(zone()) HCompareIDAndBranch(left, right, Token::EQ); | |
| 664 compare->AssumeRepresentation(Representation::Integer32()); | |
| 665 HBasicBlock* success_block = builder_->CreateBasicBlock(env->Copy()); | |
| 666 HBasicBlock* failure_block = builder_->CreateBasicBlock(env->Copy()); | |
| 667 compare->SetSuccessorAt(0, success_block); | |
| 668 compare->SetSuccessorAt(1, failure_block); | |
| 669 failure_block->Goto(failure_block_); | |
| 670 builder_->current_block()->Finish(compare); | |
| 671 builder_->set_current_block(success_block); | |
| 672 } | |
| 673 | |
| 674 | |
| 675 void HGraphBuilder::CheckBuilder::End() { | |
| 676 ASSERT(!finished_); | |
| 677 builder_->current_block()->Goto(merge_block_); | |
| 678 builder_->set_current_block(failure_block_); | |
|
Jakob Kummerow
2013/02/08 12:45:49
I think this line is not needed if you s/builder_-
Michael Starzinger
2013/02/11 12:13:22
Done.
| |
| 679 builder_->current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll); | |
| 680 failure_block_->SetJoinId(id_); | |
| 681 builder_->set_current_block(merge_block_); | |
| 682 merge_block_->SetJoinId(id_); | |
| 683 finished_ = true; | |
| 684 } | |
| 685 | |
| 686 | |
| 636 HGraphBuilder::IfBuilder::IfBuilder(HGraphBuilder* builder, BailoutId id) | 687 HGraphBuilder::IfBuilder::IfBuilder(HGraphBuilder* builder, BailoutId id) |
| 637 : builder_(builder), | 688 : builder_(builder), |
| 638 finished_(false), | 689 finished_(false), |
| 639 id_(id) { | 690 id_(id) { |
| 640 HEnvironment* env = builder->environment(); | 691 HEnvironment* env = builder->environment(); |
| 641 HEnvironment* true_env = env->Copy(); | 692 true_block_ = builder->CreateBasicBlock(env->Copy()); |
| 642 HEnvironment* false_env = env->Copy(); | 693 false_block_ = builder->CreateBasicBlock(env->Copy()); |
| 643 HEnvironment* merge_env = env->Copy(); | 694 merge_block_ = builder->CreateBasicBlock(env->Copy()); |
| 644 true_block_ = builder->CreateBasicBlock(true_env); | |
| 645 false_block_ = builder->CreateBasicBlock(false_env); | |
| 646 merge_block_ = builder->CreateBasicBlock(merge_env); | |
| 647 } | 695 } |
| 648 | 696 |
| 649 | 697 |
| 650 void HGraphBuilder::IfBuilder::BeginTrue(HValue* left, | 698 void HGraphBuilder::IfBuilder::BeginTrue(HValue* left, |
| 651 HValue* right, | 699 HValue* right, |
| 652 Token::Value token) { | 700 Token::Value token) { |
| 653 HCompareIDAndBranch* compare = | 701 HCompareIDAndBranch* compare = |
| 654 new(zone()) HCompareIDAndBranch(left, right, token); | 702 new(zone()) HCompareIDAndBranch(left, right, token); |
| 655 compare->ChangeRepresentation(Representation::Integer32()); | 703 compare->ChangeRepresentation(Representation::Integer32()); |
| 656 compare->SetSuccessorAt(0, true_block_); | 704 compare->SetSuccessorAt(0, true_block_); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 678 HGraphBuilder::LoopBuilder::LoopBuilder(HGraphBuilder* builder, | 726 HGraphBuilder::LoopBuilder::LoopBuilder(HGraphBuilder* builder, |
| 679 HValue* context, | 727 HValue* context, |
| 680 LoopBuilder::Direction direction, | 728 LoopBuilder::Direction direction, |
| 681 BailoutId id) | 729 BailoutId id) |
| 682 : builder_(builder), | 730 : builder_(builder), |
| 683 context_(context), | 731 context_(context), |
| 684 direction_(direction), | 732 direction_(direction), |
| 685 id_(id), | 733 id_(id), |
| 686 finished_(false) { | 734 finished_(false) { |
| 687 HEnvironment* env = builder_->environment(); | 735 HEnvironment* env = builder_->environment(); |
| 688 HEnvironment* body_env = env->Copy(); | |
| 689 HEnvironment* exit_env = env->Copy(); | |
| 690 header_block_ = builder->CreateLoopHeaderBlock(); | 736 header_block_ = builder->CreateLoopHeaderBlock(); |
| 691 body_block_ = builder->CreateBasicBlock(body_env); | 737 body_block_ = builder->CreateBasicBlock(env->Copy()); |
| 692 exit_block_ = builder->CreateBasicBlock(exit_env); | 738 exit_block_ = builder->CreateBasicBlock(env->Copy()); |
| 693 } | 739 } |
| 694 | 740 |
| 695 | 741 |
| 696 HValue* HGraphBuilder::LoopBuilder::BeginBody(HValue* initial, | 742 HValue* HGraphBuilder::LoopBuilder::BeginBody(HValue* initial, |
| 697 HValue* terminating, | 743 HValue* terminating, |
| 698 Token::Value token) { | 744 Token::Value token) { |
| 699 phi_ = new(zone()) HPhi(0, zone()); | 745 phi_ = new(zone()) HPhi(0, zone()); |
| 700 header_block_->AddPhi(phi_); | 746 header_block_->AddPhi(phi_); |
| 701 phi_->AddInput(initial); | 747 phi_->AddInput(initial); |
| 702 phi_->ChangeRepresentation(Representation::Integer32()); | 748 phi_->ChangeRepresentation(Representation::Integer32()); |
| (...skipping 9919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10622 } | 10668 } |
| 10623 } | 10669 } |
| 10624 | 10670 |
| 10625 #ifdef DEBUG | 10671 #ifdef DEBUG |
| 10626 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10672 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 10627 if (allocator_ != NULL) allocator_->Verify(); | 10673 if (allocator_ != NULL) allocator_->Verify(); |
| 10628 #endif | 10674 #endif |
| 10629 } | 10675 } |
| 10630 | 10676 |
| 10631 } } // namespace v8::internal | 10677 } } // namespace v8::internal |
| OLD | NEW |