| Index: test/cctest/test-heap-profiler.cc
|
| diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
|
| index 59f7a258b1094fa5a0ddb2b2e42a2170f2560f55..6b452960b5ecb3c6746459583213b4e6e653ead3 100644
|
| --- a/test/cctest/test-heap-profiler.cc
|
| +++ b/test/cctest/test-heap-profiler.cc
|
| @@ -2005,3 +2005,19 @@ TEST(JSFunctionHasCodeLink) {
|
| GetProperty(foo_func, v8::HeapGraphEdge::kInternal, "code");
|
| CHECK_NE(NULL, code);
|
| }
|
| +
|
| +
|
| +// This is an example of using checking of JS allocations tracking in a test.
|
| +TEST(HeapObjectsTracker) {
|
| + LocalContext env;
|
| + v8::HandleScope scope(env->GetIsolate());
|
| + HeapObjectsTracker tracker;
|
| + CompileRun("var a = 1.2");
|
| + CompileRun("var a = 1.2; var b = 1.0; var c = 1.0;");
|
| + CompileRun(
|
| + "var a = [];"
|
| + "for (var i = 0; i < 5; ++i)"
|
| + " a[i] = i;\n"
|
| + "for (var i = 0; i < 3; ++i)"
|
| + " a.shift();\n");
|
| +}
|
|
|