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

Unified Diff: runtime/vm/object_test.cc

Issue 11047007: - Add regression test case for dartbug.com/5546. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | « runtime/tests/vm/vm.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_test.cc
===================================================================
--- runtime/vm/object_test.cc (revision 13117)
+++ runtime/vm/object_test.cc (working copy)
@@ -2979,6 +2979,29 @@
}
+TEST_CASE(WeakProperty_PreserveRecurse) {
+ // This used to end in an infinite recursion. Caused by scavenging the weak
+ // property before scavenging the key.
+ Isolate* isolate = Isolate::Current();
+ WeakProperty& weak = WeakProperty::Handle();
+ Array& arr = Array::Handle(Array::New(1));
+ {
+ HANDLESCOPE(isolate);
+ OneByteString& key = OneByteString::Handle();
+ key ^= OneByteString::New("key");
+ arr.SetAt(0, key);
+ OneByteString& value = OneByteString::Handle();
+ value ^= OneByteString::New("value");
+ weak ^= WeakProperty::New();
+ weak.set_key(key);
+ weak.set_value(value);
+ }
+ isolate->heap()->CollectAllGarbage();
+ EXPECT(weak.key() != Object::null());
+ EXPECT(weak.value() != Object::null());
+}
+
+
TEST_CASE(WeakProperty_PreserveOne_NewSpace) {
Isolate* isolate = Isolate::Current();
WeakProperty& weak = WeakProperty::Handle();
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698