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

Unified Diff: tools/clang/blink_gc_plugin/RecordInfo.cpp

Issue 206123004: Add checks for stack-allocated types and their uses in fields. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/clang/blink_gc_plugin/RecordInfo.h ('k') | tools/clang/blink_gc_plugin/tests/heap/stubs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/blink_gc_plugin/RecordInfo.cpp
diff --git a/tools/clang/blink_gc_plugin/RecordInfo.cpp b/tools/clang/blink_gc_plugin/RecordInfo.cpp
index ceafa36f8b5363ff82d03bd3e97dc4a1fa26cf19..1a82206904cc32c4762dce91422e76749d1c4613 100644
--- a/tools/clang/blink_gc_plugin/RecordInfo.cpp
+++ b/tools/clang/blink_gc_plugin/RecordInfo.cpp
@@ -17,6 +17,7 @@ RecordInfo::RecordInfo(CXXRecordDecl* record, RecordCache* cache)
fields_need_tracing_(TracingStatus::Unknown()),
bases_(0),
fields_(0),
+ is_stack_allocated_(kNotComputed),
determined_trace_methods_(false),
trace_method_(0),
trace_dispatch_method_(0),
@@ -152,17 +153,34 @@ RecordInfo* RecordCache::Lookup(CXXRecordDecl* record) {
}
bool RecordInfo::IsStackAllocated() {
- for (CXXRecordDecl::method_iterator it = record_->method_begin();
- it != record_->method_end();
- ++it) {
- if (it->getNameAsString() == kNewOperatorName)
- return it->isDeleted() && IsAnnotated(*it, "blink_stack_allocated");
+ if (is_stack_allocated_ == kNotComputed) {
+ is_stack_allocated_ = kFalse;
+ for (Bases::iterator it = GetBases().begin();
+ it != GetBases().end();
+ ++it) {
+ if (it->second.info()->IsStackAllocated()) {
+ is_stack_allocated_ = kTrue;
+ break;
+ }
+ }
+ for (CXXRecordDecl::method_iterator it = record_->method_begin();
+ it != record_->method_end();
+ ++it) {
+ if (it->getNameAsString() == kNewOperatorName) {
+ if (it->isDeleted() && IsAnnotated(*it, "blink_stack_allocated")) {
+ is_stack_allocated_ = kTrue;
+ break;
+ }
+ }
+ }
}
- return false;
+ return is_stack_allocated_;
}
// An object requires a tracing method if it has any fields that need tracing.
bool RecordInfo::RequiresTraceMethod() {
+ if (IsStackAllocated())
+ return false;
GetFields();
return fields_need_tracing_.IsNeeded();
}
« no previous file with comments | « tools/clang/blink_gc_plugin/RecordInfo.h ('k') | tools/clang/blink_gc_plugin/tests/heap/stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698