Chromium Code Reviews| 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 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1998 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); | 1998 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); |
| 1999 CHECK(ValidateSnapshot(snapshot)); | 1999 CHECK(ValidateSnapshot(snapshot)); |
| 2000 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); | 2000 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
| 2001 const v8::HeapGraphNode* foo_func = | 2001 const v8::HeapGraphNode* foo_func = |
| 2002 GetProperty(global, v8::HeapGraphEdge::kProperty, "foo"); | 2002 GetProperty(global, v8::HeapGraphEdge::kProperty, "foo"); |
| 2003 CHECK_NE(NULL, foo_func); | 2003 CHECK_NE(NULL, foo_func); |
| 2004 const v8::HeapGraphNode* code = | 2004 const v8::HeapGraphNode* code = |
| 2005 GetProperty(foo_func, v8::HeapGraphEdge::kInternal, "code"); | 2005 GetProperty(foo_func, v8::HeapGraphEdge::kInternal, "code"); |
| 2006 CHECK_NE(NULL, code); | 2006 CHECK_NE(NULL, code); |
| 2007 } | 2007 } |
| 2008 | |
| 2009 | |
| 2010 // This is an example of using checking of JS allocations tracking in a test. | |
|
Hannes Payer (out of office)
2013/10/02 18:00:29
Either remove the test if it is not testing anythi
Alexandra Mikhaylova
2013/10/03 16:27:55
This test checks that we don't miss some simplest
Hannes Payer (out of office)
2013/10/10 18:54:40
Sure, but wouldn't it make sense to check which ob
| |
| 2011 TEST(HeapObjectsTracker) { | |
| 2012 LocalContext env; | |
| 2013 v8::HandleScope scope(env->GetIsolate()); | |
| 2014 HeapObjectsTracker tracker; | |
| 2015 CompileRun("var a = 1.2"); | |
| 2016 CompileRun("var a = 1.2; var b = 1.0; var c = 1.0;"); | |
| 2017 CompileRun( | |
| 2018 "var a = [];" | |
| 2019 "for (var i = 0; i < 5; ++i)" | |
| 2020 " a[i] = i;\n" | |
| 2021 "for (var i = 0; i < 3; ++i)" | |
| 2022 " a.shift();\n" | |
| 2023 ); | |
| 2024 } | |
| OLD | NEW |