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

Side by Side Diff: runtime/vm/object_test.cc

Issue 2960063002: Revert "Modifies the debug garbage collector (CollectAllGarbage()) to correctly remove inter-genera… (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « runtime/vm/heap_test.cc ('k') | runtime/vm/raw_object.h » ('j') | 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/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 3364 matching lines...) Expand 10 before | Expand all | Expand 10 after
3375 String& key = String::Handle(); 3375 String& key = String::Handle();
3376 key ^= OneByteString::New("key", Heap::kOld); 3376 key ^= OneByteString::New("key", Heap::kOld);
3377 String& value = String::Handle(); 3377 String& value = String::Handle();
3378 value ^= OneByteString::New("value", Heap::kNew); 3378 value ^= OneByteString::New("value", Heap::kNew);
3379 weak ^= WeakProperty::New(Heap::kNew); 3379 weak ^= WeakProperty::New(Heap::kNew);
3380 weak.set_key(key); 3380 weak.set_key(key);
3381 weak.set_value(value); 3381 weak.set_value(value);
3382 key ^= OneByteString::null(); 3382 key ^= OneByteString::null();
3383 value ^= OneByteString::null(); 3383 value ^= OneByteString::null();
3384 } 3384 }
3385 isolate->heap()->CollectGarbage(Heap::kNew); 3385 isolate->heap()->CollectAllGarbage();
3386 isolate->heap()->CollectGarbage(Heap::kOld);
3387 // Weak property key and value should survive due to cross-generation 3386 // Weak property key and value should survive due to cross-generation
3388 // pointers. 3387 // pointers.
3389 EXPECT(weak.key() != Object::null()); 3388 EXPECT(weak.key() != Object::null());
3390 EXPECT(weak.value() != Object::null()); 3389 EXPECT(weak.value() != Object::null());
3391 { 3390 {
3392 // Weak property and value in old. Key in new. 3391 // Weak property and value in old. Key in new.
3393 HANDLESCOPE(thread); 3392 HANDLESCOPE(thread);
3394 String& key = String::Handle(); 3393 String& key = String::Handle();
3395 key ^= OneByteString::New("key", Heap::kNew); 3394 key ^= OneByteString::New("key", Heap::kNew);
3396 String& value = String::Handle(); 3395 String& value = String::Handle();
3397 value ^= OneByteString::New("value", Heap::kOld); 3396 value ^= OneByteString::New("value", Heap::kOld);
3398 weak ^= WeakProperty::New(Heap::kOld); 3397 weak ^= WeakProperty::New(Heap::kOld);
3399 weak.set_key(key); 3398 weak.set_key(key);
3400 weak.set_value(value); 3399 weak.set_value(value);
3401 key ^= OneByteString::null(); 3400 key ^= OneByteString::null();
3402 value ^= OneByteString::null(); 3401 value ^= OneByteString::null();
3403 } 3402 }
3404 isolate->heap()->CollectGarbage(Heap::kNew); 3403 isolate->heap()->CollectAllGarbage();
3405 isolate->heap()->CollectGarbage(Heap::kOld);
3406 // Weak property key and value should survive due to cross-generation 3404 // Weak property key and value should survive due to cross-generation
3407 // pointers. 3405 // pointers.
3408 EXPECT(weak.key() != Object::null()); 3406 EXPECT(weak.key() != Object::null());
3409 EXPECT(weak.value() != Object::null()); 3407 EXPECT(weak.value() != Object::null());
3410 { 3408 {
3411 // Weak property and value in new. Key is a Smi. 3409 // Weak property and value in new. Key is a Smi.
3412 HANDLESCOPE(thread); 3410 HANDLESCOPE(thread);
3413 Integer& key = Integer::Handle(); 3411 Integer& key = Integer::Handle();
3414 key ^= Integer::New(31); 3412 key ^= Integer::New(31);
3415 String& value = String::Handle(); 3413 String& value = String::Handle();
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
4742 // utf32->utf16 conversion. 4740 // utf32->utf16 conversion.
4743 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, 4741 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff,
4744 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; 4742 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff};
4745 4743
4746 const String& str = 4744 const String& str =
4747 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); 4745 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes)));
4748 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); 4746 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes)));
4749 } 4747 }
4750 4748
4751 } // namespace dart 4749 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/heap_test.cc ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698