}
-TEST(GetHeapValue) {
+TEST(GetHeapValueForNode) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
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());
}
// 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());
}
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)));