summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-heap-profiler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/cctest/test-heap-profiler.cc')
-rw-r--r--deps/v8/test/cctest/test-heap-profiler.cc50
1 files changed, 42 insertions, 8 deletions
diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc
index 4416f38973..f4c8c1a486 100644
--- a/deps/v8/test/cctest/test-heap-profiler.cc
+++ b/deps/v8/test/cctest/test-heap-profiler.cc
@@ -33,9 +33,10 @@
#include "include/v8-profiler.h"
#include "src/allocation-tracker.h"
-#include "src/debug.h"
+#include "src/debug/debug.h"
#include "src/hashmap.h"
#include "src/heap-profiler.h"
+#include "src/heap-snapshot-generator-inl.h"
#include "test/cctest/cctest.h"
using i::AllocationTraceNode;
@@ -95,10 +96,11 @@ class NamedEntriesDetector {
static const v8::HeapGraphNode* GetGlobalObject(
const v8::HeapSnapshot* snapshot) {
- CHECK_EQ(2, snapshot->GetRoot()->GetChildrenCount());
- // The 0th-child is (GC Roots), 1st is the user root.
+ CHECK_EQ(3, snapshot->GetRoot()->GetChildrenCount());
+ // The 0th-child is (GC Roots), 1st is code stubs context, 2nd is the user
+ // root.
const v8::HeapGraphNode* global_obj =
- snapshot->GetRoot()->GetChild(1)->GetToNode();
+ snapshot->GetRoot()->GetChild(2)->GetToNode();
CHECK_EQ(0, strncmp("Object", const_cast<i::HeapEntry*>(
reinterpret_cast<const i::HeapEntry*>(global_obj))->name(), 6));
return global_obj;
@@ -481,6 +483,34 @@ TEST(HeapSnapshotSymbol) {
}
+void CheckSimdSnapshot(const char* program, const char* var_name) {
+ i::FLAG_harmony_simd = true;
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+
+ CompileRun(program);
+ const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot();
+ CHECK(ValidateSnapshot(snapshot));
+ const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
+ const v8::HeapGraphNode* var =
+ GetProperty(global, v8::HeapGraphEdge::kProperty, var_name);
+ CHECK(var);
+ CHECK_EQ(var->GetType(), v8::HeapGraphNode::kSimdValue);
+}
+
+
+TEST(HeapSnapshotSimd) {
+ CheckSimdSnapshot("a = SIMD.Float32x4();\n", "a");
+ CheckSimdSnapshot("a = SIMD.Int32x4();\n", "a");
+ CheckSimdSnapshot("a = SIMD.Bool32x4();\n", "a");
+ CheckSimdSnapshot("a = SIMD.Int16x8();\n", "a");
+ CheckSimdSnapshot("a = SIMD.Bool16x8();\n", "a");
+ CheckSimdSnapshot("a = SIMD.Int8x16();\n", "a");
+ CheckSimdSnapshot("a = SIMD.Bool8x16();\n", "a");
+}
+
+
TEST(HeapSnapshotWeakCollection) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
@@ -960,7 +990,7 @@ TEST(HeapSnapshotJSONSerialization) {
v8::Local<v8::String> ref_string =
CompileRun(STRING_LITERAL_FOR_TEST)->ToString(isolate);
#undef STRING_LITERAL_FOR_TEST
- CHECK_EQ(0, strcmp(*v8::String::Utf8Value(ref_string),
+ CHECK_LT(0, strcmp(*v8::String::Utf8Value(ref_string),
*v8::String::Utf8Value(string)));
}
@@ -1768,7 +1798,7 @@ TEST(GetHeapValueForDeletedObject) {
static int StringCmp(const char* ref, i::String* act) {
- i::SmartArrayPointer<char> s_act = act->ToCString();
+ v8::base::SmartArrayPointer<char> s_act = act->ToCString();
int result = strcmp(ref, s_act.get());
if (result != 0)
fprintf(stderr, "Expected: \"%s\", Actual: \"%s\"\n", ref, s_act.get());
@@ -2082,6 +2112,7 @@ TEST(NoDebugObjectInSnapshot) {
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* root = snapshot->GetRoot();
int globals_count = 0;
+ bool found = false;
for (int i = 0; i < root->GetChildrenCount(); ++i) {
const v8::HeapGraphEdge* edge = root->GetChild(i);
if (edge->GetType() == v8::HeapGraphEdge::kShortcut) {
@@ -2089,10 +2120,13 @@ TEST(NoDebugObjectInSnapshot) {
const v8::HeapGraphNode* global = edge->GetToNode();
const v8::HeapGraphNode* foo =
GetProperty(global, v8::HeapGraphEdge::kProperty, "foo");
- CHECK(foo);
+ if (foo != nullptr) {
+ found = true;
+ }
}
}
- CHECK_EQ(1, globals_count);
+ CHECK_EQ(2, globals_count);
+ CHECK(found);
}