Commit 4cdffbf4 authored by danno@chromium.org's avatar danno@chromium.org

Improve instruction creating/adding shorthand in HGraphBuilder

Add multi-argument templates for New, NewUncasted, Add and AddUncasted that
call boilerplate HInstruction::New methods rather than the constructor directly.
This allows for automatic passing of the zone and context for instructions that
need them.

R=verwaest@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15990 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8c0f2eab
This diff is collapsed.
......@@ -260,12 +260,12 @@ class BoundsCheckBbData: public ZoneObject {
HValue* index_context = IndexContext(*add, check);
if (index_context == NULL) return false;
HConstant* new_constant = new(BasicBlock()->zone()) HConstant(
new_offset, representation);
Zone* zone = BasicBlock()->zone();
HConstant* new_constant = HConstant::New(
zone, index_context, new_offset);
if (*add == NULL) {
new_constant->InsertBefore(check);
(*add) = HAdd::New(
BasicBlock()->zone(), index_context, original_value, new_constant);
(*add) = HAdd::New(zone, index_context, original_value, new_constant);
(*add)->AssumeRepresentation(representation);
(*add)->InsertBefore(check);
} else {
......
......@@ -278,10 +278,12 @@ class InductionVariableBlocksTable BASE_EMBEDDED {
}
// Choose the appropriate limit.
Zone* zone = graph()->zone();
HValue* context = graph()->GetInvalidContext();
HValue* limit = data->limit();
if (has_upper_constant_limit) {
HConstant* new_limit = new(pre_header->graph()->zone()) HConstant(
upper_constant_limit, length->representation());
HConstant* new_limit = HConstant::New(zone, context,
upper_constant_limit);
new_limit->InsertBefore(pre_header->end());
limit = new_limit;
}
......@@ -290,15 +292,15 @@ class InductionVariableBlocksTable BASE_EMBEDDED {
if (limit->IsInteger32Constant() &&
limit->block() != pre_header &&
!limit->block()->Dominates(pre_header)) {
HConstant* new_limit = new(pre_header->graph()->zone()) HConstant(
limit->GetInteger32Constant(), length->representation());
HConstant* new_limit = HConstant::New(zone, context,
limit->GetInteger32Constant());
new_limit->InsertBefore(pre_header->end());
limit = new_limit;
}
// Do the hoisting.
HBoundsCheck* hoisted_check = new(pre_header->zone()) HBoundsCheck(
limit, check->check()->length());
HBoundsCheck* hoisted_check = HBoundsCheck::New(
zone, context, limit, check->check()->length());
hoisted_check->InsertBefore(pre_header->end());
hoisted_check->set_allow_equality(true);
hoisted_check->block()->graph()->isolate()->counters()->
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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