Commit f1e3051e authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[inspector] consider object with embedder fields as non-temporary

Embedder may implement any non trivial logic using embedder fields,
e.g. creates wrappers lazily and store native pointer to native object
inside embedder fields.

R=yangguo@chromium.org

Bug: v8:7588
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: Id14eb6e686f8945cb350cfe77e8a4b3c52c5ec5b
Reviewed-on: https://chromium-review.googlesource.com/1013404Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52741}
parent dcf0456c
......@@ -59,8 +59,16 @@ class Debug::TemporaryObjectsTracker : public HeapObjectAllocationTracker {
objects_.insert(to);
}
bool HasObject(Address addr) const {
return objects_.find(addr) != objects_.end();
bool HasObject(Handle<HeapObject> obj) const {
if (obj->IsJSObject() &&
Handle<JSObject>::cast(obj)->GetEmbedderFieldCount()) {
// Embedder may store any pointers using embedder fields and implements
// non trivial logic, e.g. create wrappers lazily and store pointer to
// native object inside embedder field. We should consider all objects
// with embedder fields as non temporary.
return false;
}
return objects_.find(obj->address()) != objects_.end();
}
private:
......@@ -2462,8 +2470,7 @@ bool Debug::PerformSideEffectCheckForObject(Handle<Object> object) {
DCHECK_EQ(isolate_->debug_execution_mode(), DebugInfo::kSideEffects);
if (object->IsHeapObject()) {
Address address = Handle<HeapObject>::cast(object)->address();
if (temporary_objects_->HasObject(address)) {
if (temporary_objects_->HasObject(Handle<HeapObject>::cast(object))) {
return true;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment