Reviewers: titzer,
Description:
Make AstGraphBuilder::function_context a SetOncePointer again.
[email protected]
Please review this at https://codereview.chromium.org/936003002/
Base URL:
https://chromium.googlesource.com/v8/v8.git@local_cleanup-graph-builder-stack-overflow
Affected files (+9, -7 lines):
M src/compiler/ast-graph-builder.h
M src/compiler/ast-graph-builder.cc
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc
b/src/compiler/ast-graph-builder.cc
index
30bdcfb29702987ee000983ae7aa011ae28c19d1..d0043e11bc6bdbe46acef715e8adaa84be0f45a1
100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -379,7 +379,6 @@ AstGraphBuilder::AstGraphBuilder(Zone* local_zone,
CompilationInfo* info,
globals_(0, local_zone),
execution_control_(nullptr),
execution_context_(nullptr),
- function_context_(nullptr),
input_buffer_size_(0),
input_buffer_(nullptr),
exit_control_(nullptr),
@@ -400,8 +399,10 @@ Node* AstGraphBuilder::GetFunctionClosure() {
Node* AstGraphBuilder::GetFunctionContext() {
- DCHECK(function_context_ != nullptr);
- return function_context_;
+ if (!function_context_.is_set()) {
+ function_context_.set(NewOuterContextParam());
+ }
+ return function_context_.get();
}
@@ -442,8 +443,8 @@ bool AstGraphBuilder::CreateGraph() {
}
// Initialize the incoming context.
- function_context_ = NewOuterContextParam();
- ContextScope incoming(this, scope, function_context_);
+ Node* outer_context = GetFunctionContext();
+ ContextScope incoming(this, scope, outer_context);
// Build receiver check for sloppy mode if necessary.
// TODO(mstarzinger/verwaest): Should this be moved back into the CallIC?
@@ -456,7 +457,7 @@ bool AstGraphBuilder::CreateGraph() {
if (heap_slots > 0) {
// Push a new inner context scope for the function.
Node* closure = GetFunctionClosure();
- Node* inner_context = BuildLocalFunctionContext(function_context_,
closure);
+ Node* inner_context = BuildLocalFunctionContext(outer_context,
closure);
ContextScope top_context(this, scope, inner_context);
CreateGraphBody();
} else {
Index: src/compiler/ast-graph-builder.h
diff --git a/src/compiler/ast-graph-builder.h
b/src/compiler/ast-graph-builder.h
index
515283fc8a48fabde62cce0b7959e3e1552b98fa..7ef58a2713a31f92995ac0aa3999134aba6ba734
100644
--- a/src/compiler/ast-graph-builder.h
+++ b/src/compiler/ast-graph-builder.h
@@ -88,7 +88,7 @@ class AstGraphBuilder : public AstVisitor {
// Nodes representing values in the activation record.
SetOncePointer<Node> function_closure_;
- Node* function_context_;
+ SetOncePointer<Node> function_context_;
// Temporary storage for building node input lists.
int input_buffer_size_;
@@ -174,6 +174,7 @@ class AstGraphBuilder : public AstVisitor {
Node* NewPhi(int count, Node* input, Node* control);
Node* NewEffectPhi(int count, Node* input, Node* control);
+ // Creates new context nodes.
Node* NewOuterContextParam();
Node* NewCurrentContextOsrValue();
--
--
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.