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

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

Issue 1150293002: Do not leak message object beyond try-catch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix memory leak by setting flag Created 5 years, 7 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/arm64/full-codegen-arm64.cc ('k') | src/full-codegen.h » ('j') | 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 a63744e2f34a41795e368e6dedc40d93d73c2fc2..d3506e7550c7a036c0f23cb1643882c6a293cd1b 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -1474,6 +1474,12 @@ void AstGraphBuilder::VisitTryCatchStatement(TryCatchStatement* stmt) {
}
try_control.EndTry();
+ // Clear message object as we enter the catch block.
+ ExternalReference message_object =
+ ExternalReference::address_of_pending_message_obj(isolate());
+ Node* the_hole = jsgraph()->TheHoleConstant();
+ BuildStoreExternal(message_object, kMachAnyTagged, the_hole);
+
// Create a catch scope that binds the exception.
Node* exception = try_control.GetExceptionNode();
Unique<String> name = MakeUnique(stmt->variable()->name());
@@ -1539,6 +1545,10 @@ void AstGraphBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
environment()->Push(result);
environment()->Push(message);
+ // Clear message object as we enter the finally block.
+ Node* the_hole = jsgraph()->TheHoleConstant();
+ BuildStoreExternal(message_object, kMachAnyTagged, the_hole);
+
// Evaluate the finally-block.
Visit(stmt->finally_block());
try_control.EndFinally();
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698