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

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

Issue 17616002: Handle AccessorPair struct in heap snapshot. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comments. Created 7 years, 6 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/heap-snapshot-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 33b0fb9299b4117f1b0a091d739129f2303ebc17..2ca6e299494a906657d83520ac09da9a39aa1c93 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -1507,7 +1507,7 @@ TEST(GetConstructorName) {
}
-TEST(FastCaseGetter) {
+TEST(FastCaseAccessors) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
@@ -1520,21 +1520,58 @@ TEST(FastCaseGetter) {
" return this.value_ = value;\n"
"});\n");
const v8::HeapSnapshot* snapshot =
- heap_profiler->TakeHeapSnapshot(v8_str("fastCaseGetter"));
+ heap_profiler->TakeHeapSnapshot(v8_str("fastCaseAccessors"));
const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
CHECK_NE(NULL, global);
const v8::HeapGraphNode* obj1 =
GetProperty(global, v8::HeapGraphEdge::kProperty, "obj1");
CHECK_NE(NULL, obj1);
- const v8::HeapGraphNode* getterFunction =
- GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get-propWithGetter");
- CHECK_NE(NULL, getterFunction);
- const v8::HeapGraphNode* setterFunction =
- GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set-propWithSetter");
- CHECK_NE(NULL, setterFunction);
+ const v8::HeapGraphNode* func;
+ func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithGetter");
+ CHECK_NE(NULL, func);
+ func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithGetter");
+ CHECK_EQ(NULL, func);
+ func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithSetter");
+ CHECK_NE(NULL, func);
+ func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithSetter");
+ CHECK_EQ(NULL, func);
}
+
+TEST(SlowCaseAccessors) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+
+ CompileRun("var obj1 = {};\n"
+ "for (var i = 0; i < 100; ++i) obj1['z' + i] = {};"
+ "obj1.__defineGetter__('propWithGetter', function Y() {\n"
+ " return 42;\n"
+ "});\n"
+ "obj1.__defineSetter__('propWithSetter', function Z(value) {\n"
+ " return this.value_ = value;\n"
+ "});\n");
+ const v8::HeapSnapshot* snapshot =
+ heap_profiler->TakeHeapSnapshot(v8_str("slowCaseAccessors"));
+
+ const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
+ CHECK_NE(NULL, global);
+ const v8::HeapGraphNode* obj1 =
+ GetProperty(global, v8::HeapGraphEdge::kProperty, "obj1");
+ CHECK_NE(NULL, obj1);
+ const v8::HeapGraphNode* func;
+ func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithGetter");
+ CHECK_NE(NULL, func);
+ func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithGetter");
+ CHECK_EQ(NULL, func);
+ func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set propWithSetter");
+ CHECK_NE(NULL, func);
+ func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get propWithSetter");
+ CHECK_EQ(NULL, func);
+}
+
+
TEST(HiddenPropertiesFastCase) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698