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

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

Issue 12212011: Make __proto__ a foreign callback on Object.prototype. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added regression test for issue 2441. Created 7 years, 10 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/property.h ('k') | test/mjsunit/builtins.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 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 CheckThisNamedPropertyHandler, 1842 CheckThisNamedPropertyHandler,
1843 CheckThisNamedPropertySetter, 1843 CheckThisNamedPropertySetter,
1844 CheckThisNamedPropertyQuery, 1844 CheckThisNamedPropertyQuery,
1845 CheckThisNamedPropertyDeleter, 1845 CheckThisNamedPropertyDeleter,
1846 CheckThisNamedPropertyEnumerator); 1846 CheckThisNamedPropertyEnumerator);
1847 1847
1848 bottom = templ->GetFunction()->NewInstance(); 1848 bottom = templ->GetFunction()->NewInstance();
1849 Local<v8::Object> top = templ->GetFunction()->NewInstance(); 1849 Local<v8::Object> top = templ->GetFunction()->NewInstance();
1850 Local<v8::Object> middle = templ->GetFunction()->NewInstance(); 1850 Local<v8::Object> middle = templ->GetFunction()->NewInstance();
1851 1851
1852 bottom->Set(v8_str("__proto__"), middle); 1852 bottom->SetPrototype(middle);
1853 middle->Set(v8_str("__proto__"), top); 1853 middle->SetPrototype(top);
1854 env->Global()->Set(v8_str("obj"), bottom); 1854 env->Global()->Set(v8_str("obj"), bottom);
1855 1855
1856 // Indexed and named get. 1856 // Indexed and named get.
1857 Script::Compile(v8_str("obj[0]"))->Run(); 1857 Script::Compile(v8_str("obj[0]"))->Run();
1858 Script::Compile(v8_str("obj.x"))->Run(); 1858 Script::Compile(v8_str("obj.x"))->Run();
1859 1859
1860 // Indexed and named set. 1860 // Indexed and named set.
1861 Script::Compile(v8_str("obj[1] = 42"))->Run(); 1861 Script::Compile(v8_str("obj[1] = 42"))->Run();
1862 Script::Compile(v8_str("obj.y = 42"))->Run(); 1862 Script::Compile(v8_str("obj.y = 42"))->Run();
1863 1863
(...skipping 7779 matching lines...) Expand 10 before | Expand all | Expand 10 after
9643 // is invoked 9643 // is invoked
9644 THREADED_TEST(InterceptorCallICCacheableNotNeeded) { 9644 THREADED_TEST(InterceptorCallICCacheableNotNeeded) {
9645 v8::HandleScope scope; 9645 v8::HandleScope scope;
9646 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); 9646 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New();
9647 templ->SetNamedPropertyHandler(InterceptorCallICGetter4); 9647 templ->SetNamedPropertyHandler(InterceptorCallICGetter4);
9648 LocalContext context; 9648 LocalContext context;
9649 context->Global()->Set(v8_str("o"), templ->NewInstance()); 9649 context->Global()->Set(v8_str("o"), templ->NewInstance());
9650 call_ic_function4 = 9650 call_ic_function4 =
9651 v8_compile("function f(x) { return x - 1; }; f")->Run(); 9651 v8_compile("function f(x) { return x - 1; }; f")->Run();
9652 v8::Handle<Value> value = CompileRun( 9652 v8::Handle<Value> value = CompileRun(
9653 "o.__proto__.x = function(x) { return x + 1; };" 9653 "Object.getPrototypeOf(o).x = function(x) { return x + 1; };"
9654 "var result = 0;" 9654 "var result = 0;"
9655 "for (var i = 0; i < 1000; i++) {" 9655 "for (var i = 0; i < 1000; i++) {"
9656 " result = o.x(42);" 9656 " result = o.x(42);"
9657 "}"); 9657 "}");
9658 CHECK_EQ(41, value->Int32Value()); 9658 CHECK_EQ(41, value->Int32Value());
9659 } 9659 }
9660 9660
9661 9661
9662 // Test the case when we stored cacheable lookup into 9662 // Test the case when we stored cacheable lookup into
9663 // a stub, but it got invalidated later on 9663 // a stub, but it got invalidated later on
(...skipping 8548 matching lines...) Expand 10 before | Expand all | Expand 10 after
18212 i::Semaphore* sem_; 18212 i::Semaphore* sem_;
18213 volatile int sem_value_; 18213 volatile int sem_value_;
18214 }; 18214 };
18215 18215
18216 18216
18217 THREADED_TEST(SemaphoreInterruption) { 18217 THREADED_TEST(SemaphoreInterruption) {
18218 ThreadInterruptTest().RunTest(); 18218 ThreadInterruptTest().RunTest();
18219 } 18219 }
18220 18220
18221 #endif // WIN32 18221 #endif // WIN32
OLDNEW
« no previous file with comments | « src/property.h ('k') | test/mjsunit/builtins.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698