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

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

Issue 10594002: More ICData cleanups: try to use ICData instead of converting it to another intermediate representa… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | 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 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 const String& target_name = String::Handle(String::New("Thun")); 2584 const String& target_name = String::Handle(String::New("Thun"));
2585 ICData& o1 = ICData::Handle(); 2585 ICData& o1 = ICData::Handle();
2586 o1 = ICData::New(function, target_name, id, num_args_tested); 2586 o1 = ICData::New(function, target_name, id, num_args_tested);
2587 EXPECT_EQ(1, o1.num_args_tested()); 2587 EXPECT_EQ(1, o1.num_args_tested());
2588 EXPECT_EQ(id, o1.id()); 2588 EXPECT_EQ(id, o1.id());
2589 EXPECT_EQ(function.raw(), o1.function()); 2589 EXPECT_EQ(function.raw(), o1.function());
2590 EXPECT_EQ(0, o1.NumberOfChecks()); 2590 EXPECT_EQ(0, o1.NumberOfChecks());
2591 EXPECT_EQ(target_name.raw(), o1.target_name()); 2591 EXPECT_EQ(target_name.raw(), o1.target_name());
2592 2592
2593 const Function& target1 = Function::Handle(GetDummyTarget("Thun")); 2593 const Function& target1 = Function::Handle(GetDummyTarget("Thun"));
2594 GrowableArray<intptr_t> classes; 2594 o1.AddReceiverCheck(kSmi, target1);
2595 classes.Add(kSmi);
2596 o1.AddCheck(classes, target1);
2597 EXPECT_EQ(1, o1.NumberOfChecks()); 2595 EXPECT_EQ(1, o1.NumberOfChecks());
2598 intptr_t test_class_id = -1; 2596 intptr_t test_class_id = -1;
2599 Function& test_target = Function::Handle(); 2597 Function& test_target = Function::Handle();
2600 o1.GetOneClassCheckAt(0, &test_class_id, &test_target); 2598 o1.GetOneClassCheckAt(0, &test_class_id, &test_target);
2601 EXPECT_EQ(kSmi, test_class_id); 2599 EXPECT_EQ(kSmi, test_class_id);
2602 EXPECT_EQ(target1.raw(), test_target.raw()); 2600 EXPECT_EQ(target1.raw(), test_target.raw());
2603 GrowableArray<intptr_t> test_class_ids; 2601 GrowableArray<intptr_t> test_class_ids;
2604 o1.GetCheckAt(0, &test_class_ids, &test_target); 2602 o1.GetCheckAt(0, &test_class_ids, &test_target);
2605 EXPECT_EQ(1, test_class_ids.length()); 2603 EXPECT_EQ(1, test_class_ids.length());
2606 EXPECT_EQ(kSmi, test_class_ids[0]); 2604 EXPECT_EQ(kSmi, test_class_ids[0]);
2607 EXPECT_EQ(target1.raw(), test_target.raw()); 2605 EXPECT_EQ(target1.raw(), test_target.raw());
2608 2606
2609 classes.Clear();
2610 const Function& target2 = Function::Handle(GetDummyTarget("Thun")); 2607 const Function& target2 = Function::Handle(GetDummyTarget("Thun"));
2611 classes.Add(kDouble); 2608 o1.AddReceiverCheck(kDouble, target2);
2612 o1.AddCheck(classes, target2);
2613 EXPECT_EQ(2, o1.NumberOfChecks()); 2609 EXPECT_EQ(2, o1.NumberOfChecks());
2614 o1.GetOneClassCheckAt(1, &test_class_id, &test_target); 2610 o1.GetOneClassCheckAt(1, &test_class_id, &test_target);
2615 EXPECT_EQ(kDouble, test_class_id); 2611 EXPECT_EQ(kDouble, test_class_id);
2616 EXPECT_EQ(target2.raw(), test_target.raw()); 2612 EXPECT_EQ(target2.raw(), test_target.raw());
2617 2613
2618 ICData& o2 = ICData::Handle(); 2614 ICData& o2 = ICData::Handle();
2619 o2 = ICData::New(function, target_name, 57, 2); 2615 o2 = ICData::New(function, target_name, 57, 2);
2620 EXPECT_EQ(2, o2.num_args_tested()); 2616 EXPECT_EQ(2, o2.num_args_tested());
2621 EXPECT_EQ(57, o2.id()); 2617 EXPECT_EQ(57, o2.id());
2622 EXPECT_EQ(function.raw(), o2.function()); 2618 EXPECT_EQ(function.raw(), o2.function());
2623 EXPECT_EQ(0, o2.NumberOfChecks()); 2619 EXPECT_EQ(0, o2.NumberOfChecks());
2624 classes.Clear(); 2620 GrowableArray<intptr_t> classes;
2625 classes.Add(kSmi); 2621 classes.Add(kSmi);
2626 classes.Add(kSmi); 2622 classes.Add(kSmi);
2627 o2.AddCheck(classes, target1); 2623 o2.AddCheck(classes, target1);
2628 EXPECT_EQ(1, o2.NumberOfChecks()); 2624 EXPECT_EQ(1, o2.NumberOfChecks());
2629 o2.GetCheckAt(0, &test_class_ids, &test_target); 2625 o2.GetCheckAt(0, &test_class_ids, &test_target);
2630 EXPECT_EQ(2, test_class_ids.length()); 2626 EXPECT_EQ(2, test_class_ids.length());
2631 EXPECT_EQ(kSmi, test_class_ids[0]); 2627 EXPECT_EQ(kSmi, test_class_ids[0]);
2632 EXPECT_EQ(kSmi, test_class_ids[1]); 2628 EXPECT_EQ(kSmi, test_class_ids[1]);
2633 EXPECT_EQ(target1.raw(), test_target.raw()); 2629 EXPECT_EQ(target1.raw(), test_target.raw());
2634 } 2630 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 EXPECT(Field::IsSetterName(setter_f)); 2666 EXPECT(Field::IsSetterName(setter_f));
2671 EXPECT_STREQ(f.ToCString(), 2667 EXPECT_STREQ(f.ToCString(),
2672 String::Handle(Field::NameFromGetter(getter_f)).ToCString()); 2668 String::Handle(Field::NameFromGetter(getter_f)).ToCString());
2673 EXPECT_STREQ(f.ToCString(), 2669 EXPECT_STREQ(f.ToCString(),
2674 String::Handle(Field::NameFromSetter(setter_f)).ToCString()); 2670 String::Handle(Field::NameFromSetter(setter_f)).ToCString());
2675 } 2671 }
2676 2672
2677 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 2673 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
2678 2674
2679 } // namespace dart 2675 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698