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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 HConstant* HGraph::GetConstantFalse() { | 627 HConstant* HGraph::GetConstantFalse() { |
628 return GetConstant(&constant_false_, isolate()->factory()->false_value()); | 628 return GetConstant(&constant_false_, isolate()->factory()->false_value()); |
629 } | 629 } |
630 | 630 |
631 | 631 |
632 HConstant* HGraph::GetConstantHole() { | 632 HConstant* HGraph::GetConstantHole() { |
633 return GetConstant(&constant_hole_, isolate()->factory()->the_hole_value()); | 633 return GetConstant(&constant_hole_, isolate()->factory()->the_hole_value()); |
634 } | 634 } |
635 | 635 |
636 | 636 |
| 637 HGraphBuilder::CheckBuilder::CheckBuilder(HGraphBuilder* builder, BailoutId id) |
| 638 : builder_(builder), |
| 639 finished_(false), |
| 640 id_(id) { |
| 641 HEnvironment* env = builder->environment(); |
| 642 failure_block_ = builder->CreateBasicBlock(env->Copy()); |
| 643 merge_block_ = builder->CreateBasicBlock(env->Copy()); |
| 644 } |
| 645 |
| 646 |
| 647 void HGraphBuilder::CheckBuilder::CheckNotUndefined(HValue* value) { |
| 648 HEnvironment* env = builder_->environment(); |
| 649 HIsNilAndBranch* compare = |
| 650 new(zone()) HIsNilAndBranch(value, kStrictEquality, kUndefinedValue); |
| 651 HBasicBlock* success_block = builder_->CreateBasicBlock(env->Copy()); |
| 652 HBasicBlock* failure_block = builder_->CreateBasicBlock(env->Copy()); |
| 653 compare->SetSuccessorAt(0, failure_block); |
| 654 compare->SetSuccessorAt(1, success_block); |
| 655 failure_block->Goto(failure_block_); |
| 656 builder_->current_block()->Finish(compare); |
| 657 builder_->set_current_block(success_block); |
| 658 } |
| 659 |
| 660 |
| 661 void HGraphBuilder::CheckBuilder::CheckIntegerEq(HValue* left, HValue* right) { |
| 662 HEnvironment* env = builder_->environment(); |
| 663 HCompareIDAndBranch* compare = |
| 664 new(zone()) HCompareIDAndBranch(left, right, Token::EQ); |
| 665 compare->AssumeRepresentation(Representation::Integer32()); |
| 666 HBasicBlock* success_block = builder_->CreateBasicBlock(env->Copy()); |
| 667 HBasicBlock* failure_block = builder_->CreateBasicBlock(env->Copy()); |
| 668 compare->SetSuccessorAt(0, success_block); |
| 669 compare->SetSuccessorAt(1, failure_block); |
| 670 failure_block->Goto(failure_block_); |
| 671 builder_->current_block()->Finish(compare); |
| 672 builder_->set_current_block(success_block); |
| 673 } |
| 674 |
| 675 |
| 676 void HGraphBuilder::CheckBuilder::End() { |
| 677 ASSERT(!finished_); |
| 678 builder_->current_block()->Goto(merge_block_); |
| 679 failure_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 |
637 HGraphBuilder::IfBuilder::IfBuilder(HGraphBuilder* builder, BailoutId id) | 687 HGraphBuilder::IfBuilder::IfBuilder(HGraphBuilder* builder, BailoutId id) |
638 : builder_(builder), | 688 : builder_(builder), |
639 finished_(false), | 689 finished_(false), |
640 id_(id) { | 690 id_(id) { |
641 HEnvironment* env = builder->environment(); | 691 HEnvironment* env = builder->environment(); |
642 HEnvironment* true_env = env->Copy(); | 692 first_true_block_ = builder->CreateBasicBlock(env->Copy()); |
643 HEnvironment* false_env = env->Copy(); | |
644 first_true_block_ = builder->CreateBasicBlock(true_env); | |
645 last_true_block_ = NULL; | 693 last_true_block_ = NULL; |
646 first_false_block_ = builder->CreateBasicBlock(false_env); | 694 first_false_block_ = builder->CreateBasicBlock(env->Copy()); |
647 } | 695 } |
648 | 696 |
649 | 697 |
650 HInstruction* HGraphBuilder::IfBuilder::BeginTrue( | 698 HInstruction* HGraphBuilder::IfBuilder::BeginTrue( |
651 HValue* left, | 699 HValue* left, |
652 HValue* right, | 700 HValue* right, |
653 Token::Value token, | 701 Token::Value token, |
654 Representation input_representation) { | 702 Representation input_representation) { |
655 HCompareIDAndBranch* compare = | 703 HCompareIDAndBranch* compare = |
656 new(zone()) HCompareIDAndBranch(left, right, token); | 704 new(zone()) HCompareIDAndBranch(left, right, token); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 return BuildStoreMap(object, map_constant, id); | 1112 return BuildStoreMap(object, map_constant, id); |
1065 } | 1113 } |
1066 | 1114 |
1067 | 1115 |
1068 void HGraphBuilder::BuildCopyElements(HContext* context, | 1116 void HGraphBuilder::BuildCopyElements(HContext* context, |
1069 HValue* from_elements, | 1117 HValue* from_elements, |
1070 ElementsKind from_elements_kind, | 1118 ElementsKind from_elements_kind, |
1071 HValue* to_elements, | 1119 HValue* to_elements, |
1072 ElementsKind to_elements_kind, | 1120 ElementsKind to_elements_kind, |
1073 HValue* length) { | 1121 HValue* length) { |
1074 LoopBuilder builder(this, context, LoopBuilder::kPostIncrement); | 1122 LoopBuilder builder(this, context, LoopBuilder::kPostIncrement, |
| 1123 BailoutId::StubEntry()); |
1075 | 1124 |
1076 HValue* key = builder.BeginBody(graph()->GetConstant0(), | 1125 HValue* key = builder.BeginBody(graph()->GetConstant0(), |
1077 length, Token::LT); | 1126 length, Token::LT); |
1078 | 1127 |
1079 HValue* element = | 1128 HValue* element = |
1080 AddInstruction(new(zone()) HLoadKeyed(from_elements, key, NULL, | 1129 AddInstruction(new(zone()) HLoadKeyed(from_elements, key, NULL, |
1081 from_elements_kind, | 1130 from_elements_kind, |
1082 ALLOW_RETURN_HOLE)); | 1131 ALLOW_RETURN_HOLE)); |
1083 | 1132 |
1084 AddInstruction(new(zone()) HStoreKeyed(to_elements, key, element, | 1133 AddInstruction(new(zone()) HStoreKeyed(to_elements, key, element, |
(...skipping 9658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10743 } | 10792 } |
10744 } | 10793 } |
10745 | 10794 |
10746 #ifdef DEBUG | 10795 #ifdef DEBUG |
10747 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 10796 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
10748 if (allocator_ != NULL) allocator_->Verify(); | 10797 if (allocator_ != NULL) allocator_->Verify(); |
10749 #endif | 10798 #endif |
10750 } | 10799 } |
10751 | 10800 |
10752 } } // namespace v8::internal | 10801 } } // namespace v8::internal |
OLD | NEW |