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

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

Issue 10695136: Use class id instead of class in subtype test cache. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | 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/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 2622 matching lines...) Expand 10 before | Expand all | Expand 10 after
2633 TEST_CASE(SubtypeTestCache) { 2633 TEST_CASE(SubtypeTestCache) {
2634 String& class_name = String::Handle(String::NewSymbol("EmptyClass")); 2634 String& class_name = String::Handle(String::NewSymbol("EmptyClass"));
2635 Script& script = Script::Handle(); 2635 Script& script = Script::Handle();
2636 const Class& empty_class = 2636 const Class& empty_class =
2637 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); 2637 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex));
2638 SubtypeTestCache& cache = SubtypeTestCache::Handle(SubtypeTestCache::New()); 2638 SubtypeTestCache& cache = SubtypeTestCache::Handle(SubtypeTestCache::New());
2639 ASSERT(!cache.IsNull()); 2639 ASSERT(!cache.IsNull());
2640 EXPECT_EQ(0, cache.NumberOfChecks()); 2640 EXPECT_EQ(0, cache.NumberOfChecks());
2641 const TypeArguments& targ_0 = TypeArguments::Handle(TypeArguments::New(2)); 2641 const TypeArguments& targ_0 = TypeArguments::Handle(TypeArguments::New(2));
2642 const TypeArguments& targ_1 = TypeArguments::Handle(TypeArguments::New(3)); 2642 const TypeArguments& targ_1 = TypeArguments::Handle(TypeArguments::New(3));
2643 cache.AddCheck(empty_class, targ_0, targ_1, Bool::Handle(Bool::True())); 2643 cache.AddCheck(empty_class.id(), targ_0, targ_1, Bool::Handle(Bool::True()));
2644 EXPECT_EQ(1, cache.NumberOfChecks()); 2644 EXPECT_EQ(1, cache.NumberOfChecks());
2645 Class& test_class = Class::Handle(); 2645 intptr_t test_class_id = -1;
2646 AbstractTypeArguments& test_targ_0 = AbstractTypeArguments::Handle(); 2646 AbstractTypeArguments& test_targ_0 = AbstractTypeArguments::Handle();
2647 AbstractTypeArguments& test_targ_1 = AbstractTypeArguments::Handle(); 2647 AbstractTypeArguments& test_targ_1 = AbstractTypeArguments::Handle();
2648 Bool& test_result = Bool::Handle(); 2648 Bool& test_result = Bool::Handle();
2649 cache.GetCheck(0, &test_class, &test_targ_0, &test_targ_1, &test_result); 2649 cache.GetCheck(0, &test_class_id, &test_targ_0, &test_targ_1, &test_result);
2650 EXPECT_EQ(empty_class.raw(), test_class.raw()); 2650 EXPECT_EQ(empty_class.id(), test_class_id);
2651 EXPECT_EQ(targ_0.raw(), test_targ_0.raw()); 2651 EXPECT_EQ(targ_0.raw(), test_targ_0.raw());
2652 EXPECT_EQ(targ_1.raw(), test_targ_1.raw()); 2652 EXPECT_EQ(targ_1.raw(), test_targ_1.raw());
2653 EXPECT_EQ(Bool::True(), test_result.raw()); 2653 EXPECT_EQ(Bool::True(), test_result.raw());
2654 } 2654 }
2655 2655
2656 2656
2657 TEST_CASE(FieldTests) { 2657 TEST_CASE(FieldTests) {
2658 const String& f = String::Handle(String::New("oneField")); 2658 const String& f = String::Handle(String::New("oneField"));
2659 const String& getter_f = String::Handle(Field::GetterName(f)); 2659 const String& getter_f = String::Handle(Field::GetterName(f));
2660 const String& setter_f = String::Handle(Field::SetterName(f)); 2660 const String& setter_f = String::Handle(Field::SetterName(f));
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2771 // Named double-private constructor mismatch. 2771 // Named double-private constructor mismatch.
2772 mangled_name = String::New("foo@12345.named@12345"); 2772 mangled_name = String::New("foo@12345.named@12345");
2773 bare_name = String::New("foo.name"); 2773 bare_name = String::New("foo.name");
2774 EXPECT(!EqualsIgnoringPrivate(mangled_name, bare_name)); 2774 EXPECT(!EqualsIgnoringPrivate(mangled_name, bare_name));
2775 } 2775 }
2776 2776
2777 2777
2778 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 2778 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
2779 2779
2780 } // namespace dart 2780 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | runtime/vm/stub_code_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698