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

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

Issue 10837303: Make stackmaps store their actual length. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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/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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 EXPECT_EQ(257, builder1->Minimum()); 68 EXPECT_EQ(257, builder1->Minimum());
69 for (int32_t i = 0; i <= 256; i++) { 69 for (int32_t i = 0; i <= 256; i++) {
70 EXPECT(!stackmap2.IsObject(i)); 70 EXPECT(!stackmap2.IsObject(i));
71 } 71 }
72 for (int32_t i = 257; i <= 1024; i++) { 72 for (int32_t i = 257; i <= 1024; i++) {
73 EXPECT(stackmap2.IsObject(i)); 73 EXPECT(stackmap2.IsObject(i));
74 } 74 }
75 for (int32_t i = 1025; i <= 2048; i++) { 75 for (int32_t i = 1025; i <= 2048; i++) {
76 EXPECT(!stackmap2.IsObject(i)); 76 EXPECT(!stackmap2.IsObject(i));
77 } 77 }
78
79 // Test the functionality to copy a Stackmap object into a builder.
80 BitmapBuilder* builder2 = new BitmapBuilder();
81 builder2->SetBits(stackmap1);
82 EXPECT_EQ(1022, builder2->Maximum());
83 EXPECT_EQ(0, builder2->Minimum());
84 value = true;
85 for (int32_t i = 0; i < 1024; i++) {
86 EXPECT_EQ(value, builder2->Get(i));
87 value = !value;
88 }
89
90 BitmapBuilder* builder3 = new BitmapBuilder();
91 builder3->SetBits(stackmap2);
92 EXPECT_EQ(1024, builder3->Maximum());
93 EXPECT_EQ(257, builder3->Minimum());
94 for (int32_t i = 0; i <= 256; i++) {
95 EXPECT(!builder3->Get(i));
96 }
97 for (int32_t i = 257; i <= 1024; i++) {
98 EXPECT(builder3->Get(i));
99 }
100 for (int32_t i = 1025; i <= 2048; i++) {
101 EXPECT(!builder3->Get(i));
102 }
103 } 78 }
104 79
105 } // namespace dart 80 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698