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

Side by Side Diff: tools/clang/blink_gc_plugin/CheckGCRootsVisitor.cpp

Issue 1385193002: Bisect clang Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 246985 Created 5 years, 2 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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "CheckGCRootsVisitor.h"
6
7 CheckGCRootsVisitor::CheckGCRootsVisitor() {
8 }
9
10 CheckGCRootsVisitor::Errors& CheckGCRootsVisitor::gc_roots() {
11 return gc_roots_;
12 }
13
14 bool CheckGCRootsVisitor::ContainsGCRoots(RecordInfo* info) {
15 for (RecordInfo::Fields::iterator it = info->GetFields().begin();
16 it != info->GetFields().end();
17 ++it) {
18 current_.push_back(&it->second);
19 it->second.edge()->Accept(this);
20 current_.pop_back();
21 }
22 return !gc_roots_.empty();
23 }
24
25 void CheckGCRootsVisitor::VisitValue(Value* edge) {
26 // TODO: what should we do to check unions?
27 if (edge->value()->record()->isUnion())
28 return;
29
30 // Prevent infinite regress for cyclic part objects.
31 if (visiting_set_.find(edge->value()) != visiting_set_.end())
32 return;
33
34 visiting_set_.insert(edge->value());
35 // If the value is a part object, then continue checking for roots.
36 for (Context::iterator it = context().begin();
37 it != context().end();
38 ++it) {
39 if (!(*it)->IsCollection())
40 return;
41 }
42 ContainsGCRoots(edge->value());
43 visiting_set_.erase(edge->value());
44 }
45
46 void CheckGCRootsVisitor::VisitPersistent(Persistent* edge) {
47 gc_roots_.push_back(current_);
48 }
49
50 void CheckGCRootsVisitor::AtCollection(Collection* edge) {
51 if (edge->is_root())
52 gc_roots_.push_back(current_);
53 }
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/CheckGCRootsVisitor.h ('k') | tools/clang/blink_gc_plugin/CheckTraceVisitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698