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

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

Issue 17554003: Change static calls in unoptimized code to always call via a stub. Using ICData, the call count of … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/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 2526 matching lines...) Expand 10 before | Expand all | Expand 10 after
2537 GrowableArray<intptr_t> classes; 2537 GrowableArray<intptr_t> classes;
2538 classes.Add(kSmiCid); 2538 classes.Add(kSmiCid);
2539 classes.Add(kSmiCid); 2539 classes.Add(kSmiCid);
2540 o2.AddCheck(classes, target1); 2540 o2.AddCheck(classes, target1);
2541 EXPECT_EQ(1, o2.NumberOfChecks()); 2541 EXPECT_EQ(1, o2.NumberOfChecks());
2542 o2.GetCheckAt(0, &test_class_ids, &test_target); 2542 o2.GetCheckAt(0, &test_class_ids, &test_target);
2543 EXPECT_EQ(2, test_class_ids.length()); 2543 EXPECT_EQ(2, test_class_ids.length());
2544 EXPECT_EQ(kSmiCid, test_class_ids[0]); 2544 EXPECT_EQ(kSmiCid, test_class_ids[0]);
2545 EXPECT_EQ(kSmiCid, test_class_ids[1]); 2545 EXPECT_EQ(kSmiCid, test_class_ids[1]);
2546 EXPECT_EQ(target1.raw(), test_target.raw()); 2546 EXPECT_EQ(target1.raw(), test_target.raw());
2547
2548 // Check ICData for unoptimized static calls.
2549 const intptr_t kNumArgsChecked = 0;
2550 const ICData& scall_icdata = ICData::Handle(
2551 ICData::New(function, target_name, args_descriptor, 57, kNumArgsChecked));
2552 scall_icdata.AddTarget(target1);
2553 EXPECT_EQ(target1.raw(), scall_icdata.GetTargetAt(0));
2547 } 2554 }
2548 2555
2549 2556
2550 TEST_CASE(SubtypeTestCache) { 2557 TEST_CASE(SubtypeTestCache) {
2551 String& class_name = String::Handle(Symbols::New("EmptyClass")); 2558 String& class_name = String::Handle(Symbols::New("EmptyClass"));
2552 Script& script = Script::Handle(); 2559 Script& script = Script::Handle();
2553 const Class& empty_class = 2560 const Class& empty_class =
2554 Class::Handle(CreateDummyClass(class_name, script)); 2561 Class::Handle(CreateDummyClass(class_name, script));
2555 SubtypeTestCache& cache = SubtypeTestCache::Handle(SubtypeTestCache::New()); 2562 SubtypeTestCache& cache = SubtypeTestCache::Handle(SubtypeTestCache::New());
2556 ASSERT(!cache.IsNull()); 2563 ASSERT(!cache.IsNull());
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
3329 const Function& test7 = Function::Handle(GetFunction(class_a, "test7")); 3336 const Function& test7 = Function::Handle(GetFunction(class_a, "test7"));
3330 EXPECT_EQ(test1.SourceFingerprint(), test2.SourceFingerprint()); 3337 EXPECT_EQ(test1.SourceFingerprint(), test2.SourceFingerprint());
3331 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint()); 3338 EXPECT_NE(test1.SourceFingerprint(), test3.SourceFingerprint());
3332 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint()); 3339 EXPECT_NE(test3.SourceFingerprint(), test4.SourceFingerprint());
3333 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint()); 3340 EXPECT_NE(test4.SourceFingerprint(), test5.SourceFingerprint());
3334 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint()); 3341 EXPECT_NE(test5.SourceFingerprint(), test6.SourceFingerprint());
3335 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint()); 3342 EXPECT_EQ(test6.SourceFingerprint(), test7.SourceFingerprint());
3336 } 3343 }
3337 3344
3338 } // namespace dart 3345 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698