Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: test/cctest/test-heap-profiler.cc

Issue 2173403002: Replace SmartArrayPointer<T> with unique_ptr<T[]> (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/test-func-name-inference.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 // 27 //
28 // Tests for heap profiler 28 // Tests for heap profiler
29 29
30 #include <ctype.h> 30 #include <ctype.h>
31 31
32 #include <memory>
33
32 #include "src/v8.h" 34 #include "src/v8.h"
33 35
34 #include "include/v8-profiler.h" 36 #include "include/v8-profiler.h"
35 #include "src/base/hashmap.h" 37 #include "src/base/hashmap.h"
36 #include "src/collector.h" 38 #include "src/collector.h"
37 #include "src/debug/debug.h" 39 #include "src/debug/debug.h"
38 #include "src/profiler/allocation-tracker.h" 40 #include "src/profiler/allocation-tracker.h"
39 #include "src/profiler/heap-profiler.h" 41 #include "src/profiler/heap-profiler.h"
40 #include "src/profiler/heap-snapshot-generator-inl.h" 42 #include "src/profiler/heap-snapshot-generator-inl.h"
41 #include "test/cctest/cctest.h" 43 #include "test/cctest/cctest.h"
(...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 // reference to the object we are deleting. 1825 // reference to the object we are deleting.
1824 v8::HandleScope scope(env->GetIsolate()); 1826 v8::HandleScope scope(env->GetIsolate());
1825 CHECK(heap_profiler->FindObjectById(prop->GetId())->IsObject()); 1827 CHECK(heap_profiler->FindObjectById(prop->GetId())->IsObject());
1826 } 1828 }
1827 CompileRun("delete a.p;"); 1829 CompileRun("delete a.p;");
1828 CHECK(heap_profiler->FindObjectById(prop->GetId()).IsEmpty()); 1830 CHECK(heap_profiler->FindObjectById(prop->GetId()).IsEmpty());
1829 } 1831 }
1830 1832
1831 1833
1832 static int StringCmp(const char* ref, i::String* act) { 1834 static int StringCmp(const char* ref, i::String* act) {
1833 v8::base::SmartArrayPointer<char> s_act = act->ToCString(); 1835 std::unique_ptr<char[]> s_act = act->ToCString();
1834 int result = strcmp(ref, s_act.get()); 1836 int result = strcmp(ref, s_act.get());
1835 if (result != 0) 1837 if (result != 0)
1836 fprintf(stderr, "Expected: \"%s\", Actual: \"%s\"\n", ref, s_act.get()); 1838 fprintf(stderr, "Expected: \"%s\", Actual: \"%s\"\n", ref, s_act.get());
1837 return result; 1839 return result;
1838 } 1840 }
1839 1841
1840 1842
1841 TEST(GetConstructorName) { 1843 TEST(GetConstructorName) {
1842 LocalContext env; 1844 LocalContext env;
1843 v8::HandleScope scope(env->GetIsolate()); 1845 v8::HandleScope scope(env->GetIsolate());
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
3048 " a[i] = i;\n" 3050 " a[i] = i;\n"
3049 " for (var i = 0; i < 3; ++i)\n" 3051 " for (var i = 0; i < 3; ++i)\n"
3050 " a.shift();\n" 3052 " a.shift();\n"
3051 "}\n"); 3053 "}\n");
3052 3054
3053 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); 3055 CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
3054 // Should not crash. 3056 // Should not crash.
3055 3057
3056 heap_profiler->StopSamplingHeapProfiler(); 3058 heap_profiler->StopSamplingHeapProfiler();
3057 } 3059 }
OLDNEW
« no previous file with comments | « test/cctest/test-func-name-inference.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698