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

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

Issue 1544583002: For background compilation we copy ICData so that it is immutable during comnpilation. However, we … (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: remove flag Created 5 years 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/pages.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/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.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 3005 matching lines...) Expand 10 before | Expand all | Expand 10 after
3016 Function& function = Function::Handle(GetDummyTarget("Bern")); 3016 Function& function = Function::Handle(GetDummyTarget("Bern"));
3017 const intptr_t id = 12; 3017 const intptr_t id = 12;
3018 const intptr_t num_args_tested = 1; 3018 const intptr_t num_args_tested = 1;
3019 const String& target_name = String::Handle(Symbols::New("Thun")); 3019 const String& target_name = String::Handle(Symbols::New("Thun"));
3020 const Array& args_descriptor = 3020 const Array& args_descriptor =
3021 Array::Handle(ArgumentsDescriptor::New(1, Object::null_array())); 3021 Array::Handle(ArgumentsDescriptor::New(1, Object::null_array()));
3022 ICData& o1 = ICData::Handle(); 3022 ICData& o1 = ICData::Handle();
3023 o1 = ICData::New(function, target_name, args_descriptor, id, num_args_tested); 3023 o1 = ICData::New(function, target_name, args_descriptor, id, num_args_tested);
3024 EXPECT_EQ(1, o1.NumArgsTested()); 3024 EXPECT_EQ(1, o1.NumArgsTested());
3025 EXPECT_EQ(id, o1.deopt_id()); 3025 EXPECT_EQ(id, o1.deopt_id());
3026 EXPECT_EQ(function.raw(), o1.owner()); 3026 EXPECT_EQ(function.raw(), o1.Owner());
3027 EXPECT_EQ(0, o1.NumberOfChecks()); 3027 EXPECT_EQ(0, o1.NumberOfChecks());
3028 EXPECT_EQ(target_name.raw(), o1.target_name()); 3028 EXPECT_EQ(target_name.raw(), o1.target_name());
3029 EXPECT_EQ(args_descriptor.raw(), o1.arguments_descriptor()); 3029 EXPECT_EQ(args_descriptor.raw(), o1.arguments_descriptor());
3030 3030
3031 const Function& target1 = Function::Handle(GetDummyTarget("Thun")); 3031 const Function& target1 = Function::Handle(GetDummyTarget("Thun"));
3032 o1.AddReceiverCheck(kSmiCid, target1); 3032 o1.AddReceiverCheck(kSmiCid, target1);
3033 EXPECT_EQ(1, o1.NumberOfChecks()); 3033 EXPECT_EQ(1, o1.NumberOfChecks());
3034 EXPECT_EQ(1, o1.NumberOfUsedChecks()); 3034 EXPECT_EQ(1, o1.NumberOfUsedChecks());
3035 intptr_t test_class_id = -1; 3035 intptr_t test_class_id = -1;
3036 Function& test_target = Function::Handle(); 3036 Function& test_target = Function::Handle();
(...skipping 18 matching lines...) Expand all
3055 3055
3056 o1.AddReceiverCheck(kMintCid, target2); 3056 o1.AddReceiverCheck(kMintCid, target2);
3057 EXPECT_EQ(3, o1.NumberOfUsedChecks()); 3057 EXPECT_EQ(3, o1.NumberOfUsedChecks());
3058 o1.SetCountAt(o1.NumberOfChecks() - 1, 0); 3058 o1.SetCountAt(o1.NumberOfChecks() - 1, 0);
3059 EXPECT_EQ(2, o1.NumberOfUsedChecks()); 3059 EXPECT_EQ(2, o1.NumberOfUsedChecks());
3060 3060
3061 ICData& o2 = ICData::Handle(); 3061 ICData& o2 = ICData::Handle();
3062 o2 = ICData::New(function, target_name, args_descriptor, 57, 2); 3062 o2 = ICData::New(function, target_name, args_descriptor, 57, 2);
3063 EXPECT_EQ(2, o2.NumArgsTested()); 3063 EXPECT_EQ(2, o2.NumArgsTested());
3064 EXPECT_EQ(57, o2.deopt_id()); 3064 EXPECT_EQ(57, o2.deopt_id());
3065 EXPECT_EQ(function.raw(), o2.owner()); 3065 EXPECT_EQ(function.raw(), o2.Owner());
3066 EXPECT_EQ(0, o2.NumberOfChecks()); 3066 EXPECT_EQ(0, o2.NumberOfChecks());
3067 GrowableArray<intptr_t> classes; 3067 GrowableArray<intptr_t> classes;
3068 classes.Add(kSmiCid); 3068 classes.Add(kSmiCid);
3069 classes.Add(kSmiCid); 3069 classes.Add(kSmiCid);
3070 o2.AddCheck(classes, target1); 3070 o2.AddCheck(classes, target1);
3071 EXPECT_EQ(1, o2.NumberOfChecks()); 3071 EXPECT_EQ(1, o2.NumberOfChecks());
3072 o2.GetCheckAt(0, &test_class_ids, &test_target); 3072 o2.GetCheckAt(0, &test_class_ids, &test_target);
3073 EXPECT_EQ(2, test_class_ids.length()); 3073 EXPECT_EQ(2, test_class_ids.length());
3074 EXPECT_EQ(kSmiCid, test_class_ids[0]); 3074 EXPECT_EQ(kSmiCid, test_class_ids[0]);
3075 EXPECT_EQ(kSmiCid, test_class_ids[1]); 3075 EXPECT_EQ(kSmiCid, test_class_ids[1]);
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after
4681 String& test = String::Handle(); 4681 String& test = String::Handle();
4682 String& result = String::Handle(); 4682 String& result = String::Handle();
4683 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { 4683 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) {
4684 test = String::New(tests[i].in); 4684 test = String::New(tests[i].in);
4685 result = String::IdentifierPrettyName(test); 4685 result = String::IdentifierPrettyName(test);
4686 EXPECT_STREQ(tests[i].out, result.ToCString()); 4686 EXPECT_STREQ(tests[i].out, result.ToCString());
4687 } 4687 }
4688 } 4688 }
4689 4689
4690 } // namespace dart 4690 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698