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.cc37
1 files changed, 19 insertions, 18 deletions
diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc
index b089fa8521..ce015777e5 100644
--- a/deps/v8/test/cctest/test-heap-profiler.cc
+++ b/deps/v8/test/cctest/test-heap-profiler.cc
@@ -117,7 +117,7 @@ static const v8::HeapGraphNode* GetProperty(v8::Isolate* isolate,
if (prop->GetType() == type && strcmp(name, *prop_name) == 0)
return prop->GetToNode();
}
- return NULL;
+ return nullptr;
}
static bool HasString(v8::Isolate* isolate, const v8::HeapGraphNode* node,
@@ -402,6 +402,7 @@ TEST(HeapSnapshotHeapNumbers) {
TEST(HeapSnapshotSlicedString) {
+ if (!i::FLAG_string_slices) return;
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
@@ -438,7 +439,7 @@ TEST(HeapSnapshotConsString) {
v8::Local<v8::ObjectTemplate> global_template =
v8::ObjectTemplate::New(isolate);
global_template->SetInternalFieldCount(1);
- LocalContext env(NULL, global_template);
+ LocalContext env(nullptr, global_template);
v8::Local<v8::Object> global_proxy = env->Global();
v8::Local<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>();
CHECK_EQ(1, global->InternalFieldCount());
@@ -558,7 +559,7 @@ TEST(HeapSnapshotWeakCollection) {
++weak_entries;
}
}
- CHECK_EQ(2, weak_entries);
+ CHECK_EQ(1, weak_entries); // Key is the only weak.
const v8::HeapGraphNode* wm_s =
GetProperty(env->GetIsolate(), wm, v8::HeapGraphEdge::kProperty, "str");
CHECK(wm_s);
@@ -674,7 +675,7 @@ TEST(HeapSnapshotInternalReferences) {
v8::Local<v8::ObjectTemplate> global_template =
v8::ObjectTemplate::New(isolate);
global_template->SetInternalFieldCount(2);
- LocalContext env(NULL, global_template);
+ LocalContext env(nullptr, global_template);
v8::Local<v8::Object> global_proxy = env->Global();
v8::Local<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>();
CHECK_EQ(2, global->InternalFieldCount());
@@ -1101,7 +1102,7 @@ class TestStatsStream : public v8::OutputStream {
static TestStatsStream GetHeapStatsUpdate(
v8::HeapProfiler* heap_profiler,
- v8::SnapshotObjectId* object_id = NULL) {
+ v8::SnapshotObjectId* object_id = nullptr) {
TestStatsStream stream;
int64_t timestamp = -1;
v8::SnapshotObjectId last_seen_id =
@@ -1460,7 +1461,7 @@ class TestRetainedObjectInfo : public v8::RetainedObjectInfo {
}
}
CHECK(false);
- return NULL;
+ return nullptr;
}
static std::vector<TestRetainedObjectInfo*> instances;
@@ -1490,7 +1491,7 @@ static const v8::HeapGraphNode* GetNode(const v8::HeapGraphNode* parent,
return node;
}
}
- return NULL;
+ return nullptr;
}
@@ -1635,7 +1636,7 @@ TEST(GlobalObjectName) {
NameResolver name_resolver;
const v8::HeapSnapshot* snapshot =
- heap_profiler->TakeHeapSnapshot(NULL, &name_resolver);
+ heap_profiler->TakeHeapSnapshot(nullptr, &name_resolver);
CHECK(ValidateSnapshot(snapshot));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
CHECK(global);
@@ -2346,7 +2347,7 @@ static const v8::HeapGraphNode* GetNodeByPath(v8::Isolate* isolate,
break;
}
}
- if (i == count) return NULL;
+ if (i == count) return nullptr;
}
return node;
}
@@ -2431,10 +2432,10 @@ static const char* record_trace_tree_source =
static AllocationTraceNode* FindNode(
AllocationTracker* tracker, const Vector<const char*>& names) {
AllocationTraceNode* node = tracker->trace_tree()->root();
- for (int i = 0; node != NULL && i < names.length(); i++) {
+ for (int i = 0; node != nullptr && i < names.length(); i++) {
const char* name = names[i];
const std::vector<AllocationTraceNode*>& children = node->children();
- node = NULL;
+ node = nullptr;
for (AllocationTraceNode* child : children) {
unsigned index = child->function_info_index();
AllocationTracker::FunctionInfo* info =
@@ -2687,7 +2688,7 @@ TEST(ArrayBufferSharedBackingStore) {
CHECK_EQ(1024, static_cast<int>(ab_contents.ByteLength()));
void* data = ab_contents.Data();
- CHECK(data != NULL);
+ CHECK_NOT_NULL(data);
v8::Local<v8::ArrayBuffer> ab2 =
v8::ArrayBuffer::New(isolate, data, ab_contents.ByteLength());
CHECK(ab2->IsExternal());
@@ -2907,7 +2908,7 @@ TEST(SamplingHeapProfiler) {
// Sample should be empty if requested before sampling has started.
{
v8::AllocationProfile* profile = heap_profiler->GetAllocationProfile();
- CHECK(profile == nullptr);
+ CHECK_NULL(profile);
}
int count_1024 = 0;
@@ -2935,7 +2936,7 @@ TEST(SamplingHeapProfiler) {
// Samples should get cleared once sampling is stopped.
{
v8::AllocationProfile* profile = heap_profiler->GetAllocationProfile();
- CHECK(profile == nullptr);
+ CHECK_NULL(profile);
}
// Sampling at a higher rate should give us similar numbers of objects.
@@ -3108,7 +3109,7 @@ TEST(SamplingHeapProfilerPretenuredInlineAllocations) {
v8::Local<v8::Function>::Cast(CompileRun(source.start()));
// Make sure the function is producing pre-tenured objects.
- auto res = f->Call(env.local(), env->Global(), 0, NULL).ToLocalChecked();
+ auto res = f->Call(env.local(), env->Global(), 0, nullptr).ToLocalChecked();
i::Handle<i::JSObject> o = i::Handle<i::JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
CHECK(CcTest::heap()->InOldSpace(o->elements()));
@@ -3116,8 +3117,8 @@ TEST(SamplingHeapProfilerPretenuredInlineAllocations) {
// Call the function and profile it.
heap_profiler->StartSamplingHeapProfiler(64);
- for (int i = 0; i < 100; ++i) {
- f->Call(env.local(), env->Global(), 0, NULL).ToLocalChecked();
+ for (int i = 0; i < 80; ++i) {
+ f->Call(env.local(), env->Global(), 0, nullptr).ToLocalChecked();
}
std::unique_ptr<v8::AllocationProfile> profile(
@@ -3135,5 +3136,5 @@ TEST(SamplingHeapProfilerPretenuredInlineAllocations) {
count += allocation.count;
}
- CHECK_GE(count, 9000);
+ CHECK_GE(count, 8000);
}