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

Side by Side Diff: vm/object_test.cc

Issue 11667012: Convert all symbols accessor to return read only handles so that it is not necessary to create a ne… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 years, 11 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 | « vm/object.cc ('k') | vm/parser.cc » ('j') | vm/symbols.h » ('J')
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/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/isolate.h" 9 #include "vm/isolate.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
(...skipping 3107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3118 value ^= OneByteString::null(); 3118 value ^= OneByteString::null();
3119 } 3119 }
3120 isolate->heap()->CollectAllGarbage(); 3120 isolate->heap()->CollectAllGarbage();
3121 // Weak property key and value should survive due implicit liveness of 3121 // Weak property key and value should survive due implicit liveness of
3122 // non-heap objects. 3122 // non-heap objects.
3123 EXPECT(weak.key() != Object::null()); 3123 EXPECT(weak.key() != Object::null());
3124 EXPECT(weak.value() != Object::null()); 3124 EXPECT(weak.value() != Object::null());
3125 { 3125 {
3126 // Weak property and value in new. Key in VM isolate. 3126 // Weak property and value in new. Key in VM isolate.
3127 HANDLESCOPE(isolate); 3127 HANDLESCOPE(isolate);
3128 String& key = String::Handle();
3129 key ^= Symbols::Dot();
3130 String& value = String::Handle(); 3128 String& value = String::Handle();
3131 value ^= OneByteString::New("value", Heap::kNew); 3129 value ^= OneByteString::New("value", Heap::kNew);
3132 weak ^= WeakProperty::New(Heap::kNew); 3130 weak ^= WeakProperty::New(Heap::kNew);
3133 weak.set_key(key); 3131 weak.set_key(Symbols::Dot());
3134 weak.set_value(value); 3132 weak.set_value(value);
3133 String& key = String::Handle();
3135 key ^= OneByteString::null(); 3134 key ^= OneByteString::null();
3136 value ^= OneByteString::null(); 3135 value ^= OneByteString::null();
3137 } 3136 }
3138 isolate->heap()->CollectAllGarbage(); 3137 isolate->heap()->CollectAllGarbage();
3139 // Weak property key and value should survive due to cross-generation 3138 // Weak property key and value should survive due to cross-generation
3140 // pointers. 3139 // pointers.
3141 EXPECT(weak.key() != Object::null()); 3140 EXPECT(weak.key() != Object::null());
3142 EXPECT(weak.value() != Object::null()); 3141 EXPECT(weak.value() != Object::null());
3143 { 3142 {
3144 // Weak property and value in old. Key in VM isolate. 3143 // Weak property and value in old. Key in VM isolate.
3145 HANDLESCOPE(isolate); 3144 HANDLESCOPE(isolate);
3146 String& key = String::Handle();
3147 key ^= Symbols::Dot();
3148 String& value = String::Handle(); 3145 String& value = String::Handle();
3149 value ^= OneByteString::New("value", Heap::kOld); 3146 value ^= OneByteString::New("value", Heap::kOld);
3150 weak ^= WeakProperty::New(Heap::kOld); 3147 weak ^= WeakProperty::New(Heap::kOld);
3151 weak.set_key(key); 3148 weak.set_key(Symbols::Dot());
3152 weak.set_value(value); 3149 weak.set_value(value);
3150 String& key = String::Handle();
3153 key ^= OneByteString::null(); 3151 key ^= OneByteString::null();
3154 value ^= OneByteString::null(); 3152 value ^= OneByteString::null();
3155 } 3153 }
3156 isolate->heap()->CollectAllGarbage(); 3154 isolate->heap()->CollectAllGarbage();
3157 // Weak property key and value should survive due to cross-generation 3155 // Weak property key and value should survive due to cross-generation
3158 // pointers. 3156 // pointers.
3159 EXPECT(weak.key() != Object::null()); 3157 EXPECT(weak.key() != Object::null());
3160 EXPECT(weak.value() != Object::null()); 3158 EXPECT(weak.value() != Object::null());
3161 } 3159 }
3162 3160
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3483 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); 3481 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint());
3484 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); 3482 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint());
3485 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); 3483 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint());
3486 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); 3484 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint());
3487 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); 3485 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint());
3488 } 3486 }
3489 3487
3490 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 3488 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
3491 3489
3492 } // namespace dart 3490 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.cc ('k') | vm/parser.cc » ('j') | vm/symbols.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698