Revision: 23000
Author: [email protected]
Date: Fri Aug 8 13:51:30 2014 UTC
Log: Minor simplification and cleanup of graph builder.
[email protected]
Review URL: https://codereview.chromium.org/448113002
http://code.google.com/p/v8/source/detail?r=23000
Modified:
/branches/bleeding_edge/src/compiler/ast-graph-builder.cc
/branches/bleeding_edge/src/compiler/ast-graph-builder.h
/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/pipeline.cc
/branches/bleeding_edge/test/cctest/compiler/simplified-graph-builder.h
/branches/bleeding_edge/test/mjsunit/mjsunit.status
=======================================
--- /branches/bleeding_edge/src/compiler/ast-graph-builder.cc Wed Aug 6
13:09:34 2014 UTC
+++ /branches/bleeding_edge/src/compiler/ast-graph-builder.cc Fri Aug 8
13:51:30 2014 UTC
@@ -16,12 +16,10 @@
namespace internal {
namespace compiler {
-AstGraphBuilder::AstGraphBuilder(CompilationInfo* info, JSGraph* jsgraph,
- SourcePositionTable* source_positions)
+AstGraphBuilder::AstGraphBuilder(CompilationInfo* info, JSGraph* jsgraph)
: StructuredGraphBuilder(jsgraph->graph(), jsgraph->common()),
info_(info),
jsgraph_(jsgraph),
- source_positions_(source_positions),
globals_(0, info->zone()),
breakable_(NULL),
execution_context_(NULL) {
@@ -55,13 +53,9 @@
Scope* scope = info()->scope();
DCHECK(graph() != NULL);
- SourcePositionTable::Scope start_pos(
- source_positions(),
- SourcePosition(info()->shared_info()->start_position()));
-
// Set up the basic structure of the graph.
- graph()->SetStart(
- graph()->NewNode(common()->Start(info()->num_parameters())));
+ int parameter_count = info()->num_parameters();
+ graph()->SetStart(graph()->NewNode(common()->Start(parameter_count)));
// Initialize the top-level environment.
Environment env(this, scope, graph()->start());
@@ -98,10 +92,6 @@
VisitStatements(info()->function()->body());
if (HasStackOverflow()) return false;
- SourcePositionTable::Scope end_pos(
- source_positions(),
- SourcePosition(info()->shared_info()->end_position() - 1));
-
// Emit tracing call if requested to do so.
if (FLAG_trace) {
// TODO(mstarzinger): Only traces implicit return.
@@ -1958,10 +1948,9 @@
void AstGraphBuilder::BuildLazyBailout(Node* node, BailoutId ast_id) {
if (OperatorProperties::CanLazilyDeoptimize(node->op())) {
// The deopting node should have an outgoing control dependency.
- DCHECK(GetControlDependency() == node);
+ DCHECK(environment()->GetControlDependency() == node);
- StructuredGraphBuilder::Environment* continuation_env =
- environment_internal();
+ StructuredGraphBuilder::Environment* continuation_env = environment();
// Create environment for the deoptimization block, and build the
block.
StructuredGraphBuilder::Environment* deopt_env =
CopyEnvironment(continuation_env);
=======================================
--- /branches/bleeding_edge/src/compiler/ast-graph-builder.h Wed Aug 6
11:49:02 2014 UTC
+++ /branches/bleeding_edge/src/compiler/ast-graph-builder.h Fri Aug 8
13:51:30 2014 UTC
@@ -25,8 +25,7 @@
// of function inlining.
class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor {
public:
- AstGraphBuilder(CompilationInfo* info, JSGraph* jsgraph,
- SourcePositionTable* source_positions_);
+ AstGraphBuilder(CompilationInfo* info, JSGraph* jsgraph);
// Creates a graph by visiting the entire AST.
bool CreateGraph();
@@ -41,7 +40,8 @@
class Environment;
Environment* environment() {
- return reinterpret_cast<Environment*>(environment_internal());
+ return reinterpret_cast<Environment*>(
+ StructuredGraphBuilder::environment());
}
AstContext* ast_context() const { return ast_context_; }
@@ -56,8 +56,6 @@
// depends on the graph builder, but environments themselves are not
virtual.
typedef StructuredGraphBuilder::Environment BaseEnvironment;
virtual BaseEnvironment* CopyEnvironment(BaseEnvironment* env);
-
- SourcePositionTable* source_positions() { return source_positions_; }
// TODO(mstarzinger): The pipeline only needs to be a friend to access
the
// function context. Remove as soon as the context is a parameter.
@@ -114,7 +112,6 @@
CompilationInfo* info_;
AstContext* ast_context_;
JSGraph* jsgraph_;
- SourcePositionTable* source_positions_;
// List of global declarations for functions and variables.
ZoneList<Handle<Object> > globals_;
=======================================
--- /branches/bleeding_edge/src/compiler/control-builders.h Wed Jul 30
13:54:45 2014 UTC
+++ /branches/bleeding_edge/src/compiler/control-builders.h Fri Aug 8
13:51:30 2014 UTC
@@ -33,7 +33,7 @@
typedef StructuredGraphBuilder::Environment Environment;
Zone* zone() const { return builder_->zone(); }
- Environment* environment() { return builder_->environment_internal(); }
+ Environment* environment() { return builder_->environment(); }
void set_environment(Environment* env) { builder_->set_environment(env);
}
Builder* builder_;
=======================================
--- /branches/bleeding_edge/src/compiler/graph-builder.cc Thu Aug 7
09:14:47 2014 UTC
+++ /branches/bleeding_edge/src/compiler/graph-builder.cc Fri Aug 8
13:51:30 2014 UTC
@@ -56,39 +56,29 @@
*current_input++ = environment_->GetEffectDependency();
}
if (has_control) {
- *current_input++ = GetControlDependency();
+ *current_input++ = environment_->GetControlDependency();
}
result = graph()->NewNode(op, input_count_with_deps, buffer);
if (has_effect) {
environment_->UpdateEffectDependency(result);
}
if (OperatorProperties::HasControlOutput(result->op()) &&
- !environment_internal()->IsMarkedAsUnreachable()) {
- UpdateControlDependency(result);
+ !environment()->IsMarkedAsUnreachable()) {
+ environment_->UpdateControlDependency(result);
}
}
return result;
}
-
-
-Node* StructuredGraphBuilder::GetControlDependency() {
- return environment_->GetControlDependency();
-}
-
-
-void StructuredGraphBuilder::UpdateControlDependency(Node* new_control) {
- environment_->UpdateControlDependency(new_control);
-}
void StructuredGraphBuilder::UpdateControlDependencyToLeaveFunction(
Node* exit) {
- if (environment_internal()->IsMarkedAsUnreachable()) return;
+ if (environment()->IsMarkedAsUnreachable()) return;
if (exit_control() != NULL) {
exit = MergeControl(exit_control(), exit);
}
- environment_internal()->MarkAsUnreachable();
+ environment()->MarkAsUnreachable();
set_exit_control(exit);
}
=======================================
--- /branches/bleeding_edge/src/compiler/graph-builder.h Wed Jul 30
13:54:45 2014 UTC
+++ /branches/bleeding_edge/src/compiler/graph-builder.h Fri Aug 8
13:51:30 2014 UTC
@@ -109,7 +109,7 @@
virtual Node* MakeNode(Operator* op, int value_input_count,
Node** value_inputs);
- Environment* environment_internal() const { return environment_; }
+ Environment* environment() const { return environment_; }
void set_environment(Environment* env) { environment_ = env; }
Node* current_context() const { return current_context_; }
@@ -135,12 +135,6 @@
// depends on the graph builder, but environments themselves are not
virtual.
virtual Environment* CopyEnvironment(Environment* env);
- // Helper when creating node that depends on control.
- Node* GetControlDependency();
-
- // Helper when creating node that updates control.
- void UpdateControlDependency(Node* new_control);
-
// Helper to indicate a node exits the function body.
void UpdateControlDependencyToLeaveFunction(Node* exit);
=======================================
--- /branches/bleeding_edge/src/compiler/pipeline.cc Tue Aug 5 13:20:26
2014 UTC
+++ /branches/bleeding_edge/src/compiler/pipeline.cc Fri Aug 8 13:51:30
2014 UTC
@@ -85,16 +85,25 @@
public:
explicit AstGraphBuilderWithPositions(CompilationInfo* info, JSGraph*
jsgraph,
SourcePositionTable*
source_positions)
- : AstGraphBuilder(info, jsgraph, source_positions) {}
+ : AstGraphBuilder(info, jsgraph),
source_positions_(source_positions) {}
+
+ bool CreateGraph() V8_OVERRIDE {
+ SourcePositionTable::Scope pos(source_positions_,
+ SourcePosition::Unknown());
+ return AstGraphBuilder::CreateGraph();
+ }
#define DEF_VISIT(type) \
virtual void Visit##type(type* node) V8_OVERRIDE { \
- SourcePositionTable::Scope pos(source_positions(), \
+ SourcePositionTable::Scope pos(source_positions_, \
SourcePosition(node->position())); \
AstGraphBuilder::Visit##type(node); \
}
AST_NODE_LIST(DEF_VISIT)
#undef DEF_VISIT
+
+ private:
+ SourcePositionTable* source_positions_;
};
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/simplified-graph-builder.h
Tue Aug 5 08:47:39 2014 UTC
+++ /branches/bleeding_edge/test/cctest/compiler/simplified-graph-builder.h
Fri Aug 8 13:51:30 2014 UTC
@@ -49,7 +49,8 @@
MachineOperatorBuilder* machine() const { return machine_; }
SimplifiedOperatorBuilder* simplified() const { return simplified_; }
Environment* environment() {
- return reinterpret_cast<Environment*>(environment_internal());
+ return reinterpret_cast<Environment*>(
+ StructuredGraphBuilder::environment());
}
// Initialize graph and builder.
=======================================
--- /branches/bleeding_edge/test/mjsunit/mjsunit.status Thu Aug 7 16:42:14
2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/mjsunit.status Fri Aug 8 13:51:30
2014 UTC
@@ -66,8 +66,6 @@
# Some tests are over-restrictive about object layout.
'array-constructor-feedback': [PASS, NO_VARIANTS],
'array-feedback': [PASS, NO_VARIANTS],
- 'fast-non-keyed': [PASS, NO_VARIANTS],
- 'track-fields': [PASS, NO_VARIANTS],
# Some tests are just too slow to run for now.
'big-object-literal': [PASS, NO_VARIANTS],
--
--
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.