OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1953 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); | 1953 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); |
1954 CHECK(ValidateSnapshot(snapshot)); | 1954 CHECK(ValidateSnapshot(snapshot)); |
1955 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); | 1955 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
1956 const v8::HeapGraphNode* foo_func = | 1956 const v8::HeapGraphNode* foo_func = |
1957 GetProperty(global, v8::HeapGraphEdge::kProperty, "foo"); | 1957 GetProperty(global, v8::HeapGraphEdge::kProperty, "foo"); |
1958 CHECK_NE(NULL, foo_func); | 1958 CHECK_NE(NULL, foo_func); |
1959 const v8::HeapGraphNode* code = | 1959 const v8::HeapGraphNode* code = |
1960 GetProperty(foo_func, v8::HeapGraphEdge::kInternal, "code"); | 1960 GetProperty(foo_func, v8::HeapGraphEdge::kInternal, "code"); |
1961 CHECK_NE(NULL, code); | 1961 CHECK_NE(NULL, code); |
1962 } | 1962 } |
| 1963 |
| 1964 |
| 1965 // This is an example of using checking of JS allocations tracking in a test. |
| 1966 TEST_TRACK_ALLOCATIONS(HeapObjectsTracker) { |
| 1967 v8::HandleScope scope; |
| 1968 LocalContext env; |
| 1969 CompileRun("var a = 1.2"); |
| 1970 CompileRun("var a = 1.2; var b = 1.0; var c = 1.0;"); |
| 1971 CompileRun( |
| 1972 "var a = [];" |
| 1973 "for (var i = 0; i < 5; ++i)" |
| 1974 " a[i] = i;\n" |
| 1975 "for (var i = 0; i < 3; ++i)" |
| 1976 " a.shift();\n" |
| 1977 ); |
| 1978 } |
OLD | NEW |