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

Unified Diff: test/cctest/test-heap-profiler.cc

Issue 3128004: Fix issue 822: handling of JSObject::elements in CalculateNetworkSize. (Closed)
Patch Set: Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/profile-generator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap-profiler.cc
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
index d3bcf478fb441f1203d673204c56a43b8dffe4ef..92ad0a4002a1fbd967a3bf03a4324ec8be8c290d 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -833,4 +833,35 @@ TEST(HeapSnapshotsDiff) {
CHECK(s1_A_id != s2_A_id);
}
+
+namespace v8 {
+namespace internal {
+
+class HeapSnapshotTester {
+ public:
+ static int CalculateNetworkSize(JSObject* obj) {
+ return HeapSnapshot::CalculateNetworkSize(obj);
+ }
+};
+
+} } // namespace v8::internal
+
+// http://code.google.com/p/v8/issues/detail?id=822
+// Trying to call CalculateNetworkSize on an object with elements set
+// to non-FixedArray may cause an assertion error in debug builds.
+TEST(Issue822) {
+ v8::HandleScope scope;
+ LocalContext context;
+ const int kElementCount = 260;
+ uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount));
+ i::Handle<i::PixelArray> pixels = i::Factory::NewPixelArray(kElementCount,
+ pixel_data);
+ v8::Handle<v8::Object> obj = v8::Object::New();
+ // Set the elements to be the pixels.
+ obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount);
+ i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
+ // This call must not cause an assertion error in debug builds.
+ i::HeapSnapshotTester::CalculateNetworkSize(*jsobj);
+}
+
#endif // ENABLE_LOGGING_AND_PROFILING
« no previous file with comments | « src/profile-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698