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

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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/stub_code_ia32.cc » ('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/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 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 TEST_CASE(SubtypeTestCache) { 2639 TEST_CASE(SubtypeTestCache) {
2640 String& class_name = String::Handle(String::NewSymbol("EmptyClass")); 2640 String& class_name = String::Handle(String::NewSymbol("EmptyClass"));
2641 Script& script = Script::Handle(); 2641 Script& script = Script::Handle();
2642 const Class& empty_class = 2642 const Class& empty_class =
2643 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex)); 2643 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex));
2644 SubtypeTestCache& cache = SubtypeTestCache::Handle(SubtypeTestCache::New()); 2644 SubtypeTestCache& cache = SubtypeTestCache::Handle(SubtypeTestCache::New());
2645 ASSERT(!cache.IsNull()); 2645 ASSERT(!cache.IsNull());
2646 EXPECT_EQ(0, cache.NumberOfChecks()); 2646 EXPECT_EQ(0, cache.NumberOfChecks());
2647 const TypeArguments& targ_0 = TypeArguments::Handle(TypeArguments::New(2)); 2647 const TypeArguments& targ_0 = TypeArguments::Handle(TypeArguments::New(2));
2648 const TypeArguments& targ_1 = TypeArguments::Handle(TypeArguments::New(3)); 2648 const TypeArguments& targ_1 = TypeArguments::Handle(TypeArguments::New(3));
2649 cache.AddCheck(empty_class, targ_0, targ_1, Bool::Handle(Bool::True())); 2649 cache.AddCheck(empty_class.id(), targ_0, targ_1, Bool::Handle(Bool::True()));
2650 EXPECT_EQ(1, cache.NumberOfChecks()); 2650 EXPECT_EQ(1, cache.NumberOfChecks());
2651 Class& test_class = Class::Handle(); 2651 intptr_t test_class_id = -1;
2652 AbstractTypeArguments& test_targ_0 = AbstractTypeArguments::Handle(); 2652 AbstractTypeArguments& test_targ_0 = AbstractTypeArguments::Handle();
2653 AbstractTypeArguments& test_targ_1 = AbstractTypeArguments::Handle(); 2653 AbstractTypeArguments& test_targ_1 = AbstractTypeArguments::Handle();
2654 Bool& test_result = Bool::Handle(); 2654 Bool& test_result = Bool::Handle();
2655 cache.GetCheck(0, &test_class, &test_targ_0, &test_targ_1, &test_result); 2655 cache.GetCheck(0, &test_class_id, &test_targ_0, &test_targ_1, &test_result);
2656 EXPECT_EQ(empty_class.raw(), test_class.raw()); 2656 EXPECT_EQ(empty_class.id(), test_class_id);
2657 EXPECT_EQ(targ_0.raw(), test_targ_0.raw()); 2657 EXPECT_EQ(targ_0.raw(), test_targ_0.raw());
2658 EXPECT_EQ(targ_1.raw(), test_targ_1.raw()); 2658 EXPECT_EQ(targ_1.raw(), test_targ_1.raw());
2659 EXPECT_EQ(Bool::True(), test_result.raw()); 2659 EXPECT_EQ(Bool::True(), test_result.raw());
2660 } 2660 }
2661 2661
2662 2662
2663 TEST_CASE(FieldTests) { 2663 TEST_CASE(FieldTests) {
2664 const String& f = String::Handle(String::New("oneField")); 2664 const String& f = String::Handle(String::New("oneField"));
2665 const String& getter_f = String::Handle(Field::GetterName(f)); 2665 const String& getter_f = String::Handle(Field::GetterName(f));
2666 const String& setter_f = String::Handle(Field::SetterName(f)); 2666 const String& setter_f = String::Handle(Field::SetterName(f));
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2777 // Named double-private constructor mismatch. 2777 // Named double-private constructor mismatch.
2778 mangled_name = String::New("foo@12345.named@12345"); 2778 mangled_name = String::New("foo@12345.named@12345");
2779 bare_name = String::New("foo.name"); 2779 bare_name = String::New("foo.name");
2780 EXPECT(!EqualsIgnoringPrivate(mangled_name, bare_name)); 2780 EXPECT(!EqualsIgnoringPrivate(mangled_name, bare_name));
2781 } 2781 }
2782 2782
2783 2783
2784 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 2784 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
2785 2785
2786 } // namespace dart 2786 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698