[heap profiler] Use internal type links for bound this and target function.

These are internal fields of the JSBoundFunction class.

Review-Url: https://codereview.chromium.org/2193993002
Cr-Commit-Position: refs/heads/master@{#38222}
This commit is contained in:
alph 2016-08-01 15:15:19 -07:00 committed by Commit bot
parent 282cdf28ae
commit 1fe8207071
2 changed files with 9 additions and 7 deletions

View File

@ -1089,9 +1089,11 @@ void V8HeapExplorer::ExtractJSObjectReferences(
TagObject(js_fun->bound_arguments(), "(bound arguments)");
SetInternalReference(js_fun, entry, "bindings", js_fun->bound_arguments(),
JSBoundFunction::kBoundArgumentsOffset);
SetNativeBindReference(js_obj, entry, "bound_this", js_fun->bound_this());
SetNativeBindReference(js_obj, entry, "bound_function",
js_fun->bound_target_function());
SetInternalReference(js_obj, entry, "bound_this", js_fun->bound_this(),
JSBoundFunction::kBoundThisOffset);
SetInternalReference(js_obj, entry, "bound_function",
js_fun->bound_target_function(),
JSBoundFunction::kBoundTargetFunctionOffset);
FixedArray* bindings = js_fun->bound_arguments();
for (int i = 0; i < bindings->length(); i++) {
const char* reference_name = names_->GetFormatted("bound_argument_%d", i);

View File

@ -256,13 +256,13 @@ TEST(BoundFunctionInSnapshot) {
CHECK_EQ(v8::HeapGraphNode::kArray, bindings->GetType());
CHECK_EQ(1, bindings->GetChildrenCount());
const v8::HeapGraphNode* bound_this = GetProperty(
f, v8::HeapGraphEdge::kShortcut, "bound_this");
const v8::HeapGraphNode* bound_this =
GetProperty(f, v8::HeapGraphEdge::kInternal, "bound_this");
CHECK(bound_this);
CHECK_EQ(v8::HeapGraphNode::kObject, bound_this->GetType());
const v8::HeapGraphNode* bound_function = GetProperty(
f, v8::HeapGraphEdge::kShortcut, "bound_function");
const v8::HeapGraphNode* bound_function =
GetProperty(f, v8::HeapGraphEdge::kInternal, "bound_function");
CHECK(bound_function);
CHECK_EQ(v8::HeapGraphNode::kClosure, bound_function->GetType());