Chromium Code Reviews| 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 9072d0340ef327bcea54591863a343bd4f6c112f..6fa2474b40a387fec1d5a9a49b7c67cc4eb5a440 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_(kMaybe), |
|
Mads Ager (chromium)
2014/03/20 10:32:29
Wasn't it called kNone in the enum? This is really
zerny-chromium
2014/03/20 15:14:20
Done.
|
| determined_trace_methods_(false), |
| trace_method_(0), |
| trace_dispatch_method_(0), |
| @@ -151,17 +152,26 @@ 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_ == kNone) { |
| + is_stack_allocated_ = kFalse; |
| + 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(); |
| } |