OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Tests for heap profiler | 3 // Tests for heap profiler |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "cctest.h" | 7 #include "cctest.h" |
8 #include "heap-profiler.h" | 8 #include "heap-profiler.h" |
9 #include "snapshot.h" | 9 #include "snapshot.h" |
10 #include "utils-inl.h" | 10 #include "utils-inl.h" |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 int count = 0; | 885 int count = 0; |
886 for (int i = 0; i < nodes_count; ++i) { | 886 for (int i = 0; i < nodes_count; ++i) { |
887 if (snapshot->GetNode(i) == global) | 887 if (snapshot->GetNode(i) == global) |
888 ++count; | 888 ++count; |
889 } | 889 } |
890 CHECK_EQ(1, count); | 890 CHECK_EQ(1, count); |
891 } | 891 } |
892 | 892 |
893 | 893 |
894 static int StringCmp(const char* ref, i::String* act) { | 894 static int StringCmp(const char* ref, i::String* act) { |
895 i::SmartPointer<char> s_act = act->ToCString(); | 895 i::SmartArrayPointer<char> s_act = act->ToCString(); |
896 int result = strcmp(ref, *s_act); | 896 int result = strcmp(ref, *s_act); |
897 if (result != 0) | 897 if (result != 0) |
898 fprintf(stderr, "Expected: \"%s\", Actual: \"%s\"\n", ref, *s_act); | 898 fprintf(stderr, "Expected: \"%s\", Actual: \"%s\"\n", ref, *s_act); |
899 return result; | 899 return result; |
900 } | 900 } |
901 | 901 |
902 | 902 |
903 TEST(GetConstructorName) { | 903 TEST(GetConstructorName) { |
904 v8::HandleScope scope; | 904 v8::HandleScope scope; |
905 LocalContext env; | 905 LocalContext env; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 "Constructor4", i::V8HeapExplorer::GetConstructorName(*js_obj4))); | 938 "Constructor4", i::V8HeapExplorer::GetConstructorName(*js_obj4))); |
939 v8::Local<v8::Object> obj5 = js_global->Get(v8_str("obj5")).As<v8::Object>(); | 939 v8::Local<v8::Object> obj5 = js_global->Get(v8_str("obj5")).As<v8::Object>(); |
940 i::Handle<i::JSObject> js_obj5 = v8::Utils::OpenHandle(*obj5); | 940 i::Handle<i::JSObject> js_obj5 = v8::Utils::OpenHandle(*obj5); |
941 CHECK_EQ(0, StringCmp( | 941 CHECK_EQ(0, StringCmp( |
942 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj5))); | 942 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj5))); |
943 v8::Local<v8::Object> obj6 = js_global->Get(v8_str("obj6")).As<v8::Object>(); | 943 v8::Local<v8::Object> obj6 = js_global->Get(v8_str("obj6")).As<v8::Object>(); |
944 i::Handle<i::JSObject> js_obj6 = v8::Utils::OpenHandle(*obj6); | 944 i::Handle<i::JSObject> js_obj6 = v8::Utils::OpenHandle(*obj6); |
945 CHECK_EQ(0, StringCmp( | 945 CHECK_EQ(0, StringCmp( |
946 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj6))); | 946 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj6))); |
947 } | 947 } |
OLD | NEW |