Commit 18e865d4 authored by yurys@chromium.org's avatar yurys@chromium.org

Delete v8::HeapGraphNode::GetHeapValue

BUG=chromium:324769
LOG=N
R=hpayer@chromium.org, mstarzinger@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18404 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3b0f6c8e
......@@ -264,12 +264,6 @@ class V8_EXPORT HeapGraphNode {
/** Retrieves a child by index. */
const HeapGraphEdge* GetChild(int index) const;
/**
* Finds and returns a value from the heap corresponding to this node,
* if the value is still reachable.
*/
Handle<Value> GetHeapValue() const;
};
......
......@@ -7137,15 +7137,6 @@ const HeapGraphEdge* HeapGraphNode::GetChild(int index) const {
}
v8::Handle<v8::Value> HeapGraphNode::GetHeapValue() const {
i::Isolate* isolate = i::Isolate::Current();
i::Handle<i::HeapObject> object = ToInternal(this)->GetHeapObject();
return !object.is_null() ?
ToApiHandle<Value>(object) :
ToApiHandle<Value>(isolate->factory()->undefined_value());
}
static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) {
return const_cast<i::HeapSnapshot*>(
reinterpret_cast<const i::HeapSnapshot*>(snapshot));
......
......@@ -99,11 +99,6 @@ void HeapEntry::SetIndexedReference(HeapGraphEdge::Type type,
}
Handle<HeapObject> HeapEntry::GetHeapObject() {
return snapshot_->profiler()->FindHeapObjectById(id());
}
void HeapEntry::Print(
const char* prefix, const char* edge_name, int max_depth, int indent) {
STATIC_CHECK(sizeof(unsigned) == sizeof(id()));
......
......@@ -138,8 +138,6 @@ class HeapEntry BASE_EMBEDDED {
void Print(
const char* prefix, const char* edge_name, int max_depth, int indent);
Handle<HeapObject> GetHeapObject();
private:
INLINE(HeapGraphEdge** children_arr());
const char* TypeAsString();
......
......@@ -1562,7 +1562,7 @@ TEST(NodesIteration) {
}
TEST(GetHeapValue) {
TEST(GetHeapValueForNode) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
......@@ -1572,25 +1572,26 @@ TEST(GetHeapValue) {
heap_profiler->TakeHeapSnapshot(v8_str("value"));
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
CHECK(global->GetHeapValue()->IsObject());
CHECK(heap_profiler->FindObjectById(global->GetId())->IsObject());
v8::Local<v8::Object> js_global =
env->Global()->GetPrototype().As<v8::Object>();
CHECK(js_global == global->GetHeapValue());
CHECK(js_global == heap_profiler->FindObjectById(global->GetId()));
const v8::HeapGraphNode* obj = GetProperty(
global, v8::HeapGraphEdge::kProperty, "a");
CHECK(obj->GetHeapValue()->IsObject());
CHECK(heap_profiler->FindObjectById(obj->GetId())->IsObject());
v8::Local<v8::Object> js_obj = js_global->Get(v8_str("a")).As<v8::Object>();
CHECK(js_obj == obj->GetHeapValue());
CHECK(js_obj == heap_profiler->FindObjectById(obj->GetId()));
const v8::HeapGraphNode* s_prop =
GetProperty(obj, v8::HeapGraphEdge::kProperty, "s_prop");
v8::Local<v8::String> js_s_prop =
js_obj->Get(v8_str("s_prop")).As<v8::String>();
CHECK(js_s_prop == s_prop->GetHeapValue());
CHECK(js_s_prop == heap_profiler->FindObjectById(s_prop->GetId()));
const v8::HeapGraphNode* n_prop =
GetProperty(obj, v8::HeapGraphEdge::kProperty, "n_prop");
v8::Local<v8::Number> js_n_prop =
js_obj->Get(v8_str("n_prop")).As<v8::Number>();
CHECK(js_n_prop->NumberValue() == n_prop->GetHeapValue()->NumberValue());
CHECK(js_n_prop->NumberValue() ==
heap_profiler->FindObjectById(n_prop->GetId())->NumberValue());
}
......@@ -1615,10 +1616,10 @@ TEST(GetHeapValueForDeletedObject) {
// Perform the check inside a nested local scope to avoid creating a
// reference to the object we are deleting.
v8::HandleScope scope(env->GetIsolate());
CHECK(prop->GetHeapValue()->IsObject());
CHECK(heap_profiler->FindObjectById(prop->GetId())->IsObject());
}
CompileRun("delete a.p;");
CHECK(prop->GetHeapValue()->IsUndefined());
CHECK(heap_profiler->FindObjectById(prop->GetId()).IsEmpty());
}
......@@ -2032,9 +2033,10 @@ TEST(AllocationSitesAreVisible) {
CHECK_EQ(v8::HeapGraphNode::kArray, elements->GetType());
CHECK_EQ(v8::internal::FixedArray::SizeFor(3), elements->GetSelfSize());
CHECK(transition_info->GetHeapValue()->IsArray());
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(
transition_info->GetHeapValue());
v8::Handle<v8::Value> array_val =
heap_profiler->FindObjectById(transition_info->GetId());
CHECK(array_val->IsArray());
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(array_val);
// Verify the array is "a" in the code above.
CHECK_EQ(3, array->Length());
CHECK_EQ(v8::Integer::New(3), array->Get(v8::Integer::New(0)));
......
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