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

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: platform ports and turbofan 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
« src/full-codegen.h ('K') | « 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 d9d2a861ebf30d4644d91f71ee49ceaf10627f47..c49e29abbf10a31f2f918c40a93f4fcb160ead70 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -5558,3 +5558,37 @@ 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';"
Michael Starzinger 2015/05/22 13:02:29 As discussed offline: We should have the same prob
+ "} catch (e) {"
+ "}"
+ "check();";
+ CompileRun(test);
+
+ FLAG_turbo_filter = "*";
+ FLAG_always_opt = true;
+ FLAG_turbo_exceptions = true;
+
+ CompileRun(test);
+}
« src/full-codegen.h ('K') | « src/x87/full-codegen-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698