Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/hydrogen.cc

Issue 14075013: Replace CheckBuilder with IfBuilder everywhere. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 } 635 }
636 636
637 637
638 DEFINE_GET_CONSTANT(True, true, HType::Boolean(), true) 638 DEFINE_GET_CONSTANT(True, true, HType::Boolean(), true)
639 DEFINE_GET_CONSTANT(False, false, HType::Boolean(), false) 639 DEFINE_GET_CONSTANT(False, false, HType::Boolean(), false)
640 DEFINE_GET_CONSTANT(Hole, the_hole, HType::Tagged(), false) 640 DEFINE_GET_CONSTANT(Hole, the_hole, HType::Tagged(), false)
641 641
642 #undef DEFINE_GET_CONSTANT 642 #undef DEFINE_GET_CONSTANT
643 643
644 644
645 HGraphBuilder::CheckBuilder::CheckBuilder(HGraphBuilder* builder)
646 : builder_(builder),
647 finished_(false) {
648 HEnvironment* env = builder->environment();
649 failure_block_ = builder->CreateBasicBlock(env->Copy());
650 merge_block_ = builder->CreateBasicBlock(env->Copy());
651 }
652
653
654 HValue* HGraphBuilder::CheckBuilder::CheckNotUndefined(HValue* value) {
655 HEnvironment* env = builder_->environment();
656 HCompareObjectEqAndBranch* compare =
657 new(zone()) HCompareObjectEqAndBranch(
658 value,
659 builder_->graph()->GetConstantUndefined());
660 HBasicBlock* success_block = builder_->CreateBasicBlock(env->Copy());
661 HBasicBlock* failure_block = builder_->CreateBasicBlock(env->Copy());
662 compare->SetSuccessorAt(0, failure_block);
663 compare->SetSuccessorAt(1, success_block);
664 failure_block->GotoNoSimulate(failure_block_);
665 builder_->current_block()->Finish(compare);
666 builder_->set_current_block(success_block);
667 return compare;
668 }
669
670
671 HValue* HGraphBuilder::CheckBuilder::CheckIntegerCompare(HValue* left,
672 HValue* right,
673 Token::Value op) {
674 HEnvironment* env = builder_->environment();
675 HCompareIDAndBranch* compare =
676 new(zone()) HCompareIDAndBranch(left, right, op);
677 compare->AssumeRepresentation(Representation::Integer32());
678 HBasicBlock* success_block = builder_->CreateBasicBlock(env->Copy());
679 HBasicBlock* failure_block = builder_->CreateBasicBlock(env->Copy());
680 compare->SetSuccessorAt(0, success_block);
681 compare->SetSuccessorAt(1, failure_block);
682 failure_block->GotoNoSimulate(failure_block_);
683 builder_->current_block()->Finish(compare);
684 builder_->set_current_block(success_block);
685 return compare;
686 }
687
688
689 HValue* HGraphBuilder::CheckBuilder::CheckIntegerEq(HValue* left,
690 HValue* right) {
691 return CheckIntegerCompare(left, right, Token::EQ);
692 }
693
694
695 void HGraphBuilder::CheckBuilder::End() {
696 ASSERT(!finished_);
697 builder_->current_block()->GotoNoSimulate(merge_block_);
698 if (failure_block_->HasPredecessor()) {
699 failure_block_->FinishExitWithDeoptimization(HDeoptimize::kUseAll);
700 }
701 builder_->set_current_block(merge_block_);
702 finished_ = true;
703 }
704
705
706 HConstant* HGraph::GetInvalidContext() { 645 HConstant* HGraph::GetInvalidContext() {
707 return GetConstantInt32(&constant_invalid_context_, 0xFFFFC0C7); 646 return GetConstantInt32(&constant_invalid_context_, 0xFFFFC0C7);
708 } 647 }
709 648
710 649
711 HGraphBuilder::IfBuilder::IfBuilder(HGraphBuilder* builder, int position) 650 HGraphBuilder::IfBuilder::IfBuilder(HGraphBuilder* builder, int position)
712 : builder_(builder), 651 : builder_(builder),
713 position_(position), 652 position_(position),
714 finished_(false), 653 finished_(false),
715 did_then_(false), 654 did_then_(false),
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 length_checker.IfCompare(key, length, Token::LT); 1255 length_checker.IfCompare(key, length, Token::LT);
1317 length_checker.Then(); 1256 length_checker.Then();
1318 IfBuilder negative_checker(this); 1257 IfBuilder negative_checker(this);
1319 HValue* bounds_check = negative_checker.IfCompare( 1258 HValue* bounds_check = negative_checker.IfCompare(
1320 key, graph()->GetConstant0(), Token::GTE); 1259 key, graph()->GetConstant0(), Token::GTE);
1321 negative_checker.Then(); 1260 negative_checker.Then();
1322 HInstruction* result = BuildExternalArrayElementAccess( 1261 HInstruction* result = BuildExternalArrayElementAccess(
1323 external_elements, key, val, bounds_check, 1262 external_elements, key, val, bounds_check,
1324 elements_kind, is_store); 1263 elements_kind, is_store);
1325 AddInstruction(result); 1264 AddInstruction(result);
1326 negative_checker.Else(); 1265 negative_checker.ElseDeopt();
1327 negative_checker.Deopt();
1328 negative_checker.End();
1329 length_checker.End(); 1266 length_checker.End();
1330 return result; 1267 return result;
1331 } else { 1268 } else {
1332 ASSERT(store_mode == STANDARD_STORE); 1269 ASSERT(store_mode == STANDARD_STORE);
1333 checked_key = AddBoundsCheck( 1270 checked_key = AddBoundsCheck(
1334 key, length, ALLOW_SMI_KEY, checked_index_representation); 1271 key, length, ALLOW_SMI_KEY, checked_index_representation);
1335 HLoadExternalArrayPointer* external_elements = 1272 HLoadExternalArrayPointer* external_elements =
1336 new(zone) HLoadExternalArrayPointer(elements); 1273 new(zone) HLoadExternalArrayPointer(elements);
1337 AddInstruction(external_elements); 1274 AddInstruction(external_elements);
1338 return AddInstruction(BuildExternalArrayElementAccess( 1275 return AddInstruction(BuildExternalArrayElementAccess(
(...skipping 10533 matching lines...) Expand 10 before | Expand all | Expand 10 after
11872 } 11809 }
11873 } 11810 }
11874 11811
11875 #ifdef DEBUG 11812 #ifdef DEBUG
11876 if (graph_ != NULL) graph_->Verify(false); // No full verify. 11813 if (graph_ != NULL) graph_->Verify(false); // No full verify.
11877 if (allocator_ != NULL) allocator_->Verify(); 11814 if (allocator_ != NULL) allocator_->Verify();
11878 #endif 11815 #endif
11879 } 11816 }
11880 11817
11881 } } // namespace v8::internal 11818 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698