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

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

Issue 14820028: Delay Class parsing until the class is actually used. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
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/class_finalizer.h" 6 #include "vm/class_finalizer.h"
7 #include "vm/symbols.h" 7 #include "vm/symbols.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 24 matching lines...) Expand all
35 35
36 GrowableArray<const Class*> classes_2; 36 GrowableArray<const Class*> classes_2;
37 classes_2.Add(&Class::ZoneHandle(CreateTestClass("Ferrari"))); 37 classes_2.Add(&Class::ZoneHandle(CreateTestClass("Ferrari")));
38 pending_classes.Add(*classes_2[0]); 38 pending_classes.Add(*classes_2[0]);
39 classes_2.Add(&Class::ZoneHandle(CreateTestClass("Fiat"))); 39 classes_2.Add(&Class::ZoneHandle(CreateTestClass("Fiat")));
40 pending_classes.Add(*classes_2[1]); 40 pending_classes.Add(*classes_2[1]);
41 classes_2.Add(&Class::ZoneHandle(CreateTestClass("Alfa"))); 41 classes_2.Add(&Class::ZoneHandle(CreateTestClass("Alfa")));
42 pending_classes.Add(*classes_2[2]); 42 pending_classes.Add(*classes_2[2]);
43 EXPECT(ClassFinalizer::FinalizePendingClasses()); 43 EXPECT(ClassFinalizer::FinalizePendingClasses());
44 for (int i = 0; i < classes_1.length(); i++) { 44 for (int i = 0; i < classes_1.length(); i++) {
45 EXPECT(classes_1[i]->is_finalized()); 45 EXPECT(classes_1[i]->is_type_finalized());
46 } 46 }
47 for (int i = 0; i < classes_2.length(); i++) { 47 for (int i = 0; i < classes_2.length(); i++) {
48 EXPECT(classes_2[i]->is_finalized()); 48 EXPECT(classes_2[i]->is_type_finalized());
49 } 49 }
50 EXPECT(ClassFinalizer::AllClassesFinalized()); 50 EXPECT(ClassFinalizer::AllClassesFinalized());
51 EXPECT(ClassFinalizer::FinalizePendingClasses()); 51 EXPECT(ClassFinalizer::FinalizePendingClasses());
52 } 52 }
53 53
54 54
55 TEST_CASE(ClassFinalize_Cycles) { 55 TEST_CASE(ClassFinalize_Cycles) {
56 Isolate* isolate = Isolate::Current(); 56 Isolate* isolate = Isolate::Current();
57 ObjectStore* object_store = isolate->object_store(); 57 ObjectStore* object_store = isolate->object_store();
58 const GrowableObjectArray& pending_classes = 58 const GrowableObjectArray& pending_classes =
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 Scanner::kDummyTokenIndex)); 96 Scanner::kDummyTokenIndex));
97 const TypeArguments& type_arguments = TypeArguments::Handle(); 97 const TypeArguments& type_arguments = TypeArguments::Handle();
98 rhb.set_super_type(Type::Handle( 98 rhb.set_super_type(Type::Handle(
99 Type::New(Object::Handle(unresolved.raw()), 99 Type::New(Object::Handle(unresolved.raw()),
100 type_arguments, 100 type_arguments,
101 Scanner::kDummyTokenIndex))); 101 Scanner::kDummyTokenIndex)));
102 EXPECT(ClassFinalizer::FinalizePendingClasses()); 102 EXPECT(ClassFinalizer::FinalizePendingClasses());
103 } 103 }
104 104
105 } // namespace dart 105 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/compiler.h » ('j') | runtime/vm/compiler.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698