Revision: 24531
Author: [email protected]
Date: Fri Oct 10 13:40:08 2014 UTC
Log: Use phase-local zone in the graph builder.
[email protected]
Review URL: https://codereview.chromium.org/640423005
https://code.google.com/p/v8/source/detail?r=24531
Modified:
/branches/bleeding_edge/src/compiler/control-builders.h
/branches/bleeding_edge/src/compiler/graph-builder.cc
/branches/bleeding_edge/src/compiler/graph-builder.h
=======================================
--- /branches/bleeding_edge/src/compiler/control-builders.h Fri Aug 8
13:51:30 2014 UTC
+++ /branches/bleeding_edge/src/compiler/control-builders.h Fri Oct 10
13:40:08 2014 UTC
@@ -32,7 +32,7 @@
typedef StructuredGraphBuilder Builder;
typedef StructuredGraphBuilder::Environment Environment;
- Zone* zone() const { return builder_->zone(); }
+ Zone* zone() const { return builder_->local_zone(); }
Environment* environment() { return builder_->environment(); }
void set_environment(Environment* env) { builder_->set_environment(env);
}
=======================================
--- /branches/bleeding_edge/src/compiler/graph-builder.cc Wed Sep 10
12:23:45 2014 UTC
+++ /branches/bleeding_edge/src/compiler/graph-builder.cc Fri Oct 10
13:40:08 2014 UTC
@@ -24,6 +24,7 @@
: GraphBuilder(graph),
common_(common),
environment_(NULL),
+ local_zone_(isolate()),
current_context_(NULL),
exit_control_(NULL) {}
@@ -50,7 +51,7 @@
if (has_framestate) ++input_count_with_deps;
if (has_control) ++input_count_with_deps;
if (has_effect) ++input_count_with_deps;
- Node** buffer = zone()->NewArray<Node*>(input_count_with_deps);
+ Node** buffer = local_zone()->NewArray<Node*>(input_count_with_deps);
memcpy(buffer, value_inputs, kPointerSize * value_input_count);
Node** current_input = buffer + value_input_count;
if (has_context) {
@@ -95,7 +96,7 @@
StructuredGraphBuilder::Environment*
StructuredGraphBuilder::CopyEnvironment(
Environment* env) {
- return new (zone()) Environment(*env);
+ return new (local_zone()) Environment(*env);
}
@@ -163,7 +164,7 @@
Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node*
control) {
const Operator* phi_op = common()->Phi(kMachAnyTagged, count);
- Node** buffer = zone()->NewArray<Node*>(count + 1);
+ Node** buffer = local_zone()->NewArray<Node*>(count + 1);
MemsetPointer(buffer, input, count);
buffer[count] = control;
return graph()->NewNode(phi_op, count + 1, buffer);
@@ -174,7 +175,7 @@
Node* StructuredGraphBuilder::NewEffectPhi(int count, Node* input,
Node* control) {
const Operator* phi_op = common()->EffectPhi(count);
- Node** buffer = zone()->NewArray<Node*>(count + 1);
+ Node** buffer = local_zone()->NewArray<Node*>(count + 1);
MemsetPointer(buffer, input, count);
buffer[count] = control;
return graph()->NewNode(phi_op, count + 1, buffer);
@@ -186,12 +187,12 @@
if (control->opcode() == IrOpcode::kLoop) {
// Control node for loop exists, add input.
const Operator* op = common()->Loop(inputs);
- control->AppendInput(zone(), other);
+ control->AppendInput(graph_zone(), other);
control->set_op(op);
} else if (control->opcode() == IrOpcode::kMerge) {
// Control node for merge exists, add input.
const Operator* op = common()->Merge(inputs);
- control->AppendInput(zone(), other);
+ control->AppendInput(graph_zone(), other);
control->set_op(op);
} else {
// Control node is a singleton, introduce a merge.
@@ -209,7 +210,7 @@
NodeProperties::GetControlInput(value) == control) {
// Phi already exists, add input.
value->set_op(common()->EffectPhi(inputs));
- value->InsertInput(zone(), inputs - 1, other);
+ value->InsertInput(graph_zone(), inputs - 1, other);
} else if (value != other) {
// Phi does not exist yet, introduce one.
value = NewEffectPhi(inputs, value, control);
@@ -226,7 +227,7 @@
NodeProperties::GetControlInput(value) == control) {
// Phi already exists, add input.
value->set_op(common()->Phi(kMachAnyTagged, inputs));
- value->InsertInput(zone(), inputs - 1, other);
+ value->InsertInput(graph_zone(), inputs - 1, other);
} else if (value != other) {
// Phi does not exist yet, introduce one.
value = NewPhi(inputs, value, control);
=======================================
--- /branches/bleeding_edge/src/compiler/graph-builder.h Wed Sep 10
12:23:45 2014 UTC
+++ /branches/bleeding_edge/src/compiler/graph-builder.h Fri Oct 10
13:40:08 2014 UTC
@@ -122,9 +122,9 @@
Node* dead_control();
- // TODO(mstarzinger): Use phase-local zone instead!
- Zone* zone() const { return graph()->zone(); }
- Isolate* isolate() const { return zone()->isolate(); }
+ Zone* graph_zone() const { return graph()->zone(); }
+ Zone* local_zone() { return &local_zone_; }
+ Isolate* isolate() const { return graph_zone()->isolate(); }
CommonOperatorBuilder* common() const { return common_; }
// Helper to wrap a Handle<T> into a Unique<T>.
@@ -144,6 +144,9 @@
CommonOperatorBuilder* common_;
Environment* environment_;
+ // Zone local to the builder for data not leaking into the graph.
+ Zone local_zone_;
+
// Node representing the control dependency for dead code.
SetOncePointer<Node> dead_control_;
@@ -207,8 +210,7 @@
Node* GetContext() { return builder_->current_context(); }
protected:
- // TODO(mstarzinger): Use phase-local zone instead!
- Zone* zone() const { return graph()->zone(); }
+ Zone* zone() const { return builder_->local_zone(); }
Graph* graph() const { return builder_->graph(); }
StructuredGraphBuilder* builder() const { return builder_; }
CommonOperatorBuilder* common() { return builder_->common(); }
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.