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

Unified Diff: test/cctest/test-heap.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/x87/full-codegen-x87.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index a37da264d498e1ef438e36f1c98ce36da109cb2a..e0665ce285045e6847bd8a0f1af2245c20da3be8 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -5558,3 +5558,44 @@ TEST(NewSpaceAllocationThroughput2) {
bytes = tracer->NewSpaceAllocatedBytesInLast(100);
CHECK_EQ((counter3 - counter1) * 100 / (time3 - time1), bytes);
}
+
+
+static void CheckLeak(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ Isolate* isolate = CcTest::i_isolate();
+ Object* message =
+ *reinterpret_cast<Object**>(isolate->pending_message_obj_address());
+ CHECK(message->IsTheHole());
+}
+
+
+TEST(MessageObjectLeak) {
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
+ global->Set(v8::String::NewFromUtf8(isolate, "check"),
+ v8::FunctionTemplate::New(isolate, CheckLeak));
+ v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global);
+ v8::Context::Scope cscope(context);
+
+ const char* test =
+ "try {"
+ " throw 'message 1';"
+ "} catch (e) {"
+ "}"
+ "check();"
+ "L: try {"
+ " throw 'message 2';"
+ "} finally {"
+ " break L;"
+ "}"
+ "check();";
+ CompileRun(test);
+
+ const char* flag = "--turbo-filter=*";
+ FlagList::SetFlagsFromString(flag, StrLength(flag));
+ FLAG_always_opt = true;
+ FLAG_turbo_exceptions = true;
+
+ CompileRun(test);
+}
« no previous file with comments | « src/x87/full-codegen-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698