Index: test/cctest/test-heap-profiler.cc |
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc |
index b018ed64f447548e95b5f15fc7b3e3fab8fb538e..13bcebc3c8b409966abaf959fb7e0f6928a71993 100644 |
--- a/test/cctest/test-heap-profiler.cc |
+++ b/test/cctest/test-heap-profiler.cc |
@@ -191,10 +191,12 @@ TEST(HeapSnapshot) { |
// Verify, that JS global object of env2 has '..2' properties. |
const v8::HeapGraphNode* a2_node = |
GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "a2"); |
- CHECK(a2_node); |
- CHECK(GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "b2_1")); |
- CHECK(GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "b2_2")); |
- CHECK(GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "c2")); |
+ CHECK_NE(NULL, a2_node); |
+ CHECK_NE( |
+ NULL, GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "b2_1")); |
+ CHECK_NE( |
+ NULL, GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "b2_2")); |
+ CHECK_NE(NULL, GetProperty(global_env2, v8::HeapGraphEdge::kProperty, "c2")); |
NamedEntriesDetector det; |
det.CheckAllReachables(const_cast<i::HeapEntry*>( |
@@ -223,13 +225,13 @@ TEST(HeapSnapshotObjectSizes) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* x = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "x"); |
- CHECK(x); |
+ CHECK_NE(NULL, x); |
const v8::HeapGraphNode* x1 = |
GetProperty(x, v8::HeapGraphEdge::kProperty, "a"); |
- CHECK(x1); |
+ CHECK_NE(NULL, x1); |
const v8::HeapGraphNode* x2 = |
GetProperty(x, v8::HeapGraphEdge::kProperty, "b"); |
- CHECK(x2); |
+ CHECK_NE(NULL, x2); |
// Test sizes. |
CHECK_NE(0, static_cast<int>(x->GetShallowSize())); |
@@ -253,11 +255,11 @@ TEST(BoundFunctionInSnapshot) { |
const v8::HeapGraphNode* f = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "boundFunction"); |
CHECK(f); |
- CHECK(v8::String::NewFromUtf8(env->GetIsolate(), "native_bind") |
- ->Equals(f->GetName())); |
+ CHECK_EQ(v8::String::NewFromUtf8(env->GetIsolate(), "native_bind"), |
+ f->GetName()); |
const v8::HeapGraphNode* bindings = |
GetProperty(f, v8::HeapGraphEdge::kInternal, "bindings"); |
- CHECK(bindings); |
+ CHECK_NE(NULL, bindings); |
CHECK_EQ(v8::HeapGraphNode::kArray, bindings->GetType()); |
CHECK_EQ(3, bindings->GetChildrenCount()); |
@@ -296,7 +298,7 @@ TEST(HeapSnapshotEntryChildren) { |
} |
const v8::HeapGraphNode* a = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "a"); |
- CHECK(a); |
+ CHECK_NE(NULL, a); |
for (int i = 0, count = a->GetChildrenCount(); i < count; ++i) { |
const v8::HeapGraphEdge* prop = a->GetChild(i); |
CHECK_EQ(a, prop->GetFromNode()); |
@@ -321,35 +323,35 @@ TEST(HeapSnapshotCodeObjects) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* compiled = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "compiled"); |
- CHECK(compiled); |
+ CHECK_NE(NULL, compiled); |
CHECK_EQ(v8::HeapGraphNode::kClosure, compiled->GetType()); |
const v8::HeapGraphNode* lazy = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "lazy"); |
- CHECK(lazy); |
+ CHECK_NE(NULL, lazy); |
CHECK_EQ(v8::HeapGraphNode::kClosure, lazy->GetType()); |
const v8::HeapGraphNode* anonymous = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "anonymous"); |
- CHECK(anonymous); |
+ CHECK_NE(NULL, anonymous); |
CHECK_EQ(v8::HeapGraphNode::kClosure, anonymous->GetType()); |
v8::String::Utf8Value anonymous_name(anonymous->GetName()); |
- CHECK_EQ(0, strcmp("", *anonymous_name)); |
+ CHECK_EQ("", *anonymous_name); |
// Find references to code. |
const v8::HeapGraphNode* compiled_code = |
GetProperty(compiled, v8::HeapGraphEdge::kInternal, "shared"); |
- CHECK(compiled_code); |
+ CHECK_NE(NULL, compiled_code); |
const v8::HeapGraphNode* lazy_code = |
GetProperty(lazy, v8::HeapGraphEdge::kInternal, "shared"); |
- CHECK(lazy_code); |
+ CHECK_NE(NULL, lazy_code); |
// Check that there's no strong next_code_link. There might be a weak one |
// but might be not, so we can't check that fact. |
const v8::HeapGraphNode* code = |
GetProperty(compiled_code, v8::HeapGraphEdge::kInternal, "code"); |
- CHECK(code); |
+ CHECK_NE(NULL, code); |
const v8::HeapGraphNode* next_code_link = |
GetProperty(code, v8::HeapGraphEdge::kInternal, "code"); |
- CHECK(!next_code_link); |
+ CHECK_EQ(NULL, next_code_link); |
// Verify that non-compiled code doesn't contain references to "x" |
// literal, while compiled code does. The scope info is stored in FixedArray |
@@ -391,10 +393,10 @@ TEST(HeapSnapshotHeapNumbers) { |
heap_profiler->TakeHeapSnapshot(v8_str("numbers")); |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
- CHECK(!GetProperty(global, v8::HeapGraphEdge::kProperty, "a")); |
+ CHECK_EQ(NULL, GetProperty(global, v8::HeapGraphEdge::kProperty, "a")); |
const v8::HeapGraphNode* b = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "b"); |
- CHECK(b); |
+ CHECK_NE(NULL, b); |
CHECK_EQ(v8::HeapGraphNode::kHeapNumber, b->GetType()); |
} |
@@ -415,10 +417,10 @@ TEST(HeapSnapshotSlicedString) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* parent_string = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "parent_string"); |
- CHECK(parent_string); |
+ CHECK_NE(NULL, parent_string); |
const v8::HeapGraphNode* child_string = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "child_string"); |
- CHECK(child_string); |
+ CHECK_NE(NULL, child_string); |
CHECK_EQ(v8::HeapGraphNode::kSlicedString, child_string->GetType()); |
const v8::HeapGraphNode* parent = |
GetProperty(child_string, v8::HeapGraphEdge::kInternal, "parent"); |
@@ -454,7 +456,7 @@ TEST(HeapSnapshotConsString) { |
const v8::HeapGraphNode* string_node = |
GetProperty(global_node, v8::HeapGraphEdge::kInternal, "0"); |
- CHECK(string_node); |
+ CHECK_NE(NULL, string_node); |
CHECK_EQ(v8::HeapGraphNode::kConsString, string_node->GetType()); |
const v8::HeapGraphNode* first_node = |
@@ -481,13 +483,13 @@ TEST(HeapSnapshotSymbol) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* a = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "a"); |
- CHECK(a); |
+ CHECK_NE(NULL, a); |
CHECK_EQ(a->GetType(), v8::HeapGraphNode::kSymbol); |
- CHECK(v8_str("symbol")->Equals(a->GetName())); |
+ CHECK_EQ(v8_str("symbol"), a->GetName()); |
const v8::HeapGraphNode* name = |
GetProperty(a, v8::HeapGraphEdge::kInternal, "name"); |
- CHECK(name); |
- CHECK(v8_str("mySymbol")->Equals(name->GetName())); |
+ CHECK_NE(NULL, name); |
+ CHECK_EQ(v8_str("mySymbol"), name->GetName()); |
} |
@@ -506,19 +508,19 @@ TEST(HeapSnapshotWeakCollection) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* k = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "k"); |
- CHECK(k); |
+ CHECK_NE(NULL, k); |
const v8::HeapGraphNode* v = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "v"); |
- CHECK(v); |
+ CHECK_NE(NULL, v); |
const v8::HeapGraphNode* s = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "s"); |
- CHECK(s); |
+ CHECK_NE(NULL, s); |
const v8::HeapGraphNode* ws = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "ws"); |
- CHECK(ws); |
+ CHECK_NE(NULL, ws); |
CHECK_EQ(v8::HeapGraphNode::kObject, ws->GetType()); |
- CHECK(v8_str("WeakSet")->Equals(ws->GetName())); |
+ CHECK_EQ(v8_str("WeakSet"), ws->GetName()); |
const v8::HeapGraphNode* ws_table = |
GetProperty(ws, v8::HeapGraphEdge::kInternal, "table"); |
@@ -535,14 +537,14 @@ TEST(HeapSnapshotWeakCollection) { |
CHECK_EQ(1, weak_entries); |
const v8::HeapGraphNode* ws_s = |
GetProperty(ws, v8::HeapGraphEdge::kProperty, "str"); |
- CHECK(ws_s); |
- CHECK_EQ(s->GetId(), ws_s->GetId()); |
+ CHECK_NE(NULL, ws_s); |
+ CHECK_EQ(static_cast<int>(s->GetId()), static_cast<int>(ws_s->GetId())); |
const v8::HeapGraphNode* wm = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "wm"); |
- CHECK(wm); |
+ CHECK_NE(NULL, wm); |
CHECK_EQ(v8::HeapGraphNode::kObject, wm->GetType()); |
- CHECK(v8_str("WeakMap")->Equals(wm->GetName())); |
+ CHECK_EQ(v8_str("WeakMap"), wm->GetName()); |
const v8::HeapGraphNode* wm_table = |
GetProperty(wm, v8::HeapGraphEdge::kInternal, "table"); |
@@ -560,8 +562,8 @@ TEST(HeapSnapshotWeakCollection) { |
CHECK_EQ(2, weak_entries); |
const v8::HeapGraphNode* wm_s = |
GetProperty(wm, v8::HeapGraphEdge::kProperty, "str"); |
- CHECK(wm_s); |
- CHECK_EQ(s->GetId(), wm_s->GetId()); |
+ CHECK_NE(NULL, wm_s); |
+ CHECK_EQ(static_cast<int>(s->GetId()), static_cast<int>(wm_s->GetId())); |
} |
@@ -580,19 +582,19 @@ TEST(HeapSnapshotCollection) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* k = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "k"); |
- CHECK(k); |
+ CHECK_NE(NULL, k); |
const v8::HeapGraphNode* v = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "v"); |
- CHECK(v); |
+ CHECK_NE(NULL, v); |
const v8::HeapGraphNode* s = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "s"); |
- CHECK(s); |
+ CHECK_NE(NULL, s); |
const v8::HeapGraphNode* set = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "set"); |
- CHECK(set); |
+ CHECK_NE(NULL, set); |
CHECK_EQ(v8::HeapGraphNode::kObject, set->GetType()); |
- CHECK(v8_str("Set")->Equals(set->GetName())); |
+ CHECK_EQ(v8_str("Set"), set->GetName()); |
const v8::HeapGraphNode* set_table = |
GetProperty(set, v8::HeapGraphEdge::kInternal, "table"); |
@@ -609,14 +611,14 @@ TEST(HeapSnapshotCollection) { |
CHECK_EQ(2, entries); |
const v8::HeapGraphNode* set_s = |
GetProperty(set, v8::HeapGraphEdge::kProperty, "str"); |
- CHECK(set_s); |
- CHECK_EQ(s->GetId(), set_s->GetId()); |
+ CHECK_NE(NULL, set_s); |
+ CHECK_EQ(static_cast<int>(s->GetId()), static_cast<int>(set_s->GetId())); |
const v8::HeapGraphNode* map = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "map"); |
- CHECK(map); |
+ CHECK_NE(NULL, map); |
CHECK_EQ(v8::HeapGraphNode::kObject, map->GetType()); |
- CHECK(v8_str("Map")->Equals(map->GetName())); |
+ CHECK_EQ(v8_str("Map"), map->GetName()); |
const v8::HeapGraphNode* map_table = |
GetProperty(map, v8::HeapGraphEdge::kInternal, "table"); |
@@ -633,8 +635,8 @@ TEST(HeapSnapshotCollection) { |
CHECK_EQ(2, entries); |
const v8::HeapGraphNode* map_s = |
GetProperty(map, v8::HeapGraphEdge::kProperty, "str"); |
- CHECK(map_s); |
- CHECK_EQ(s->GetId(), map_s->GetId()); |
+ CHECK_NE(NULL, map_s); |
+ CHECK_EQ(static_cast<int>(s->GetId()), static_cast<int>(map_s->GetId())); |
} |
@@ -657,12 +659,20 @@ TEST(HeapSnapshotInternalReferences) { |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); |
// The first reference will not present, because it's a Smi. |
- CHECK(!GetProperty(global_node, v8::HeapGraphEdge::kInternal, "0")); |
+ CHECK_EQ(NULL, GetProperty(global_node, v8::HeapGraphEdge::kInternal, "0")); |
// The second reference is to an object. |
- CHECK(GetProperty(global_node, v8::HeapGraphEdge::kInternal, "1")); |
+ CHECK_NE(NULL, GetProperty(global_node, v8::HeapGraphEdge::kInternal, "1")); |
} |
+// Trying to introduce a check helper for uint32_t causes many |
+// overloading ambiguities, so it seems easier just to cast |
+// them to a signed type. |
+#define CHECK_EQ_SNAPSHOT_OBJECT_ID(a, b) \ |
+ CHECK_EQ(static_cast<int32_t>(a), static_cast<int32_t>(b)) |
+#define CHECK_NE_SNAPSHOT_OBJECT_ID(a, b) \ |
+ CHECK((a) != (b)) // NOLINT |
+ |
TEST(HeapSnapshotAddressReuse) { |
LocalContext env; |
v8::HandleScope scope(env->GetIsolate()); |
@@ -690,7 +700,7 @@ TEST(HeapSnapshotAddressReuse) { |
const v8::HeapGraphNode* array_node = |
GetProperty(global2, v8::HeapGraphEdge::kProperty, "a"); |
- CHECK(array_node); |
+ CHECK_NE(NULL, array_node); |
int wrong_count = 0; |
for (int i = 0, count = array_node->GetChildrenCount(); i < count; ++i) { |
const v8::HeapGraphEdge* prop = array_node->GetChild(i); |
@@ -733,24 +743,24 @@ TEST(HeapEntryIdsAndArrayShift) { |
const v8::HeapGraphNode* global1 = GetGlobalObject(snapshot1); |
const v8::HeapGraphNode* global2 = GetGlobalObject(snapshot2); |
- CHECK_NE(0u, global1->GetId()); |
- CHECK_EQ(global1->GetId(), global2->GetId()); |
+ CHECK_NE_SNAPSHOT_OBJECT_ID(0, global1->GetId()); |
+ CHECK_EQ_SNAPSHOT_OBJECT_ID(global1->GetId(), global2->GetId()); |
const v8::HeapGraphNode* a1 = |
GetProperty(global1, v8::HeapGraphEdge::kProperty, "a"); |
- CHECK(a1); |
+ CHECK_NE(NULL, a1); |
const v8::HeapGraphNode* k1 = |
GetProperty(a1, v8::HeapGraphEdge::kInternal, "elements"); |
- CHECK(k1); |
+ CHECK_NE(NULL, k1); |
const v8::HeapGraphNode* a2 = |
GetProperty(global2, v8::HeapGraphEdge::kProperty, "a"); |
- CHECK(a2); |
+ CHECK_NE(NULL, a2); |
const v8::HeapGraphNode* k2 = |
GetProperty(a2, v8::HeapGraphEdge::kInternal, "elements"); |
- CHECK(k2); |
+ CHECK_NE(NULL, k2); |
- CHECK_EQ(a1->GetId(), a2->GetId()); |
- CHECK_EQ(k1->GetId(), k2->GetId()); |
+ CHECK_EQ_SNAPSHOT_OBJECT_ID(a1->GetId(), a2->GetId()); |
+ CHECK_EQ_SNAPSHOT_OBJECT_ID(k1->GetId(), k2->GetId()); |
} |
@@ -776,46 +786,46 @@ TEST(HeapEntryIdsAndGC) { |
heap_profiler->TakeHeapSnapshot(s2_str); |
CHECK(ValidateSnapshot(snapshot2)); |
- CHECK_GT(snapshot1->GetMaxSnapshotJSObjectId(), 7000u); |
+ CHECK_GT(snapshot1->GetMaxSnapshotJSObjectId(), 7000); |
CHECK(snapshot1->GetMaxSnapshotJSObjectId() <= |
snapshot2->GetMaxSnapshotJSObjectId()); |
const v8::HeapGraphNode* global1 = GetGlobalObject(snapshot1); |
const v8::HeapGraphNode* global2 = GetGlobalObject(snapshot2); |
- CHECK_NE(0u, global1->GetId()); |
- CHECK_EQ(global1->GetId(), global2->GetId()); |
+ CHECK_NE_SNAPSHOT_OBJECT_ID(0, global1->GetId()); |
+ CHECK_EQ_SNAPSHOT_OBJECT_ID(global1->GetId(), global2->GetId()); |
const v8::HeapGraphNode* A1 = |
GetProperty(global1, v8::HeapGraphEdge::kProperty, "A"); |
- CHECK(A1); |
+ CHECK_NE(NULL, A1); |
const v8::HeapGraphNode* A2 = |
GetProperty(global2, v8::HeapGraphEdge::kProperty, "A"); |
- CHECK(A2); |
- CHECK_NE(0u, A1->GetId()); |
- CHECK_EQ(A1->GetId(), A2->GetId()); |
+ CHECK_NE(NULL, A2); |
+ CHECK_NE_SNAPSHOT_OBJECT_ID(0, A1->GetId()); |
+ CHECK_EQ_SNAPSHOT_OBJECT_ID(A1->GetId(), A2->GetId()); |
const v8::HeapGraphNode* B1 = |
GetProperty(global1, v8::HeapGraphEdge::kProperty, "B"); |
- CHECK(B1); |
+ CHECK_NE(NULL, B1); |
const v8::HeapGraphNode* B2 = |
GetProperty(global2, v8::HeapGraphEdge::kProperty, "B"); |
- CHECK(B2); |
- CHECK_NE(0u, B1->GetId()); |
- CHECK_EQ(B1->GetId(), B2->GetId()); |
+ CHECK_NE(NULL, B2); |
+ CHECK_NE_SNAPSHOT_OBJECT_ID(0, B1->GetId()); |
+ CHECK_EQ_SNAPSHOT_OBJECT_ID(B1->GetId(), B2->GetId()); |
const v8::HeapGraphNode* a1 = |
GetProperty(global1, v8::HeapGraphEdge::kProperty, "a"); |
- CHECK(a1); |
+ CHECK_NE(NULL, a1); |
const v8::HeapGraphNode* a2 = |
GetProperty(global2, v8::HeapGraphEdge::kProperty, "a"); |
- CHECK(a2); |
- CHECK_NE(0u, a1->GetId()); |
- CHECK_EQ(a1->GetId(), a2->GetId()); |
+ CHECK_NE(NULL, a2); |
+ CHECK_NE_SNAPSHOT_OBJECT_ID(0, a1->GetId()); |
+ CHECK_EQ_SNAPSHOT_OBJECT_ID(a1->GetId(), a2->GetId()); |
const v8::HeapGraphNode* b1 = |
GetProperty(global1, v8::HeapGraphEdge::kProperty, "b"); |
- CHECK(b1); |
+ CHECK_NE(NULL, b1); |
const v8::HeapGraphNode* b2 = |
GetProperty(global2, v8::HeapGraphEdge::kProperty, "b"); |
- CHECK(b2); |
- CHECK_NE(0u, b1->GetId()); |
- CHECK_EQ(b1->GetId(), b2->GetId()); |
+ CHECK_NE(NULL, b2); |
+ CHECK_NE_SNAPSHOT_OBJECT_ID(0, b1->GetId()); |
+ CHECK_EQ_SNAPSHOT_OBJECT_ID(b1->GetId(), b2->GetId()); |
} |
@@ -983,8 +993,8 @@ 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), |
- *v8::String::Utf8Value(string))); |
+ CHECK_EQ(*v8::String::Utf8Value(ref_string), |
+ *v8::String::Utf8Value(string)); |
} |
@@ -1090,14 +1100,14 @@ TEST(HeapSnapshotObjectsStats) { |
&initial_id); |
CHECK_EQ(1, stats_update.intervals_count()); |
CHECK_EQ(1, stats_update.updates_written()); |
- CHECK_LT(0u, stats_update.entries_size()); |
+ CHECK_LT(0, stats_update.entries_size()); |
CHECK_EQ(0, stats_update.first_interval_index()); |
} |
// No data expected in update because nothing has happened. |
v8::SnapshotObjectId same_id; |
CHECK_EQ(0, GetHeapStatsUpdate(heap_profiler, &same_id).updates_written()); |
- CHECK_EQ(initial_id, same_id); |
+ CHECK_EQ_SNAPSHOT_OBJECT_ID(initial_id, same_id); |
{ |
v8::SnapshotObjectId additional_string_id; |
@@ -1110,15 +1120,15 @@ TEST(HeapSnapshotObjectsStats) { |
CHECK_LT(same_id, additional_string_id); |
CHECK_EQ(1, stats_update.intervals_count()); |
CHECK_EQ(1, stats_update.updates_written()); |
- CHECK_LT(0u, stats_update.entries_size()); |
- CHECK_EQ(1u, stats_update.entries_count()); |
+ CHECK_LT(0, stats_update.entries_size()); |
+ CHECK_EQ(1, stats_update.entries_count()); |
CHECK_EQ(2, stats_update.first_interval_index()); |
} |
// No data expected in update because nothing happened. |
v8::SnapshotObjectId last_id; |
CHECK_EQ(0, GetHeapStatsUpdate(heap_profiler, &last_id).updates_written()); |
- CHECK_EQ(additional_string_id, last_id); |
+ CHECK_EQ_SNAPSHOT_OBJECT_ID(additional_string_id, last_id); |
{ |
v8::HandleScope inner_scope_2(env->GetIsolate()); |
@@ -1135,8 +1145,8 @@ TEST(HeapSnapshotObjectsStats) { |
TestStatsStream stats_update = GetHeapStatsUpdate(heap_profiler); |
CHECK_EQ(1, stats_update.intervals_count()); |
CHECK_EQ(1, stats_update.updates_written()); |
- CHECK_LT(0u, entries_size = stats_update.entries_size()); |
- CHECK_EQ(3u, stats_update.entries_count()); |
+ CHECK_LT(0, entries_size = stats_update.entries_size()); |
+ CHECK_EQ(3, stats_update.entries_count()); |
CHECK_EQ(4, stats_update.first_interval_index()); |
} |
} |
@@ -1147,7 +1157,7 @@ TEST(HeapSnapshotObjectsStats) { |
CHECK_EQ(1, stats_update.intervals_count()); |
CHECK_EQ(1, stats_update.updates_written()); |
CHECK_GT(entries_size, stats_update.entries_size()); |
- CHECK_EQ(1u, stats_update.entries_count()); |
+ CHECK_EQ(1, stats_update.entries_count()); |
// Two strings from forth interval were released. |
CHECK_EQ(4, stats_update.first_interval_index()); |
} |
@@ -1158,8 +1168,8 @@ TEST(HeapSnapshotObjectsStats) { |
TestStatsStream stats_update = GetHeapStatsUpdate(heap_profiler); |
CHECK_EQ(1, stats_update.intervals_count()); |
CHECK_EQ(1, stats_update.updates_written()); |
- CHECK_EQ(0u, stats_update.entries_size()); |
- CHECK_EQ(0u, stats_update.entries_count()); |
+ CHECK_EQ(0, stats_update.entries_size()); |
+ CHECK_EQ(0, stats_update.entries_count()); |
// The last string from forth interval was released. |
CHECK_EQ(4, stats_update.first_interval_index()); |
} |
@@ -1169,14 +1179,14 @@ TEST(HeapSnapshotObjectsStats) { |
TestStatsStream stats_update = GetHeapStatsUpdate(heap_profiler); |
CHECK_EQ(1, stats_update.intervals_count()); |
CHECK_EQ(1, stats_update.updates_written()); |
- CHECK_EQ(0u, stats_update.entries_size()); |
- CHECK_EQ(0u, stats_update.entries_count()); |
+ CHECK_EQ(0, stats_update.entries_size()); |
+ CHECK_EQ(0, stats_update.entries_count()); |
// The only string from the second interval was released. |
CHECK_EQ(2, stats_update.first_interval_index()); |
} |
v8::Local<v8::Array> array = v8::Array::New(env->GetIsolate()); |
- CHECK_EQ(0u, array->Length()); |
+ CHECK_EQ(0, array->Length()); |
// Force array's buffer allocation. |
array->Set(2, v8_num(7)); |
@@ -1186,9 +1196,9 @@ TEST(HeapSnapshotObjectsStats) { |
TestStatsStream stats_update = GetHeapStatsUpdate(heap_profiler); |
CHECK_EQ(1, stats_update.intervals_count()); |
CHECK_EQ(1, stats_update.updates_written()); |
- CHECK_LT(0u, entries_size = stats_update.entries_size()); |
+ CHECK_LT(0, entries_size = stats_update.entries_size()); |
// They are the array and its buffer. |
- CHECK_EQ(2u, stats_update.entries_count()); |
+ CHECK_EQ(2, stats_update.entries_count()); |
CHECK_EQ(8, stats_update.first_interval_index()); |
} |
@@ -1203,7 +1213,7 @@ TEST(HeapSnapshotObjectsStats) { |
// The second interval was changed because new buffer was allocated. |
CHECK_EQ(2, stats_update.updates_written()); |
CHECK_LT(entries_size, stats_update.entries_size()); |
- CHECK_EQ(2u, stats_update.entries_count()); |
+ CHECK_EQ(2, stats_update.entries_count()); |
CHECK_EQ(8, stats_update.first_interval_index()); |
} |
@@ -1230,7 +1240,7 @@ TEST(HeapObjectIds) { |
for (int i = 0; i < kLength; i++) { |
v8::SnapshotObjectId id = heap_profiler->GetObjectId(objects[i]); |
- CHECK_NE(v8::HeapProfiler::kUnknownObjectId, id); |
+ CHECK_NE(v8::HeapProfiler::kUnknownObjectId, static_cast<int>(id)); |
ids[i] = id; |
} |
@@ -1239,15 +1249,15 @@ TEST(HeapObjectIds) { |
for (int i = 0; i < kLength; i++) { |
v8::SnapshotObjectId id = heap_profiler->GetObjectId(objects[i]); |
- CHECK_EQ(ids[i], id); |
+ CHECK_EQ(static_cast<int>(ids[i]), static_cast<int>(id)); |
v8::Handle<v8::Value> obj = heap_profiler->FindObjectById(ids[i]); |
- CHECK(objects[i]->Equals(obj)); |
+ CHECK_EQ(objects[i], obj); |
} |
heap_profiler->ClearObjectIds(); |
for (int i = 0; i < kLength; i++) { |
v8::SnapshotObjectId id = heap_profiler->GetObjectId(objects[i]); |
- CHECK_EQ(v8::HeapProfiler::kUnknownObjectId, id); |
+ CHECK_EQ(v8::HeapProfiler::kUnknownObjectId, static_cast<int>(id)); |
v8::Handle<v8::Value> obj = heap_profiler->FindObjectById(ids[i]); |
CHECK(obj.IsEmpty()); |
} |
@@ -1263,7 +1273,7 @@ static void CheckChildrenIds(const v8::HeapSnapshot* snapshot, |
const v8::HeapGraphEdge* prop = node->GetChild(i); |
const v8::HeapGraphNode* child = |
snapshot->GetNodeById(prop->GetToNode()->GetId()); |
- CHECK_EQ(prop->GetToNode()->GetId(), child->GetId()); |
+ CHECK_EQ_SNAPSHOT_OBJECT_ID(prop->GetToNode()->GetId(), child->GetId()); |
CHECK_EQ(prop->GetToNode(), child); |
CheckChildrenIds(snapshot, child, level + 1, max_level); |
} |
@@ -1281,7 +1291,7 @@ TEST(HeapSnapshotGetNodeById) { |
const v8::HeapGraphNode* root = snapshot->GetRoot(); |
CheckChildrenIds(snapshot, root, 0, 3); |
// Check a big id, which should not exist yet. |
- CHECK(!snapshot->GetNodeById(0x1000000UL)); |
+ CHECK_EQ(NULL, snapshot->GetNodeById(0x1000000UL)); |
} |
@@ -1304,8 +1314,9 @@ TEST(HeapSnapshotGetSnapshotObjectId) { |
CHECK(globalObjectHandle->IsObject()); |
v8::SnapshotObjectId id = heap_profiler->GetObjectId(globalObjectHandle); |
- CHECK_NE(v8::HeapProfiler::kUnknownObjectId, id); |
- CHECK_EQ(id, global_object->GetId()); |
+ CHECK_NE(static_cast<int>(v8::HeapProfiler::kUnknownObjectId), |
+ id); |
+ CHECK_EQ(static_cast<int>(id), global_object->GetId()); |
} |
@@ -1319,7 +1330,7 @@ TEST(HeapSnapshotUnknownSnapshotObjectId) { |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* node = |
snapshot->GetNodeById(v8::HeapProfiler::kUnknownObjectId); |
- CHECK(!node); |
+ CHECK_EQ(NULL, node); |
} |
@@ -1355,7 +1366,7 @@ TEST(TakeHeapSnapshotAborting) { |
const v8::HeapSnapshot* no_snapshot = |
heap_profiler->TakeHeapSnapshot(v8_str("abort"), |
&aborting_control); |
- CHECK(!no_snapshot); |
+ CHECK_EQ(NULL, no_snapshot); |
CHECK_EQ(snapshots_count, heap_profiler->GetSnapshotCount()); |
CHECK_GT(aborting_control.total(), aborting_control.done()); |
@@ -1365,7 +1376,7 @@ TEST(TakeHeapSnapshotAborting) { |
&control); |
CHECK(ValidateSnapshot(snapshot)); |
- CHECK(snapshot); |
+ CHECK_NE(NULL, snapshot); |
CHECK_EQ(snapshots_count + 1, heap_profiler->GetSnapshotCount()); |
CHECK_EQ(control.total(), control.done()); |
CHECK_GT(control.total(), 0); |
@@ -1485,29 +1496,29 @@ TEST(HeapSnapshotRetainedObjectInfo) { |
const v8::HeapGraphNode* native_group_aaa = GetNode( |
snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "aaa-group"); |
- CHECK(native_group_aaa); |
+ CHECK_NE(NULL, native_group_aaa); |
CHECK_EQ(1, native_group_aaa->GetChildrenCount()); |
const v8::HeapGraphNode* aaa = GetNode( |
native_group_aaa, v8::HeapGraphNode::kNative, "aaa / 100 entries"); |
- CHECK(aaa); |
+ CHECK_NE(NULL, aaa); |
CHECK_EQ(2, aaa->GetChildrenCount()); |
const v8::HeapGraphNode* native_group_ccc = GetNode( |
snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "ccc-group"); |
const v8::HeapGraphNode* ccc = GetNode( |
native_group_ccc, v8::HeapGraphNode::kNative, "ccc"); |
- CHECK(ccc); |
+ CHECK_NE(NULL, ccc); |
const v8::HeapGraphNode* n_AAA = GetNode( |
aaa, v8::HeapGraphNode::kString, "AAA"); |
- CHECK(n_AAA); |
+ CHECK_NE(NULL, n_AAA); |
const v8::HeapGraphNode* n_BBB = GetNode( |
aaa, v8::HeapGraphNode::kString, "BBB"); |
- CHECK(n_BBB); |
+ CHECK_NE(NULL, n_BBB); |
CHECK_EQ(1, ccc->GetChildrenCount()); |
const v8::HeapGraphNode* n_CCC = GetNode( |
ccc, v8::HeapGraphNode::kString, "CCC"); |
- CHECK(n_CCC); |
+ CHECK_NE(NULL, n_CCC); |
CHECK_EQ(aaa, GetProperty(n_AAA, v8::HeapGraphEdge::kInternal, "native")); |
CHECK_EQ(aaa, GetProperty(n_BBB, v8::HeapGraphEdge::kInternal, "native")); |
@@ -1519,7 +1530,7 @@ class GraphWithImplicitRefs { |
public: |
static const int kObjectsCount = 4; |
explicit GraphWithImplicitRefs(LocalContext* env) { |
- CHECK(!instance_); |
+ CHECK_EQ(NULL, instance_); |
instance_ = this; |
isolate_ = (*env)->GetIsolate(); |
for (int i = 0; i < kObjectsCount; i++) { |
@@ -1600,12 +1611,12 @@ TEST(DeleteAllHeapSnapshots) { |
CHECK_EQ(0, heap_profiler->GetSnapshotCount()); |
heap_profiler->DeleteAllHeapSnapshots(); |
CHECK_EQ(0, heap_profiler->GetSnapshotCount()); |
- CHECK(heap_profiler->TakeHeapSnapshot(v8_str("1"))); |
+ CHECK_NE(NULL, heap_profiler->TakeHeapSnapshot(v8_str("1"))); |
CHECK_EQ(1, heap_profiler->GetSnapshotCount()); |
heap_profiler->DeleteAllHeapSnapshots(); |
CHECK_EQ(0, heap_profiler->GetSnapshotCount()); |
- CHECK(heap_profiler->TakeHeapSnapshot(v8_str("1"))); |
- CHECK(heap_profiler->TakeHeapSnapshot(v8_str("2"))); |
+ CHECK_NE(NULL, heap_profiler->TakeHeapSnapshot(v8_str("1"))); |
+ CHECK_NE(NULL, heap_profiler->TakeHeapSnapshot(v8_str("2"))); |
CHECK_EQ(2, heap_profiler->GetSnapshotCount()); |
heap_profiler->DeleteAllHeapSnapshots(); |
CHECK_EQ(0, heap_profiler->GetSnapshotCount()); |
@@ -1634,35 +1645,35 @@ TEST(DeleteHeapSnapshot) { |
const v8::HeapSnapshot* s1 = |
heap_profiler->TakeHeapSnapshot(v8_str("1")); |
- CHECK(s1); |
+ CHECK_NE(NULL, s1); |
CHECK_EQ(1, heap_profiler->GetSnapshotCount()); |
unsigned uid1 = s1->GetUid(); |
CHECK_EQ(s1, FindHeapSnapshot(heap_profiler, uid1)); |
const_cast<v8::HeapSnapshot*>(s1)->Delete(); |
CHECK_EQ(0, heap_profiler->GetSnapshotCount()); |
- CHECK(!FindHeapSnapshot(heap_profiler, uid1)); |
+ CHECK_EQ(NULL, FindHeapSnapshot(heap_profiler, uid1)); |
const v8::HeapSnapshot* s2 = |
heap_profiler->TakeHeapSnapshot(v8_str("2")); |
- CHECK(s2); |
+ CHECK_NE(NULL, s2); |
CHECK_EQ(1, heap_profiler->GetSnapshotCount()); |
unsigned uid2 = s2->GetUid(); |
CHECK_NE(static_cast<int>(uid1), static_cast<int>(uid2)); |
CHECK_EQ(s2, FindHeapSnapshot(heap_profiler, uid2)); |
const v8::HeapSnapshot* s3 = |
heap_profiler->TakeHeapSnapshot(v8_str("3")); |
- CHECK(s3); |
+ CHECK_NE(NULL, s3); |
CHECK_EQ(2, heap_profiler->GetSnapshotCount()); |
unsigned uid3 = s3->GetUid(); |
CHECK_NE(static_cast<int>(uid1), static_cast<int>(uid3)); |
CHECK_EQ(s3, FindHeapSnapshot(heap_profiler, uid3)); |
const_cast<v8::HeapSnapshot*>(s2)->Delete(); |
CHECK_EQ(1, heap_profiler->GetSnapshotCount()); |
- CHECK(!FindHeapSnapshot(heap_profiler, uid2)); |
+ CHECK_EQ(NULL, FindHeapSnapshot(heap_profiler, uid2)); |
CHECK_EQ(s3, FindHeapSnapshot(heap_profiler, uid3)); |
const_cast<v8::HeapSnapshot*>(s3)->Delete(); |
CHECK_EQ(0, heap_profiler->GetSnapshotCount()); |
- CHECK(!FindHeapSnapshot(heap_profiler, uid3)); |
+ CHECK_EQ(NULL, FindHeapSnapshot(heap_profiler, uid3)); |
} |
@@ -1688,11 +1699,10 @@ TEST(GlobalObjectName) { |
&name_resolver); |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
- CHECK(global); |
- CHECK_EQ(0, |
- strcmp("Object / Global object name", |
- const_cast<i::HeapEntry*>( |
- reinterpret_cast<const i::HeapEntry*>(global))->name())); |
+ CHECK_NE(NULL, global); |
+ CHECK_EQ("Object / Global object name" , |
+ const_cast<i::HeapEntry*>( |
+ reinterpret_cast<const i::HeapEntry*>(global))->name()); |
} |
@@ -1707,13 +1717,13 @@ TEST(GlobalObjectFields) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* builtins = |
GetProperty(global, v8::HeapGraphEdge::kInternal, "builtins"); |
- CHECK(builtins); |
+ CHECK_NE(NULL, builtins); |
const v8::HeapGraphNode* native_context = |
GetProperty(global, v8::HeapGraphEdge::kInternal, "native_context"); |
- CHECK(native_context); |
+ CHECK_NE(NULL, native_context); |
const v8::HeapGraphNode* global_proxy = |
GetProperty(global, v8::HeapGraphEdge::kInternal, "global_proxy"); |
- CHECK(global_proxy); |
+ CHECK_NE(NULL, global_proxy); |
} |
@@ -1741,7 +1751,7 @@ TEST(NodesIteration) { |
heap_profiler->TakeHeapSnapshot(v8_str("iteration")); |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
- CHECK(global); |
+ CHECK_NE(NULL, global); |
// Verify that we can find this object by iteration. |
const int nodes_count = snapshot->GetNodesCount(); |
int count = 0; |
@@ -1890,19 +1900,19 @@ TEST(FastCaseAccessors) { |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
- CHECK(global); |
+ CHECK_NE(NULL, global); |
const v8::HeapGraphNode* obj1 = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj1"); |
- CHECK(obj1); |
+ CHECK_NE(NULL, obj1); |
const v8::HeapGraphNode* func; |
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithGetter"); |
- CHECK(func); |
+ CHECK_NE(NULL, func); |
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithGetter"); |
- CHECK(!func); |
+ CHECK_EQ(NULL, func); |
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithSetter"); |
- CHECK(func); |
+ CHECK_NE(NULL, func); |
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithSetter"); |
- CHECK(!func); |
+ CHECK_EQ(NULL, func); |
} |
@@ -1935,15 +1945,15 @@ TEST(FastCaseRedefinedAccessors) { |
heap_profiler->TakeHeapSnapshot(v8_str("fastCaseAccessors")); |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
- CHECK(global); |
+ CHECK_NE(NULL, global); |
const v8::HeapGraphNode* obj1 = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj1"); |
- CHECK(obj1); |
+ CHECK_NE(NULL, obj1); |
const v8::HeapGraphNode* func; |
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get prop"); |
- CHECK(func); |
+ CHECK_NE(NULL, func); |
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set prop"); |
- CHECK(func); |
+ CHECK_NE(NULL, func); |
} |
@@ -1965,19 +1975,19 @@ TEST(SlowCaseAccessors) { |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
- CHECK(global); |
+ CHECK_NE(NULL, global); |
const v8::HeapGraphNode* obj1 = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj1"); |
- CHECK(obj1); |
+ CHECK_NE(NULL, obj1); |
const v8::HeapGraphNode* func; |
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithGetter"); |
- CHECK(func); |
+ CHECK_NE(NULL, func); |
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithGetter"); |
- CHECK(!func); |
+ CHECK_EQ(NULL, func); |
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithSetter"); |
- CHECK(func); |
+ CHECK_NE(NULL, func); |
func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithSetter"); |
- CHECK(!func); |
+ CHECK_EQ(NULL, func); |
} |
@@ -1996,10 +2006,10 @@ TEST(HiddenPropertiesFastCase) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* c = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "c"); |
- CHECK(c); |
+ CHECK_NE(NULL, c); |
const v8::HeapGraphNode* hidden_props = |
GetProperty(c, v8::HeapGraphEdge::kInternal, "hidden_properties"); |
- CHECK(!hidden_props); |
+ CHECK_EQ(NULL, hidden_props); |
v8::Handle<v8::Value> cHandle = |
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "c")); |
@@ -2011,10 +2021,10 @@ TEST(HiddenPropertiesFastCase) { |
CHECK(ValidateSnapshot(snapshot)); |
global = GetGlobalObject(snapshot); |
c = GetProperty(global, v8::HeapGraphEdge::kProperty, "c"); |
- CHECK(c); |
+ CHECK_NE(NULL, c); |
hidden_props = GetProperty(c, v8::HeapGraphEdge::kInternal, |
"hidden_properties"); |
- CHECK(hidden_props); |
+ CHECK_NE(NULL, hidden_props); |
} |
@@ -2030,31 +2040,31 @@ TEST(AccessorInfo) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* foo = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "foo"); |
- CHECK(foo); |
+ CHECK_NE(NULL, foo); |
const v8::HeapGraphNode* map = |
GetProperty(foo, v8::HeapGraphEdge::kInternal, "map"); |
- CHECK(map); |
+ CHECK_NE(NULL, map); |
const v8::HeapGraphNode* descriptors = |
GetProperty(map, v8::HeapGraphEdge::kInternal, "descriptors"); |
- CHECK(descriptors); |
+ CHECK_NE(NULL, descriptors); |
const v8::HeapGraphNode* length_name = |
GetProperty(descriptors, v8::HeapGraphEdge::kInternal, "2"); |
- CHECK(length_name); |
- CHECK_EQ(0, strcmp("length", *v8::String::Utf8Value(length_name->GetName()))); |
+ CHECK_NE(NULL, length_name); |
+ CHECK_EQ("length", *v8::String::Utf8Value(length_name->GetName())); |
const v8::HeapGraphNode* length_accessor = |
GetProperty(descriptors, v8::HeapGraphEdge::kInternal, "4"); |
- CHECK(length_accessor); |
- CHECK_EQ(0, strcmp("system / ExecutableAccessorInfo", |
- *v8::String::Utf8Value(length_accessor->GetName()))); |
+ CHECK_NE(NULL, length_accessor); |
+ CHECK_EQ("system / ExecutableAccessorInfo", |
+ *v8::String::Utf8Value(length_accessor->GetName())); |
const v8::HeapGraphNode* name = |
GetProperty(length_accessor, v8::HeapGraphEdge::kInternal, "name"); |
- CHECK(name); |
+ CHECK_NE(NULL, name); |
const v8::HeapGraphNode* getter = |
GetProperty(length_accessor, v8::HeapGraphEdge::kInternal, "getter"); |
- CHECK(getter); |
+ CHECK_NE(NULL, getter); |
const v8::HeapGraphNode* setter = |
GetProperty(length_accessor, v8::HeapGraphEdge::kInternal, "setter"); |
- CHECK(setter); |
+ CHECK_NE(NULL, setter); |
} |
@@ -2075,10 +2085,10 @@ bool HasWeakGlobalHandle() { |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* gc_roots = GetNode( |
snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "(GC roots)"); |
- CHECK(gc_roots); |
+ CHECK_NE(NULL, gc_roots); |
const v8::HeapGraphNode* global_handles = GetNode( |
gc_roots, v8::HeapGraphNode::kSynthetic, "(Global handles)"); |
- CHECK(global_handles); |
+ CHECK_NE(NULL, global_handles); |
return HasWeakEdge(global_handles); |
} |
@@ -2115,7 +2125,7 @@ TEST(SfiAndJsFunctionWeakRefs) { |
heap_profiler->TakeHeapSnapshot(v8_str("fun")); |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
- CHECK(global); |
+ CHECK_NE(NULL, global); |
const v8::HeapGraphNode* fun = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "fun"); |
CHECK(!HasWeakEdge(fun)); |
@@ -2144,7 +2154,7 @@ TEST(NoDebugObjectInSnapshot) { |
const v8::HeapGraphNode* global = edge->GetToNode(); |
const v8::HeapGraphNode* foo = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "foo"); |
- CHECK(foo); |
+ CHECK_NE(NULL, foo); |
} |
} |
CHECK_EQ(1, globals_count); |
@@ -2162,10 +2172,10 @@ TEST(AllStrongGcRootsHaveNames) { |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* gc_roots = GetNode( |
snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "(GC roots)"); |
- CHECK(gc_roots); |
+ CHECK_NE(NULL, gc_roots); |
const v8::HeapGraphNode* strong_roots = GetNode( |
gc_roots, v8::HeapGraphNode::kSynthetic, "(Strong roots)"); |
- CHECK(strong_roots); |
+ CHECK_NE(NULL, strong_roots); |
for (int i = 0; i < strong_roots->GetChildrenCount(); ++i) { |
const v8::HeapGraphEdge* edge = strong_roots->GetChild(i); |
CHECK_EQ(v8::HeapGraphEdge::kInternal, edge->GetType()); |
@@ -2186,13 +2196,13 @@ TEST(NoRefsToNonEssentialEntries) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* global_object = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "global_object"); |
- CHECK(global_object); |
+ CHECK_NE(NULL, global_object); |
const v8::HeapGraphNode* properties = |
GetProperty(global_object, v8::HeapGraphEdge::kInternal, "properties"); |
- CHECK(!properties); |
+ CHECK_EQ(NULL, properties); |
const v8::HeapGraphNode* elements = |
GetProperty(global_object, v8::HeapGraphEdge::kInternal, "elements"); |
- CHECK(!elements); |
+ CHECK_EQ(NULL, elements); |
} |
@@ -2207,17 +2217,17 @@ TEST(MapHasDescriptorsAndTransitions) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* global_object = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj"); |
- CHECK(global_object); |
+ CHECK_NE(NULL, global_object); |
const v8::HeapGraphNode* map = |
GetProperty(global_object, v8::HeapGraphEdge::kInternal, "map"); |
- CHECK(map); |
+ CHECK_NE(NULL, map); |
const v8::HeapGraphNode* own_descriptors = GetProperty( |
map, v8::HeapGraphEdge::kInternal, "descriptors"); |
- CHECK(own_descriptors); |
+ CHECK_NE(NULL, own_descriptors); |
const v8::HeapGraphNode* own_transitions = GetProperty( |
map, v8::HeapGraphEdge::kInternal, "transitions"); |
- CHECK(!own_transitions); |
+ CHECK_EQ(NULL, own_transitions); |
} |
@@ -2245,13 +2255,13 @@ TEST(ManyLocalsInSharedContext) { |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
- CHECK(global); |
+ CHECK_NE(NULL, global); |
const v8::HeapGraphNode* ok_object = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "ok"); |
- CHECK(ok_object); |
+ CHECK_NE(NULL, ok_object); |
const v8::HeapGraphNode* context_object = |
GetProperty(ok_object, v8::HeapGraphEdge::kInternal, "context"); |
- CHECK(context_object); |
+ CHECK_NE(NULL, context_object); |
// Check the objects are not duplicated in the context. |
CHECK_EQ(v8::internal::Context::MIN_CONTEXT_SLOTS + num_objects - 1, |
context_object->GetChildrenCount()); |
@@ -2262,7 +2272,7 @@ TEST(ManyLocalsInSharedContext) { |
i::SNPrintF(var_name, "f_%d", i); |
const v8::HeapGraphNode* f_object = GetProperty( |
context_object, v8::HeapGraphEdge::kContextVariable, var_name.start()); |
- CHECK(f_object); |
+ CHECK_NE(NULL, f_object); |
} |
} |
@@ -2280,13 +2290,13 @@ TEST(AllocationSitesAreVisible) { |
CHECK(ValidateSnapshot(snapshot)); |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
- CHECK(global); |
+ CHECK_NE(NULL, global); |
const v8::HeapGraphNode* fun_code = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "fun"); |
- CHECK(fun_code); |
+ CHECK_NE(NULL, fun_code); |
const v8::HeapGraphNode* literals = |
GetProperty(fun_code, v8::HeapGraphEdge::kInternal, "literals"); |
- CHECK(literals); |
+ CHECK_NE(NULL, literals); |
CHECK_EQ(v8::HeapGraphNode::kArray, literals->GetType()); |
CHECK_EQ(2, literals->GetChildrenCount()); |
@@ -2295,16 +2305,16 @@ TEST(AllocationSitesAreVisible) { |
const v8::HeapGraphEdge* prop = literals->GetChild(1); |
const v8::HeapGraphNode* allocation_site = prop->GetToNode(); |
v8::String::Utf8Value name(allocation_site->GetName()); |
- CHECK_EQ(0, strcmp("system / AllocationSite", *name)); |
+ CHECK_EQ("system / AllocationSite", *name); |
const v8::HeapGraphNode* transition_info = |
GetProperty(allocation_site, v8::HeapGraphEdge::kInternal, |
"transition_info"); |
- CHECK(transition_info); |
+ CHECK_NE(NULL, transition_info); |
const v8::HeapGraphNode* elements = |
GetProperty(transition_info, v8::HeapGraphEdge::kInternal, |
"elements"); |
- CHECK(elements); |
+ CHECK_NE(NULL, elements); |
CHECK_EQ(v8::HeapGraphNode::kArray, elements->GetType()); |
CHECK_EQ(v8::internal::FixedArray::SizeFor(3), |
static_cast<int>(elements->GetShallowSize())); |
@@ -2314,13 +2324,13 @@ TEST(AllocationSitesAreVisible) { |
CHECK(array_val->IsArray()); |
v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(array_val); |
// Verify the array is "a" in the code above. |
- CHECK_EQ(3u, array->Length()); |
- CHECK(v8::Integer::New(isolate, 3) |
- ->Equals(array->Get(v8::Integer::New(isolate, 0)))); |
- CHECK(v8::Integer::New(isolate, 2) |
- ->Equals(array->Get(v8::Integer::New(isolate, 1)))); |
- CHECK(v8::Integer::New(isolate, 1) |
- ->Equals(array->Get(v8::Integer::New(isolate, 2)))); |
+ CHECK_EQ(3, array->Length()); |
+ CHECK_EQ(v8::Integer::New(isolate, 3), |
+ array->Get(v8::Integer::New(isolate, 0))); |
+ CHECK_EQ(v8::Integer::New(isolate, 2), |
+ array->Get(v8::Integer::New(isolate, 1))); |
+ CHECK_EQ(v8::Integer::New(isolate, 1), |
+ array->Get(v8::Integer::New(isolate, 2))); |
} |
@@ -2335,10 +2345,10 @@ TEST(JSFunctionHasCodeLink) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* foo_func = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "foo"); |
- CHECK(foo_func); |
+ CHECK_NE(NULL, foo_func); |
const v8::HeapGraphNode* code = |
GetProperty(foo_func, v8::HeapGraphEdge::kInternal, "code"); |
- CHECK(code); |
+ CHECK_NE(NULL, code); |
} |
@@ -2383,7 +2393,7 @@ TEST(CheckCodeNames) { |
}; |
const v8::HeapGraphNode* node = GetNodeByPath(snapshot, |
stub_path, arraysize(stub_path)); |
- CHECK(node); |
+ CHECK_NE(NULL, node); |
const char* builtin_path1[] = { |
"::(GC roots)", |
@@ -2391,14 +2401,14 @@ TEST(CheckCodeNames) { |
"::(KeyedLoadIC_Generic builtin)" |
}; |
node = GetNodeByPath(snapshot, builtin_path1, arraysize(builtin_path1)); |
- CHECK(node); |
+ CHECK_NE(NULL, node); |
const char* builtin_path2[] = {"::(GC roots)", "::(Builtins)", |
"::(CompileLazy builtin)"}; |
node = GetNodeByPath(snapshot, builtin_path2, arraysize(builtin_path2)); |
- CHECK(node); |
+ CHECK_NE(NULL, node); |
v8::String::Utf8Value node_name(node->GetName()); |
- CHECK_EQ(0, strcmp("(CompileLazy builtin)", *node_name)); |
+ CHECK_EQ("(CompileLazy builtin)", *node_name); |
} |
@@ -2481,7 +2491,7 @@ TEST(ArrayGrowLeftTrim) { |
const char* names[] = {""}; |
AllocationTracker* tracker = |
reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker(); |
- CHECK(tracker); |
+ CHECK_NE(NULL, tracker); |
// Resolve all function locations. |
tracker->PrepareForSerialization(); |
// Print for better diagnostics in case of failure. |
@@ -2489,9 +2499,9 @@ TEST(ArrayGrowLeftTrim) { |
AllocationTraceNode* node = |
FindNode(tracker, Vector<const char*>(names, arraysize(names))); |
- CHECK(node); |
- CHECK_GE(node->allocation_count(), 2u); |
- CHECK_GE(node->allocation_size(), 4u * 5u); |
+ CHECK_NE(NULL, node); |
+ CHECK_GE(node->allocation_count(), 2); |
+ CHECK_GE(node->allocation_size(), 4 * 5); |
heap_profiler->StopTrackingHeapObjects(); |
} |
@@ -2507,7 +2517,7 @@ TEST(TrackHeapAllocations) { |
AllocationTracker* tracker = |
reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker(); |
- CHECK(tracker); |
+ CHECK_NE(NULL, tracker); |
// Resolve all function locations. |
tracker->PrepareForSerialization(); |
// Print for better diagnostics in case of failure. |
@@ -2516,8 +2526,8 @@ TEST(TrackHeapAllocations) { |
const char* names[] = {"", "start", "f_0_0", "f_0_1", "f_0_2"}; |
AllocationTraceNode* node = |
FindNode(tracker, Vector<const char*>(names, arraysize(names))); |
- CHECK(node); |
- CHECK_GE(node->allocation_count(), 100u); |
+ CHECK_NE(NULL, node); |
+ CHECK_GE(node->allocation_count(), 100); |
CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); |
heap_profiler->StopTrackingHeapObjects(); |
} |
@@ -2557,7 +2567,7 @@ TEST(TrackBumpPointerAllocations) { |
AllocationTracker* tracker = |
reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker(); |
- CHECK(tracker); |
+ CHECK_NE(NULL, tracker); |
// Resolve all function locations. |
tracker->PrepareForSerialization(); |
// Print for better diagnostics in case of failure. |
@@ -2565,8 +2575,8 @@ TEST(TrackBumpPointerAllocations) { |
AllocationTraceNode* node = |
FindNode(tracker, Vector<const char*>(names, arraysize(names))); |
- CHECK(node); |
- CHECK_GE(node->allocation_count(), 100u); |
+ CHECK_NE(NULL, node); |
+ CHECK_GE(node->allocation_count(), 100); |
CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); |
heap_profiler->StopTrackingHeapObjects(); |
} |
@@ -2583,7 +2593,7 @@ TEST(TrackBumpPointerAllocations) { |
AllocationTracker* tracker = |
reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker(); |
- CHECK(tracker); |
+ CHECK_NE(NULL, tracker); |
// Resolve all function locations. |
tracker->PrepareForSerialization(); |
// Print for better diagnostics in case of failure. |
@@ -2591,8 +2601,8 @@ TEST(TrackBumpPointerAllocations) { |
AllocationTraceNode* node = |
FindNode(tracker, Vector<const char*>(names, arraysize(names))); |
- CHECK(node); |
- CHECK_LT(node->allocation_count(), 100u); |
+ CHECK_NE(NULL, node); |
+ CHECK_LT(node->allocation_count(), 100); |
CcTest::heap()->DisableInlineAllocation(); |
heap_profiler->StopTrackingHeapObjects(); |
@@ -2613,7 +2623,7 @@ TEST(TrackV8ApiAllocation) { |
AllocationTracker* tracker = |
reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker(); |
- CHECK(tracker); |
+ CHECK_NE(NULL, tracker); |
// Resolve all function locations. |
tracker->PrepareForSerialization(); |
// Print for better diagnostics in case of failure. |
@@ -2621,8 +2631,8 @@ TEST(TrackV8ApiAllocation) { |
AllocationTraceNode* node = |
FindNode(tracker, Vector<const char*>(names, arraysize(names))); |
- CHECK(node); |
- CHECK_GE(node->allocation_count(), 2u); |
+ CHECK_NE(NULL, node); |
+ CHECK_GE(node->allocation_count(), 2); |
CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); |
heap_profiler->StopTrackingHeapObjects(); |
} |
@@ -2639,16 +2649,16 @@ TEST(ArrayBufferAndArrayBufferView) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* arr1_obj = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "arr1"); |
- CHECK(arr1_obj); |
+ CHECK_NE(NULL, arr1_obj); |
const v8::HeapGraphNode* arr1_buffer = |
GetProperty(arr1_obj, v8::HeapGraphEdge::kInternal, "buffer"); |
- CHECK(arr1_buffer); |
+ CHECK_NE(NULL, arr1_buffer); |
const v8::HeapGraphNode* first_view = |
GetProperty(arr1_buffer, v8::HeapGraphEdge::kWeak, "weak_first_view"); |
- CHECK(first_view); |
+ CHECK_NE(NULL, first_view); |
const v8::HeapGraphNode* backing_store = |
GetProperty(arr1_buffer, v8::HeapGraphEdge::kInternal, "backing_store"); |
- CHECK(backing_store); |
+ CHECK_NE(NULL, backing_store); |
CHECK_EQ(400, static_cast<int>(backing_store->GetShallowSize())); |
} |
@@ -2698,16 +2708,16 @@ TEST(ArrayBufferSharedBackingStore) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* ab1_node = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "ab1"); |
- CHECK(ab1_node); |
+ CHECK_NE(NULL, ab1_node); |
const v8::HeapGraphNode* ab1_data = |
GetProperty(ab1_node, v8::HeapGraphEdge::kInternal, "backing_store"); |
- CHECK(ab1_data); |
+ CHECK_NE(NULL, ab1_data); |
const v8::HeapGraphNode* ab2_node = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "ab2"); |
- CHECK(ab2_node); |
+ CHECK_NE(NULL, ab2_node); |
const v8::HeapGraphNode* ab2_data = |
GetProperty(ab2_node, v8::HeapGraphEdge::kInternal, "backing_store"); |
- CHECK(ab2_data); |
+ CHECK_NE(NULL, ab2_data); |
CHECK_EQ(ab1_data, ab2_data); |
CHECK_EQ(2, GetRetainersCount(snapshot, ab1_data)); |
free(data); |
@@ -2733,12 +2743,12 @@ TEST(BoxObject) { |
const v8::HeapGraphNode* global_node = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* box_node = |
GetProperty(global_node, v8::HeapGraphEdge::kElement, "0"); |
- CHECK(box_node); |
+ CHECK_NE(NULL, box_node); |
v8::String::Utf8Value box_node_name(box_node->GetName()); |
- CHECK_EQ(0, strcmp("system / Box", *box_node_name)); |
+ CHECK_EQ("system / Box", *box_node_name); |
const v8::HeapGraphNode* box_value = |
GetProperty(box_node, v8::HeapGraphEdge::kInternal, "value"); |
- CHECK(box_value); |
+ CHECK_NE(NULL, box_value); |
} |
@@ -2761,10 +2771,10 @@ TEST(WeakContainers) { |
const v8::HeapGraphNode* global = GetGlobalObject(snapshot); |
const v8::HeapGraphNode* obj = |
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj"); |
- CHECK(obj); |
+ CHECK_NE(NULL, obj); |
const v8::HeapGraphNode* map = |
GetProperty(obj, v8::HeapGraphEdge::kInternal, "map"); |
- CHECK(map); |
+ CHECK_NE(NULL, map); |
const v8::HeapGraphNode* dependent_code = |
GetProperty(map, v8::HeapGraphEdge::kInternal, "dependent_code"); |
if (!dependent_code) return; |
@@ -2785,53 +2795,53 @@ static inline i::Address ToAddress(int n) { |
TEST(AddressToTraceMap) { |
i::AddressToTraceMap map; |
- CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(150))); |
+ CHECK_EQ(0, map.GetTraceNodeId(ToAddress(150))); |
// [0x100, 0x200) -> 1 |
map.AddRange(ToAddress(0x100), 0x100, 1U); |
- CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x50))); |
- CHECK_EQ(1u, map.GetTraceNodeId(ToAddress(0x100))); |
- CHECK_EQ(1u, map.GetTraceNodeId(ToAddress(0x150))); |
- CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x100 + 0x100))); |
- CHECK_EQ(1u, map.size()); |
+ CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x50))); |
+ CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x100))); |
+ CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x150))); |
+ CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x100 + 0x100))); |
+ CHECK_EQ(1, static_cast<int>(map.size())); |
// [0x100, 0x200) -> 1, [0x200, 0x300) -> 2 |
map.AddRange(ToAddress(0x200), 0x100, 2U); |
- CHECK_EQ(2u, map.GetTraceNodeId(ToAddress(0x2a0))); |
- CHECK_EQ(2u, map.size()); |
+ CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x2a0))); |
+ CHECK_EQ(2, static_cast<int>(map.size())); |
// [0x100, 0x180) -> 1, [0x180, 0x280) -> 3, [0x280, 0x300) -> 2 |
map.AddRange(ToAddress(0x180), 0x100, 3U); |
- CHECK_EQ(1u, map.GetTraceNodeId(ToAddress(0x17F))); |
- CHECK_EQ(2u, map.GetTraceNodeId(ToAddress(0x280))); |
- CHECK_EQ(3u, map.GetTraceNodeId(ToAddress(0x180))); |
- CHECK_EQ(3u, map.size()); |
+ CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x17F))); |
+ CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x280))); |
+ CHECK_EQ(3, map.GetTraceNodeId(ToAddress(0x180))); |
+ CHECK_EQ(3, static_cast<int>(map.size())); |
// [0x100, 0x180) -> 1, [0x180, 0x280) -> 3, [0x280, 0x300) -> 2, |
// [0x400, 0x500) -> 4 |
map.AddRange(ToAddress(0x400), 0x100, 4U); |
- CHECK_EQ(1u, map.GetTraceNodeId(ToAddress(0x17F))); |
- CHECK_EQ(2u, map.GetTraceNodeId(ToAddress(0x280))); |
- CHECK_EQ(3u, map.GetTraceNodeId(ToAddress(0x180))); |
- CHECK_EQ(4u, map.GetTraceNodeId(ToAddress(0x450))); |
- CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x500))); |
- CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x350))); |
- CHECK_EQ(4u, map.size()); |
+ CHECK_EQ(1, map.GetTraceNodeId(ToAddress(0x17F))); |
+ CHECK_EQ(2, map.GetTraceNodeId(ToAddress(0x280))); |
+ CHECK_EQ(3, map.GetTraceNodeId(ToAddress(0x180))); |
+ CHECK_EQ(4, map.GetTraceNodeId(ToAddress(0x450))); |
+ CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x500))); |
+ CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x350))); |
+ CHECK_EQ(4, static_cast<int>(map.size())); |
// [0x100, 0x180) -> 1, [0x180, 0x200) -> 3, [0x200, 0x600) -> 5 |
map.AddRange(ToAddress(0x200), 0x400, 5U); |
- CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); |
- CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x400))); |
- CHECK_EQ(3u, map.size()); |
+ CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); |
+ CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x400))); |
+ CHECK_EQ(3, static_cast<int>(map.size())); |
// [0x100, 0x180) -> 1, [0x180, 0x200) -> 7, [0x200, 0x600) ->5 |
map.AddRange(ToAddress(0x180), 0x80, 6U); |
map.AddRange(ToAddress(0x180), 0x80, 7U); |
- CHECK_EQ(7u, map.GetTraceNodeId(ToAddress(0x180))); |
- CHECK_EQ(5u, map.GetTraceNodeId(ToAddress(0x200))); |
- CHECK_EQ(3u, map.size()); |
+ CHECK_EQ(7, map.GetTraceNodeId(ToAddress(0x180))); |
+ CHECK_EQ(5, map.GetTraceNodeId(ToAddress(0x200))); |
+ CHECK_EQ(3, static_cast<int>(map.size())); |
map.Clear(); |
- CHECK_EQ(0u, map.size()); |
- CHECK_EQ(0u, map.GetTraceNodeId(ToAddress(0x400))); |
+ CHECK_EQ(0, static_cast<int>(map.size())); |
+ CHECK_EQ(0, map.GetTraceNodeId(ToAddress(0x400))); |
} |