Commit 9e3af5a4 authored by alph@chromium.org's avatar alph@chromium.org

Add global_context field to GlobalObject in heap profiler.

LOG=N
R=ulan@chromium.org, yurys@chromium.org

Review URL: https://codereview.chromium.org/143263015

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18942 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a1f55c10
......@@ -1131,9 +1131,14 @@ void V8HeapExplorer::ExtractJSObjectReferences(
SetInternalReference(global_obj, entry,
"native_context", global_obj->native_context(),
GlobalObject::kNativeContextOffset);
SetInternalReference(global_obj, entry,
"global_context", global_obj->global_context(),
GlobalObject::kGlobalContextOffset);
SetInternalReference(global_obj, entry,
"global_receiver", global_obj->global_receiver(),
GlobalObject::kGlobalReceiverOffset);
STATIC_CHECK(GlobalObject::kHeaderSize - JSObject::kHeaderSize ==
4 * kPointerSize);
} else if (obj->IsJSArrayBufferView()) {
JSArrayBufferView* view = JSArrayBufferView::cast(obj);
SetInternalReference(view, entry, "buffer", view->buffer(),
......
......@@ -1537,6 +1537,30 @@ TEST(GlobalObjectName) {
}
TEST(GlobalObjectFields) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
CompileRun("obj = {};");
const v8::HeapSnapshot* snapshot =
heap_profiler->TakeHeapSnapshot(v8_str("snapshot"));
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
const v8::HeapGraphNode* builtins =
GetProperty(global, v8::HeapGraphEdge::kInternal, "builtins");
CHECK_NE(NULL, builtins);
const v8::HeapGraphNode* native_context =
GetProperty(global, v8::HeapGraphEdge::kInternal, "native_context");
CHECK_NE(NULL, native_context);
const v8::HeapGraphNode* global_context =
GetProperty(global, v8::HeapGraphEdge::kInternal, "global_context");
CHECK_NE(NULL, global_context);
const v8::HeapGraphNode* global_receiver =
GetProperty(global, v8::HeapGraphEdge::kInternal, "global_receiver");
CHECK_NE(NULL, global_receiver);
}
TEST(NoHandleLeaks) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
......
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