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

Side by Side Diff: test/cctest/test-api.cc

Issue 212623002: Merged r20033, r20138 into 3.24 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.24
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | test/mjsunit/regress/regress-352982.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 21947 matching lines...) Expand 10 before | Expand all | Expand 10 after
21958 21958
21959 21959
21960 TEST(TestFunctionCallOptimization) { 21960 TEST(TestFunctionCallOptimization) {
21961 i::FLAG_allow_natives_syntax = true; 21961 i::FLAG_allow_natives_syntax = true;
21962 ApiCallOptimizationChecker checker; 21962 ApiCallOptimizationChecker checker;
21963 checker.Run(true, true); 21963 checker.Run(true, true);
21964 checker.Run(false, true); 21964 checker.Run(false, true);
21965 checker.Run(true, false); 21965 checker.Run(true, false);
21966 checker.Run(false, false); 21966 checker.Run(false, false);
21967 } 21967 }
21968
21969
21970 TEST(Regress354123) {
21971 LocalContext current;
21972 v8::Isolate* isolate = current->GetIsolate();
21973 v8::HandleScope scope(isolate);
21974
21975 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
21976 templ->SetAccessCheckCallbacks(NamedAccessCounter, IndexedAccessCounter);
21977 current->Global()->Set(v8_str("friend"), templ->NewInstance());
21978
21979 // Test access using __proto__ from the prototype chain.
21980 named_access_count = 0;
21981 CompileRun("friend.__proto__ = {};");
21982 CHECK_EQ(2, named_access_count);
21983 CompileRun("friend.__proto__;");
21984 CHECK_EQ(4, named_access_count);
21985
21986 // Test access using __proto__ as a hijacked function (A).
21987 named_access_count = 0;
21988 CompileRun("var p = Object.prototype;"
21989 "var f = Object.getOwnPropertyDescriptor(p, '__proto__').set;"
21990 "f.call(friend, {});");
21991 CHECK_EQ(1, named_access_count);
21992 CompileRun("var p = Object.prototype;"
21993 "var f = Object.getOwnPropertyDescriptor(p, '__proto__').get;"
21994 "f.call(friend);");
21995 CHECK_EQ(2, named_access_count);
21996
21997 // Test access using __proto__ as a hijacked function (B).
21998 named_access_count = 0;
21999 CompileRun("var f = Object.prototype.__lookupSetter__('__proto__');"
22000 "f.call(friend, {});");
22001 CHECK_EQ(1, named_access_count);
22002 CompileRun("var f = Object.prototype.__lookupGetter__('__proto__');"
22003 "f.call(friend);");
22004 CHECK_EQ(2, named_access_count);
22005
22006 // Test access using Object.setPrototypeOf reflective method.
22007 named_access_count = 0;
22008 CompileRun("Object.setPrototypeOf(friend, {});");
22009 CHECK_EQ(1, named_access_count);
22010 CompileRun("Object.getPrototypeOf(friend);");
22011 CHECK_EQ(2, named_access_count);
22012 }
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | test/mjsunit/regress/regress-352982.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698