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

Side by Side Diff: test/cctest/test-heap-profiler.cc

Issue 8491041: Fix missing fast property accessors in heap snapshots. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments addressed Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« src/objects.cc ('K') | « src/profile-generator.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests for heap profiler 3 // Tests for heap profiler
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "cctest.h" 7 #include "cctest.h"
8 #include "heap-profiler.h" 8 #include "heap-profiler.h"
9 #include "snapshot.h" 9 #include "snapshot.h"
10 #include "utils-inl.h" 10 #include "utils-inl.h"
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 "Constructor4", i::V8HeapExplorer::GetConstructorName(*js_obj4))); 1016 "Constructor4", i::V8HeapExplorer::GetConstructorName(*js_obj4)));
1017 v8::Local<v8::Object> obj5 = js_global->Get(v8_str("obj5")).As<v8::Object>(); 1017 v8::Local<v8::Object> obj5 = js_global->Get(v8_str("obj5")).As<v8::Object>();
1018 i::Handle<i::JSObject> js_obj5 = v8::Utils::OpenHandle(*obj5); 1018 i::Handle<i::JSObject> js_obj5 = v8::Utils::OpenHandle(*obj5);
1019 CHECK_EQ(0, StringCmp( 1019 CHECK_EQ(0, StringCmp(
1020 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj5))); 1020 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj5)));
1021 v8::Local<v8::Object> obj6 = js_global->Get(v8_str("obj6")).As<v8::Object>(); 1021 v8::Local<v8::Object> obj6 = js_global->Get(v8_str("obj6")).As<v8::Object>();
1022 i::Handle<i::JSObject> js_obj6 = v8::Utils::OpenHandle(*obj6); 1022 i::Handle<i::JSObject> js_obj6 = v8::Utils::OpenHandle(*obj6);
1023 CHECK_EQ(0, StringCmp( 1023 CHECK_EQ(0, StringCmp(
1024 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj6))); 1024 "Object", i::V8HeapExplorer::GetConstructorName(*js_obj6)));
1025 } 1025 }
1026
1027 TEST(FastCaseGetter) {
1028 v8::HandleScope scope;
1029 LocalContext env;
1030
1031 CompileRun("var obj1 = {};\n"
1032 "obj1.__defineGetter__('propWithGetter', function Y() {\n"
1033 " return 42;\n"
1034 "});\n"
1035 "obj1.__defineSetter__('propWithSetter', function Z(value) {\n"
1036 " return this.value_ = value;\n"
1037 "});\n");
1038 const v8::HeapSnapshot* snapshot =
1039 v8::HeapProfiler::TakeSnapshot(v8_str("fastCaseGetter"));
1040
1041 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
1042 CHECK_NE(NULL, global);
1043 const v8::HeapGraphNode* obj1 =
1044 GetProperty(global, v8::HeapGraphEdge::kShortcut, "obj1");
1045 CHECK_NE(NULL, obj1);
1046 const v8::HeapGraphNode* getterFunction =
1047 GetProperty(obj1, v8::HeapGraphEdge::kProperty, "get-propWithGetter");
1048 CHECK_NE(NULL, getterFunction);
1049 const v8::HeapGraphNode* setterFunction =
1050 GetProperty(obj1, v8::HeapGraphEdge::kProperty, "set-propWithSetter");
1051 CHECK_NE(NULL, setterFunction);
1052 }
OLDNEW
« src/objects.cc ('K') | « src/profile-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698