| OLD | NEW |
| 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 3346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3357 String& key = String::Handle(); | 3357 String& key = String::Handle(); |
| 3358 key ^= OneByteString::New("key", Heap::kOld); | 3358 key ^= OneByteString::New("key", Heap::kOld); |
| 3359 String& value = String::Handle(); | 3359 String& value = String::Handle(); |
| 3360 value ^= OneByteString::New("value", Heap::kNew); | 3360 value ^= OneByteString::New("value", Heap::kNew); |
| 3361 weak ^= WeakProperty::New(Heap::kNew); | 3361 weak ^= WeakProperty::New(Heap::kNew); |
| 3362 weak.set_key(key); | 3362 weak.set_key(key); |
| 3363 weak.set_value(value); | 3363 weak.set_value(value); |
| 3364 key ^= OneByteString::null(); | 3364 key ^= OneByteString::null(); |
| 3365 value ^= OneByteString::null(); | 3365 value ^= OneByteString::null(); |
| 3366 } | 3366 } |
| 3367 isolate->heap()->CollectAllGarbage(); | 3367 isolate->heap()->CollectGarbage(Heap::kNew); |
| 3368 isolate->heap()->CollectGarbage(Heap::kOld); |
| 3368 // Weak property key and value should survive due to cross-generation | 3369 // Weak property key and value should survive due to cross-generation |
| 3369 // pointers. | 3370 // pointers. |
| 3370 EXPECT(weak.key() != Object::null()); | 3371 EXPECT(weak.key() != Object::null()); |
| 3371 EXPECT(weak.value() != Object::null()); | 3372 EXPECT(weak.value() != Object::null()); |
| 3372 { | 3373 { |
| 3373 // Weak property and value in old. Key in new. | 3374 // Weak property and value in old. Key in new. |
| 3374 HANDLESCOPE(thread); | 3375 HANDLESCOPE(thread); |
| 3375 String& key = String::Handle(); | 3376 String& key = String::Handle(); |
| 3376 key ^= OneByteString::New("key", Heap::kNew); | 3377 key ^= OneByteString::New("key", Heap::kNew); |
| 3377 String& value = String::Handle(); | 3378 String& value = String::Handle(); |
| 3378 value ^= OneByteString::New("value", Heap::kOld); | 3379 value ^= OneByteString::New("value", Heap::kOld); |
| 3379 weak ^= WeakProperty::New(Heap::kOld); | 3380 weak ^= WeakProperty::New(Heap::kOld); |
| 3380 weak.set_key(key); | 3381 weak.set_key(key); |
| 3381 weak.set_value(value); | 3382 weak.set_value(value); |
| 3382 key ^= OneByteString::null(); | 3383 key ^= OneByteString::null(); |
| 3383 value ^= OneByteString::null(); | 3384 value ^= OneByteString::null(); |
| 3384 } | 3385 } |
| 3385 isolate->heap()->CollectAllGarbage(); | 3386 isolate->heap()->CollectGarbage(Heap::kNew); |
| 3387 isolate->heap()->CollectGarbage(Heap::kOld); |
| 3386 // Weak property key and value should survive due to cross-generation | 3388 // Weak property key and value should survive due to cross-generation |
| 3387 // pointers. | 3389 // pointers. |
| 3388 EXPECT(weak.key() != Object::null()); | 3390 EXPECT(weak.key() != Object::null()); |
| 3389 EXPECT(weak.value() != Object::null()); | 3391 EXPECT(weak.value() != Object::null()); |
| 3390 { | 3392 { |
| 3391 // Weak property and value in new. Key is a Smi. | 3393 // Weak property and value in new. Key is a Smi. |
| 3392 HANDLESCOPE(thread); | 3394 HANDLESCOPE(thread); |
| 3393 Integer& key = Integer::Handle(); | 3395 Integer& key = Integer::Handle(); |
| 3394 key ^= Integer::New(31); | 3396 key ^= Integer::New(31); |
| 3395 String& value = String::Handle(); | 3397 String& value = String::Handle(); |
| (...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4722 // utf32->utf16 conversion. | 4724 // utf32->utf16 conversion. |
| 4723 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, | 4725 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, |
| 4724 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; | 4726 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; |
| 4725 | 4727 |
| 4726 const String& str = | 4728 const String& str = |
| 4727 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); | 4729 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); |
| 4728 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); | 4730 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); |
| 4729 } | 4731 } |
| 4730 | 4732 |
| 4731 } // namespace dart | 4733 } // namespace dart |
| OLD | NEW |