| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "CheckFieldsVisitor.h" | 5 #include "CheckFieldsVisitor.h" |
| 6 | 6 |
| 7 #include <cassert> | 7 #include <cassert> |
| 8 | 8 |
| 9 #include "BlinkGCPluginOptions.h" | 9 #include "BlinkGCPluginOptions.h" |
| 10 #include "RecordInfo.h" | 10 #include "RecordInfo.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // A member is allowed to appear in the context of a root. | 40 // A member is allowed to appear in the context of a root. |
| 41 for (Context::iterator it = context().begin(); | 41 for (Context::iterator it = context().begin(); |
| 42 it != context().end(); | 42 it != context().end(); |
| 43 ++it) { | 43 ++it) { |
| 44 if ((*it)->Kind() == Edge::kRoot) | 44 if ((*it)->Kind() == Edge::kRoot) |
| 45 return; | 45 return; |
| 46 } | 46 } |
| 47 invalid_fields_.push_back(std::make_pair(current_, kMemberInUnmanaged)); | 47 invalid_fields_.push_back(std::make_pair(current_, kMemberInUnmanaged)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void CheckFieldsVisitor::AtIterator(Iterator* edge) { |
| 51 if (!managed_host_) |
| 52 return; |
| 53 |
| 54 if (edge->IsUnsafe()) |
| 55 invalid_fields_.push_back(std::make_pair(current_, kIteratorToGCManaged)); |
| 56 } |
| 57 |
| 50 void CheckFieldsVisitor::AtValue(Value* edge) { | 58 void CheckFieldsVisitor::AtValue(Value* edge) { |
| 51 // TODO: what should we do to check unions? | 59 // TODO: what should we do to check unions? |
| 52 if (edge->value()->record()->isUnion()) | 60 if (edge->value()->record()->isUnion()) |
| 53 return; | 61 return; |
| 54 | 62 |
| 55 if (!stack_allocated_host_ && edge->value()->IsStackAllocated()) { | 63 if (!stack_allocated_host_ && edge->value()->IsStackAllocated()) { |
| 56 invalid_fields_.push_back(std::make_pair(current_, kPtrFromHeapToStack)); | 64 invalid_fields_.push_back(std::make_pair(current_, kPtrFromHeapToStack)); |
| 57 return; | 65 return; |
| 58 } | 66 } |
| 59 | 67 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 return kRawPtrToGCManaged; | 124 return kRawPtrToGCManaged; |
| 117 } | 125 } |
| 118 if (ptr->IsRefPtr()) | 126 if (ptr->IsRefPtr()) |
| 119 return kRefPtrToGCManaged; | 127 return kRefPtrToGCManaged; |
| 120 if (ptr->IsOwnPtr()) | 128 if (ptr->IsOwnPtr()) |
| 121 return kOwnPtrToGCManaged; | 129 return kOwnPtrToGCManaged; |
| 122 if (ptr->IsUniquePtr()) | 130 if (ptr->IsUniquePtr()) |
| 123 return kUniquePtrToGCManaged; | 131 return kUniquePtrToGCManaged; |
| 124 assert(false && "Unknown smart pointer kind"); | 132 assert(false && "Unknown smart pointer kind"); |
| 125 } | 133 } |
| OLD | NEW |