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