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

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

Issue 805453002: Introduced PropertyType ACCESSOR_FIELD. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments Created 6 years 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/property-details.h ('k') | test/cctest/test-transitions.cc » ('j') | 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 203b174746b21650fdc9d91495908a872243dfcc..94a5be47c197a3f0157ab8fa4a00bdb8071c3249 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -1916,6 +1916,47 @@ TEST(FastCaseAccessors) {
}
+TEST(FastCaseRedefinedAccessors) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+
+ CompileRun(
+ "var obj1 = {};\n"
+ "Object.defineProperty(obj1, 'prop', { "
+ " get: function() { return 42; },\n"
+ " set: function(value) { return this.prop_ = value; },\n"
+ " configurable: true,\n"
+ " enumerable: true,\n"
+ "});\n"
+ "Object.defineProperty(obj1, 'prop', { "
+ " get: function() { return 153; },\n"
+ " set: function(value) { return this.prop_ = value; },\n"
+ " configurable: true,\n"
+ " enumerable: true,\n"
+ "});\n");
+ v8::Local<v8::Object> js_global =
+ env->Global()->GetPrototype().As<v8::Object>();
+ i::Handle<i::JSObject> js_obj1 =
+ v8::Utils::OpenHandle(*js_global->Get(v8_str("obj1")).As<v8::Object>());
+ USE(js_obj1);
+
+ const v8::HeapSnapshot* snapshot =
+ heap_profiler->TakeHeapSnapshot(v8_str("fastCaseAccessors"));
+ CHECK(ValidateSnapshot(snapshot));
+ 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 prop");
+ CHECK_NE(NULL, func);
+ func = GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set prop");
+ CHECK_NE(NULL, func);
+}
+
+
TEST(SlowCaseAccessors) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
« no previous file with comments | « src/property-details.h ('k') | test/cctest/test-transitions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698