Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 935033002: Simplify handling of stack overflows in AstGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index c33cc60ce573afa4b9270c3f83a8588e3f085421..30bdcfb29702987ee000983ae7aa011ae28c19d1 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -451,31 +451,30 @@ bool AstGraphBuilder::CreateGraph() {
Node* patched_receiver = BuildPatchReceiverToGlobalProxy(original_receiver);
env.Bind(scope->receiver(), patched_receiver);
- bool ok;
+ // Build function context only if there are context allocated variables.
int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
if (heap_slots > 0) {
// Push a new inner context scope for the function.
Node* closure = GetFunctionClosure();
Node* inner_context = BuildLocalFunctionContext(function_context_, closure);
ContextScope top_context(this, scope, inner_context);
- ok = CreateGraphBody();
+ CreateGraphBody();
} else {
// Simply use the outer function context in building the graph.
- ok = CreateGraphBody();
+ CreateGraphBody();
}
// Finish the basic structure of the graph.
- if (ok) {
- environment()->UpdateControlDependency(exit_control());
- graph()->SetEnd(NewNode(common()->End()));
- }
+ graph()->SetEnd(graph()->NewNode(common()->End(), exit_control()));
- return ok;
+ // Failures indicated by stack overflow.
+ return !HasStackOverflow();
}
-bool AstGraphBuilder::CreateGraphBody() {
+void AstGraphBuilder::CreateGraphBody() {
Scope* scope = info()->scope();
+
// Build the arguments object if it is used.
BuildArgumentsObject(scope->arguments());
@@ -503,7 +502,6 @@ bool AstGraphBuilder::CreateGraphBody() {
// Visit statements in the function body.
VisitStatements(info()->function()->body());
- if (HasStackOverflow()) return false;
// Emit tracing call if requested to do so.
if (FLAG_trace) {
@@ -514,8 +512,6 @@ bool AstGraphBuilder::CreateGraphBody() {
// Return 'undefined' in case we can fall off the end.
BuildReturn(jsgraph()->UndefinedConstant());
-
- return true;
}
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698