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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/assembler.h" 6 #include "vm/assembler.h"
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 2961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2972 value ^= OneByteString::null(); 2972 value ^= OneByteString::null();
2973 } 2973 }
2974 isolate->heap()->CollectAllGarbage(); 2974 isolate->heap()->CollectAllGarbage();
2975 // Weak property key and value should survive due to cross-generation 2975 // Weak property key and value should survive due to cross-generation
2976 // pointers. 2976 // pointers.
2977 EXPECT(weak.key() != Object::null()); 2977 EXPECT(weak.key() != Object::null());
2978 EXPECT(weak.value() != Object::null()); 2978 EXPECT(weak.value() != Object::null());
2979 } 2979 }
2980 2980
2981 2981
2982 TEST_CASE(WeakProperty_PreserveRecurse) {
2983 // This used to end in an infinite recursion. Caused by scavenging the weak
2984 // property before scavenging the key.
2985 Isolate* isolate = Isolate::Current();
2986 WeakProperty& weak = WeakProperty::Handle();
2987 Array& arr = Array::Handle(Array::New(1));
2988 {
2989 HANDLESCOPE(isolate);
2990 OneByteString& key = OneByteString::Handle();
2991 key ^= OneByteString::New("key");
2992 arr.SetAt(0, key);
2993 OneByteString& value = OneByteString::Handle();
2994 value ^= OneByteString::New("value");
2995 weak ^= WeakProperty::New();
2996 weak.set_key(key);
2997 weak.set_value(value);
2998 }
2999 isolate->heap()->CollectAllGarbage();
3000 EXPECT(weak.key() != Object::null());
3001 EXPECT(weak.value() != Object::null());
3002 }
3003
3004
2982 TEST_CASE(WeakProperty_PreserveOne_NewSpace) { 3005 TEST_CASE(WeakProperty_PreserveOne_NewSpace) {
2983 Isolate* isolate = Isolate::Current(); 3006 Isolate* isolate = Isolate::Current();
2984 WeakProperty& weak = WeakProperty::Handle(); 3007 WeakProperty& weak = WeakProperty::Handle();
2985 OneByteString& key = OneByteString::Handle(); 3008 OneByteString& key = OneByteString::Handle();
2986 key ^= OneByteString::New("key"); 3009 key ^= OneByteString::New("key");
2987 { 3010 {
2988 HANDLESCOPE(isolate); 3011 HANDLESCOPE(isolate);
2989 OneByteString& value = OneByteString::Handle(); 3012 OneByteString& value = OneByteString::Handle();
2990 value ^= OneByteString::New("value"); 3013 value ^= OneByteString::New("value");
2991 weak ^= WeakProperty::New(); 3014 weak ^= WeakProperty::New();
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 isolate->heap()->CollectAllGarbage(); 3243 isolate->heap()->CollectAllGarbage();
3221 EXPECT(weak1.key() == Object::null()); 3244 EXPECT(weak1.key() == Object::null());
3222 EXPECT(weak1.value() == Object::null()); 3245 EXPECT(weak1.value() == Object::null());
3223 EXPECT(weak2.key() == Object::null()); 3246 EXPECT(weak2.key() == Object::null());
3224 EXPECT(weak2.value() == Object::null()); 3247 EXPECT(weak2.value() == Object::null());
3225 } 3248 }
3226 3249
3227 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 3250 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
3228 3251
3229 } // namespace dart 3252 } // namespace dart
OLDNEW
« 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