Commit cc105337 authored by ulan@chromium.org's avatar ulan@chromium.org

Use AssumeRepresentation when the representation is known and will not change.

R=danno@chromium.org

Review URL: https://chromiumcodereview.appspot.com/14793014

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14611 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 36910718
...@@ -723,7 +723,7 @@ HInstruction* HGraphBuilder::IfBuilder::IfCompare( ...@@ -723,7 +723,7 @@ HInstruction* HGraphBuilder::IfBuilder::IfCompare(
new(zone()) HCompareIDAndBranch(left, right, token); new(zone()) HCompareIDAndBranch(left, right, token);
compare->set_observed_input_representation(input_representation, compare->set_observed_input_representation(input_representation,
input_representation); input_representation);
compare->ChangeRepresentation(input_representation); compare->AssumeRepresentation(input_representation);
AddCompare(compare); AddCompare(compare);
return compare; return compare;
} }
...@@ -910,7 +910,7 @@ HValue* HGraphBuilder::LoopBuilder::BeginBody( ...@@ -910,7 +910,7 @@ HValue* HGraphBuilder::LoopBuilder::BeginBody(
phi_ = new(zone()) HPhi(env->values()->length(), zone()); phi_ = new(zone()) HPhi(env->values()->length(), zone());
header_block_->AddPhi(phi_); header_block_->AddPhi(phi_);
phi_->AddInput(initial); phi_->AddInput(initial);
phi_->ChangeRepresentation(Representation::Integer32()); phi_->AssumeRepresentation(Representation::Integer32());
env->Push(initial); env->Push(initial);
builder_->current_block()->GotoNoSimulate(header_block_); builder_->current_block()->GotoNoSimulate(header_block_);
ASSERT(builder_->SafeToAddPhiInNoSideEffectsScope()); ASSERT(builder_->SafeToAddPhiInNoSideEffectsScope());
...@@ -927,7 +927,7 @@ HValue* HGraphBuilder::LoopBuilder::BeginBody( ...@@ -927,7 +927,7 @@ HValue* HGraphBuilder::LoopBuilder::BeginBody(
new(zone()) HCompareIDAndBranch(phi_, terminating, token); new(zone()) HCompareIDAndBranch(phi_, terminating, token);
compare->set_observed_input_representation(input_representation, compare->set_observed_input_representation(input_representation,
input_representation); input_representation);
compare->ChangeRepresentation(input_representation); compare->AssumeRepresentation(input_representation);
compare->SetSuccessorAt(0, body_block_); compare->SetSuccessorAt(0, body_block_);
compare->SetSuccessorAt(1, exit_block_); compare->SetSuccessorAt(1, exit_block_);
builder_->current_block()->Finish(compare); builder_->current_block()->Finish(compare);
...@@ -941,7 +941,7 @@ HValue* HGraphBuilder::LoopBuilder::BeginBody( ...@@ -941,7 +941,7 @@ HValue* HGraphBuilder::LoopBuilder::BeginBody(
increment_ = HSub::New(zone(), context_, phi_, one); increment_ = HSub::New(zone(), context_, phi_, one);
} }
increment_->ClearFlag(HValue::kCanOverflow); increment_->ClearFlag(HValue::kCanOverflow);
increment_->ChangeRepresentation(Representation::Integer32()); increment_->AssumeRepresentation(Representation::Integer32());
builder_->AddInstruction(increment_); builder_->AddInstruction(increment_);
return increment_; return increment_;
} else { } else {
...@@ -961,7 +961,7 @@ void HGraphBuilder::LoopBuilder::EndBody() { ...@@ -961,7 +961,7 @@ void HGraphBuilder::LoopBuilder::EndBody() {
increment_ = HSub::New(zone(), context_, phi_, one); increment_ = HSub::New(zone(), context_, phi_, one);
} }
increment_->ClearFlag(HValue::kCanOverflow); increment_->ClearFlag(HValue::kCanOverflow);
increment_->ChangeRepresentation(Representation::Integer32()); increment_->AssumeRepresentation(Representation::Integer32());
builder_->AddInstruction(increment_); builder_->AddInstruction(increment_);
} }
...@@ -1198,7 +1198,7 @@ HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object, ...@@ -1198,7 +1198,7 @@ HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object,
if (is_js_array) { if (is_js_array) {
HValue* new_length = AddInstruction( HValue* new_length = AddInstruction(
HAdd::New(zone, context, length, graph_->GetConstant1())); HAdd::New(zone, context, length, graph_->GetConstant1()));
new_length->ChangeRepresentation(Representation::Integer32()); new_length->AssumeRepresentation(Representation::Integer32());
new_length->ClearFlag(HValue::kCanOverflow); new_length->ClearFlag(HValue::kCanOverflow);
Factory* factory = isolate()->factory(); Factory* factory = isolate()->factory();
...@@ -1384,7 +1384,7 @@ HValue* HGraphBuilder::BuildAllocateElements(HValue* context, ...@@ -1384,7 +1384,7 @@ HValue* HGraphBuilder::BuildAllocateElements(HValue* context,
AddInstruction(elements_size_value); AddInstruction(elements_size_value);
HValue* mul = AddInstruction( HValue* mul = AddInstruction(
HMul::New(zone, context, capacity, elements_size_value)); HMul::New(zone, context, capacity, elements_size_value));
mul->ChangeRepresentation(Representation::Integer32()); mul->AssumeRepresentation(Representation::Integer32());
mul->ClearFlag(HValue::kCanOverflow); mul->ClearFlag(HValue::kCanOverflow);
HConstant* header_size = HConstant* header_size =
...@@ -1392,7 +1392,7 @@ HValue* HGraphBuilder::BuildAllocateElements(HValue* context, ...@@ -1392,7 +1392,7 @@ HValue* HGraphBuilder::BuildAllocateElements(HValue* context,
AddInstruction(header_size); AddInstruction(header_size);
HValue* total_size = AddInstruction( HValue* total_size = AddInstruction(
HAdd::New(zone, context, mul, header_size)); HAdd::New(zone, context, mul, header_size));
total_size->ChangeRepresentation(Representation::Integer32()); total_size->AssumeRepresentation(Representation::Integer32());
total_size->ClearFlag(HValue::kCanOverflow); total_size->ClearFlag(HValue::kCanOverflow);
HAllocate::Flags flags = HAllocate::DefaultFlags(kind); HAllocate::Flags flags = HAllocate::DefaultFlags(kind);
...@@ -1548,12 +1548,12 @@ HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* context, ...@@ -1548,12 +1548,12 @@ HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* context,
HValue* half_old_capacity = HValue* half_old_capacity =
AddInstruction(HShr::New(zone, context, old_capacity, AddInstruction(HShr::New(zone, context, old_capacity,
graph_->GetConstant1())); graph_->GetConstant1()));
half_old_capacity->ChangeRepresentation(Representation::Integer32()); half_old_capacity->AssumeRepresentation(Representation::Integer32());
half_old_capacity->ClearFlag(HValue::kCanOverflow); half_old_capacity->ClearFlag(HValue::kCanOverflow);
HValue* new_capacity = AddInstruction( HValue* new_capacity = AddInstruction(
HAdd::New(zone, context, half_old_capacity, old_capacity)); HAdd::New(zone, context, half_old_capacity, old_capacity));
new_capacity->ChangeRepresentation(Representation::Integer32()); new_capacity->AssumeRepresentation(Representation::Integer32());
new_capacity->ClearFlag(HValue::kCanOverflow); new_capacity->ClearFlag(HValue::kCanOverflow);
HValue* min_growth = HValue* min_growth =
...@@ -1561,7 +1561,7 @@ HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* context, ...@@ -1561,7 +1561,7 @@ HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* context,
new_capacity = AddInstruction( new_capacity = AddInstruction(
HAdd::New(zone, context, new_capacity, min_growth)); HAdd::New(zone, context, new_capacity, min_growth));
new_capacity->ChangeRepresentation(Representation::Integer32()); new_capacity->AssumeRepresentation(Representation::Integer32());
new_capacity->ClearFlag(HValue::kCanOverflow); new_capacity->ClearFlag(HValue::kCanOverflow);
return new_capacity; return new_capacity;
...@@ -1941,7 +1941,7 @@ HValue* HGraphBuilder::JSArrayBuilder::EstablishAllocationSize( ...@@ -1941,7 +1941,7 @@ HValue* HGraphBuilder::JSArrayBuilder::EstablishAllocationSize(
AddInstruction(elements_size_value); AddInstruction(elements_size_value);
HInstruction* mul = HMul::New(zone(), context, length_node, HInstruction* mul = HMul::New(zone(), context, length_node,
elements_size_value); elements_size_value);
mul->ChangeRepresentation(Representation::Integer32()); mul->AssumeRepresentation(Representation::Integer32());
mul->ClearFlag(HValue::kCanOverflow); mul->ClearFlag(HValue::kCanOverflow);
AddInstruction(mul); AddInstruction(mul);
...@@ -1949,7 +1949,7 @@ HValue* HGraphBuilder::JSArrayBuilder::EstablishAllocationSize( ...@@ -1949,7 +1949,7 @@ HValue* HGraphBuilder::JSArrayBuilder::EstablishAllocationSize(
Representation::Integer32()); Representation::Integer32());
AddInstruction(base); AddInstruction(base);
HInstruction* total_size = HAdd::New(zone(), context, base, mul); HInstruction* total_size = HAdd::New(zone(), context, base, mul);
total_size->ChangeRepresentation(Representation::Integer32()); total_size->AssumeRepresentation(Representation::Integer32());
total_size->ClearFlag(HValue::kCanOverflow); total_size->ClearFlag(HValue::kCanOverflow);
AddInstruction(total_size); AddInstruction(total_size);
return total_size; return total_size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment