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

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

Issue 2572563004: Improve the casing of Stackmap and Stacktrace. (Closed)
Patch Set: Build fixes Created 4 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/bitmap.h ('k') | runtime/vm/clustered_snapshot.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/bitmap.h" 6 #include "vm/bitmap.h"
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 18 matching lines...) Expand all
29 for (int32_t i = 0; i < 1024; i++) { 29 for (int32_t i = 0; i < 1024; i++) {
30 builder1->Set(i, value); 30 builder1->Set(i, value);
31 value = !value; 31 value = !value;
32 } 32 }
33 EXPECT_EQ(1024, builder1->Length()); 33 EXPECT_EQ(1024, builder1->Length());
34 value = true; 34 value = true;
35 for (int32_t i = 0; i < 1024; i++) { 35 for (int32_t i = 0; i < 1024; i++) {
36 EXPECT_EQ(value, builder1->Get(i)); 36 EXPECT_EQ(value, builder1->Get(i));
37 value = !value; 37 value = !value;
38 } 38 }
39 // Create a Stackmap object from the builder and verify its contents. 39 // Create a StackMap object from the builder and verify its contents.
40 const Stackmap& stackmap1 = Stackmap::Handle(Stackmap::New(0, builder1, 0)); 40 const StackMap& stackmap1 = StackMap::Handle(StackMap::New(0, builder1, 0));
41 EXPECT_EQ(1024, stackmap1.Length()); 41 EXPECT_EQ(1024, stackmap1.Length());
42 OS::Print("%s\n", stackmap1.ToCString()); 42 OS::Print("%s\n", stackmap1.ToCString());
43 value = true; 43 value = true;
44 for (int32_t i = 0; i < 1024; i++) { 44 for (int32_t i = 0; i < 1024; i++) {
45 EXPECT_EQ(value, stackmap1.IsObject(i)); 45 EXPECT_EQ(value, stackmap1.IsObject(i));
46 value = !value; 46 value = !value;
47 } 47 }
48 48
49 // Test the SetRange function in the builder. 49 // Test the SetRange function in the builder.
50 builder1->SetRange(0, 256, false); 50 builder1->SetRange(0, 256, false);
51 EXPECT_EQ(1024, builder1->Length()); 51 EXPECT_EQ(1024, builder1->Length());
52 builder1->SetRange(257, 1024, true); 52 builder1->SetRange(257, 1024, true);
53 EXPECT_EQ(1025, builder1->Length()); 53 EXPECT_EQ(1025, builder1->Length());
54 builder1->SetRange(1025, 2048, false); 54 builder1->SetRange(1025, 2048, false);
55 EXPECT_EQ(2049, builder1->Length()); 55 EXPECT_EQ(2049, builder1->Length());
56 for (int32_t i = 0; i <= 256; i++) { 56 for (int32_t i = 0; i <= 256; i++) {
57 EXPECT(!builder1->Get(i)); 57 EXPECT(!builder1->Get(i));
58 } 58 }
59 for (int32_t i = 257; i <= 1024; i++) { 59 for (int32_t i = 257; i <= 1024; i++) {
60 EXPECT(builder1->Get(i)); 60 EXPECT(builder1->Get(i));
61 } 61 }
62 for (int32_t i = 1025; i <= 2048; i++) { 62 for (int32_t i = 1025; i <= 2048; i++) {
63 EXPECT(!builder1->Get(i)); 63 EXPECT(!builder1->Get(i));
64 } 64 }
65 const Stackmap& stackmap2 = Stackmap::Handle(Stackmap::New(0, builder1, 0)); 65 const StackMap& stackmap2 = StackMap::Handle(StackMap::New(0, builder1, 0));
66 EXPECT_EQ(2049, stackmap2.Length()); 66 EXPECT_EQ(2049, stackmap2.Length());
67 for (int32_t i = 0; i <= 256; i++) { 67 for (int32_t i = 0; i <= 256; i++) {
68 EXPECT(!stackmap2.IsObject(i)); 68 EXPECT(!stackmap2.IsObject(i));
69 } 69 }
70 for (int32_t i = 257; i <= 1024; i++) { 70 for (int32_t i = 257; i <= 1024; i++) {
71 EXPECT(stackmap2.IsObject(i)); 71 EXPECT(stackmap2.IsObject(i));
72 } 72 }
73 for (int32_t i = 1025; i <= 2048; i++) { 73 for (int32_t i = 1025; i <= 2048; i++) {
74 EXPECT(!stackmap2.IsObject(i)); 74 EXPECT(!stackmap2.IsObject(i));
75 } 75 }
(...skipping 19 matching lines...) Expand all
95 for (int32_t i = 257; i < 747; ++i) { 95 for (int32_t i = 257; i < 747; ++i) {
96 EXPECT(builder1->Get(i)); 96 EXPECT(builder1->Get(i));
97 } 97 }
98 for (int32_t i = 747; i < 900; ++i) { 98 for (int32_t i = 747; i < 900; ++i) {
99 EXPECT(!builder1->Get(i)); 99 EXPECT(!builder1->Get(i));
100 } 100 }
101 EXPECT(builder1->Get(900)); 101 EXPECT(builder1->Get(900));
102 } 102 }
103 103
104 } // namespace dart 104 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/bitmap.h ('k') | runtime/vm/clustered_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698