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

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

Issue 1838373002: Remove unnecessary isolate argument from some visitors (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup Created 4 years, 8 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
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/service.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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/scavenger.h" 6 #include "vm/scavenger.h"
7 #include "vm/unit_test.h" 7 #include "vm/unit_test.h"
8 #include "vm/visitor.h" 8 #include "vm/visitor.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 // Expects to visit no objects (since the space should be empty). 12 // Expects to visit no objects (since the space should be empty).
13 class FailingObjectVisitor : public ObjectVisitor { 13 class FailingObjectVisitor : public ObjectVisitor {
14 public: 14 public:
15 FailingObjectVisitor() : ObjectVisitor(NULL) {} 15 FailingObjectVisitor() { }
16 virtual void VisitObject(RawObject* obj) { 16 virtual void VisitObject(RawObject* obj) {
17 EXPECT(false); 17 EXPECT(false);
18 } 18 }
19 }; 19 };
20 20
21 // Expects to visit no objects (since the space should be empty). 21 // Expects to visit no objects (since the space should be empty).
22 class FailingObjectPointerVisitor : public ObjectPointerVisitor { 22 class FailingObjectPointerVisitor : public ObjectPointerVisitor {
23 public: 23 public:
24 FailingObjectPointerVisitor() : ObjectPointerVisitor(NULL) {} 24 FailingObjectPointerVisitor() : ObjectPointerVisitor(NULL) {}
25 virtual void VisitPointers(RawObject** first, RawObject** last) { 25 virtual void VisitPointers(RawObject** first, RawObject** last) {
26 EXPECT(false); 26 EXPECT(false);
27 } 27 }
28 }; 28 };
29 29
30 // Expects to visit no objects (since the space should be empty). 30 // Expects to visit no objects (since the space should be empty).
31 class FailingFindObjectVisitor : public FindObjectVisitor { 31 class FailingFindObjectVisitor : public FindObjectVisitor {
32 public: 32 public:
33 FailingFindObjectVisitor() : FindObjectVisitor(NULL) {} 33 FailingFindObjectVisitor() { }
34 virtual bool FindObject(RawObject* obj) const { 34 virtual bool FindObject(RawObject* obj) const {
35 EXPECT(false); 35 EXPECT(false);
36 return false; 36 return false;
37 } 37 }
38 }; 38 };
39 39
40 TEST_CASE(ZeroSizeScavenger) { 40 TEST_CASE(ZeroSizeScavenger) {
41 Scavenger* scavenger = new Scavenger(NULL, 0, kNewObjectAlignmentOffset); 41 Scavenger* scavenger = new Scavenger(NULL, 0, kNewObjectAlignmentOffset);
42 EXPECT(!scavenger->Contains(reinterpret_cast<uword>(&scavenger))); 42 EXPECT(!scavenger->Contains(reinterpret_cast<uword>(&scavenger)));
43 EXPECT_EQ(0, scavenger->UsedInWords()); 43 EXPECT_EQ(0, scavenger->UsedInWords());
44 EXPECT_EQ(0, scavenger->CapacityInWords()); 44 EXPECT_EQ(0, scavenger->CapacityInWords());
45 EXPECT_EQ(static_cast<uword>(0), scavenger->TryAllocate(kObjectAlignment)); 45 EXPECT_EQ(static_cast<uword>(0), scavenger->TryAllocate(kObjectAlignment));
46 FailingObjectVisitor obj_visitor; 46 FailingObjectVisitor obj_visitor;
47 scavenger->VisitObjects(&obj_visitor); 47 scavenger->VisitObjects(&obj_visitor);
48 FailingObjectPointerVisitor ptr_visitor; 48 FailingObjectPointerVisitor ptr_visitor;
49 scavenger->VisitObjectPointers(&ptr_visitor); 49 scavenger->VisitObjectPointers(&ptr_visitor);
50 FailingFindObjectVisitor find_visitor; 50 FailingFindObjectVisitor find_visitor;
51 scavenger->FindObject(&find_visitor); 51 scavenger->FindObject(&find_visitor);
52 delete scavenger; 52 delete scavenger;
53 } 53 }
54 54
55 } // namespace dart 55 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/profiler.cc ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698