Switch elements access to use IfBuilder instead of CheckBuilder.

R=danno@chromium.org

Review URL: https://codereview.chromium.org/14365014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14360 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mstarzinger@chromium.org 2013-04-19 16:21:09 +00:00
parent a8521a9e77
commit e288a65ec1
2 changed files with 8 additions and 7 deletions

View File

@ -870,7 +870,6 @@ void HGraphBuilder::IfBuilder::Deopt() {
block->FinishExitWithDeoptimization(HDeoptimize::kUseAll); block->FinishExitWithDeoptimization(HDeoptimize::kUseAll);
if (did_else_) { if (did_else_) {
first_false_block_ = NULL; first_false_block_ = NULL;
did_else_ = false;
} else { } else {
first_true_block_ = NULL; first_true_block_ = NULL;
} }
@ -884,8 +883,9 @@ void HGraphBuilder::IfBuilder::End() {
last_true_block_ = builder_->current_block(); last_true_block_ = builder_->current_block();
} }
if (first_true_block_ == NULL) { if (first_true_block_ == NULL) {
// Deopt on true. Nothing to do, just continue the else block. // Deopt on true. Nothing to do, just continue the false block.
} else if (first_false_block_ == NULL) { } else if (first_false_block_ == NULL) {
// Deopt on false. Nothing to do except switching to the true block.
builder_->set_current_block(last_true_block_); builder_->set_current_block(last_true_block_);
} else { } else {
HEnvironment* merge_env = last_true_block_->last_environment()->Copy(); HEnvironment* merge_env = last_true_block_->last_environment()->Copy();
@ -1315,14 +1315,17 @@ HInstruction* HGraphBuilder::BuildUncheckedMonomorphicElementAccess(
IfBuilder length_checker(this); IfBuilder length_checker(this);
length_checker.IfCompare(key, length, Token::LT); length_checker.IfCompare(key, length, Token::LT);
length_checker.Then(); length_checker.Then();
CheckBuilder negative_checker(this); IfBuilder negative_checker(this);
HValue* bounds_check = negative_checker.CheckIntegerCompare( HValue* bounds_check = negative_checker.IfCompare(
key, graph()->GetConstant0(), Token::GTE); key, graph()->GetConstant0(), Token::GTE);
negative_checker.End(); negative_checker.Then();
HInstruction* result = BuildExternalArrayElementAccess( HInstruction* result = BuildExternalArrayElementAccess(
external_elements, key, val, bounds_check, external_elements, key, val, bounds_check,
elements_kind, is_store); elements_kind, is_store);
AddInstruction(result); AddInstruction(result);
negative_checker.Else();
negative_checker.Deopt();
negative_checker.End();
length_checker.End(); length_checker.End();
return result; return result;
} else { } else {

View File

@ -1067,7 +1067,6 @@ class HGraphBuilder {
return compare; return compare;
} }
template<class Condition>
HInstruction* OrIfCompare( HInstruction* OrIfCompare(
HValue* p1, HValue* p1,
HValue* p2, HValue* p2,
@ -1094,7 +1093,6 @@ class HGraphBuilder {
return If<Condition>(p1, p2); return If<Condition>(p1, p2);
} }
template<class Condition>
HInstruction* AndIfCompare( HInstruction* AndIfCompare(
HValue* p1, HValue* p1,
HValue* p2, HValue* p2,