Reviewers: alph, loislo, Hannes Payer, Michael Starzinger,

Description:
Deprecate v8::HeapGraphNode::GetHeapValue

BUG=chromium:324769
LOG=N

Please review this at https://codereview.chromium.org/98633009/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+16, -13 lines):
  M include/v8-profiler.h
  M test/cctest/test-heap-profiler.cc


Index: include/v8-profiler.h
diff --git a/include/v8-profiler.h b/include/v8-profiler.h
index db3c0b7928faafa918cc88c76877c0f53f8ae538..368b419cc00fbff1b793854e5e93f595bac8b2a4 100644
--- a/include/v8-profiler.h
+++ b/include/v8-profiler.h
@@ -292,7 +292,8 @@ class V8_EXPORT HeapGraphNode {
    * Finds and returns a value from the heap corresponding to this node,
    * if the value is still reachable.
    */
-  Handle<Value> GetHeapValue() const;
+  V8_DEPRECATED("Use HeapProfiler::FindObjectById instead",
+                Handle<Value> GetHeapValue() const);
 };


Index: test/cctest/test-heap-profiler.cc
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc index 33338a97c629fb30c670dee5cede487dd0c7f431..ba5c588d66638a0e745256979f9ee230c0fb5920 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -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)));


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to