Minor cleanup using BooleanConstant in graph builder.

R=titzer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#24996}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24996 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5c25fdb6
...@@ -588,13 +588,6 @@ void AstGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) { ...@@ -588,13 +588,6 @@ void AstGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
} }
BitVector* AstGraphBuilder::GetVariablesAssignedInLoop(
IterationStatement* stmt) {
if (loop_assignment_analysis_ == NULL) return NULL;
return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt);
}
void AstGraphBuilder::VisitDoWhileStatement(DoWhileStatement* stmt) { void AstGraphBuilder::VisitDoWhileStatement(DoWhileStatement* stmt) {
LoopBuilder while_loop(this); LoopBuilder while_loop(this);
while_loop.BeginLoop(GetVariablesAssignedInLoop(stmt)); while_loop.BeginLoop(GetVariablesAssignedInLoop(stmt));
...@@ -826,8 +819,7 @@ void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { ...@@ -826,8 +819,7 @@ void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) {
// Create node to instantiate a new closure. // Create node to instantiate a new closure.
Node* info = jsgraph()->Constant(shared_info); Node* info = jsgraph()->Constant(shared_info);
Node* pretenure = expr->pretenure() ? jsgraph()->TrueConstant() Node* pretenure = jsgraph()->BooleanConstant(expr->pretenure());
: jsgraph()->FalseConstant();
const Operator* op = javascript()->CallRuntime(Runtime::kNewClosure, 3); const Operator* op = javascript()->CallRuntime(Runtime::kNewClosure, 3);
Node* value = NewNode(op, context, info, pretenure); Node* value = NewNode(op, context, info, pretenure);
ast_context()->ProduceValue(value); ast_context()->ProduceValue(value);
...@@ -1933,8 +1925,7 @@ Node* AstGraphBuilder::BuildVariableDelete( ...@@ -1933,8 +1925,7 @@ Node* AstGraphBuilder::BuildVariableDelete(
case Variable::LOCAL: case Variable::LOCAL:
case Variable::CONTEXT: case Variable::CONTEXT:
// Local var, const, or let variable or context variable. // Local var, const, or let variable or context variable.
return variable->is_this() ? jsgraph()->TrueConstant() return jsgraph()->BooleanConstant(variable->is_this());
: jsgraph()->FalseConstant();
case Variable::LOOKUP: { case Variable::LOOKUP: {
// Dynamic lookup of context variable (anywhere in the chain). // Dynamic lookup of context variable (anywhere in the chain).
Node* name = jsgraph()->Constant(variable->name()); Node* name = jsgraph()->Constant(variable->name());
...@@ -2172,6 +2163,13 @@ void AstGraphBuilder::PrepareFrameState(Node* node, BailoutId ast_id, ...@@ -2172,6 +2163,13 @@ void AstGraphBuilder::PrepareFrameState(Node* node, BailoutId ast_id,
} }
} }
BitVector* AstGraphBuilder::GetVariablesAssignedInLoop(
IterationStatement* stmt) {
if (loop_assignment_analysis_ == NULL) return NULL;
return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt);
} }
}
} // namespace v8::internal::compiler } // namespace compiler
} // namespace internal
} // namespace v8
...@@ -136,6 +136,7 @@ class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor { ...@@ -136,6 +136,7 @@ class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor {
SetOncePointer<Node> function_closure_; SetOncePointer<Node> function_closure_;
SetOncePointer<Node> function_context_; SetOncePointer<Node> function_context_;
// Result of loop assignment analysis performed before graph creation.
LoopAssignmentAnalysis* loop_assignment_analysis_; LoopAssignmentAnalysis* loop_assignment_analysis_;
CompilationInfo* info() const { return info_; } CompilationInfo* info() const { return info_; }
...@@ -189,8 +190,6 @@ class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor { ...@@ -189,8 +190,6 @@ class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor {
Node* node, BailoutId ast_id, Node* node, BailoutId ast_id,
OutputFrameStateCombine combine = OutputFrameStateCombine::Ignore()); OutputFrameStateCombine combine = OutputFrameStateCombine::Ignore());
OutputFrameStateCombine StateCombineFromAstContext();
BitVector* GetVariablesAssignedInLoop(IterationStatement* stmt); BitVector* GetVariablesAssignedInLoop(IterationStatement* stmt);
DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
...@@ -439,8 +438,9 @@ class AstGraphBuilder::ContextScope BASE_EMBEDDED { ...@@ -439,8 +438,9 @@ class AstGraphBuilder::ContextScope BASE_EMBEDDED {
Scope* AstGraphBuilder::current_scope() const { Scope* AstGraphBuilder::current_scope() const {
return execution_context_->scope(); return execution_context_->scope();
} }
}
} } // namespace compiler
} // namespace v8::internal::compiler } // namespace internal
} // namespace v8
#endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_
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