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

Unified Diff: test/cctest/test-api.cc

Issue 1332003: Port number dictionary probing in generated code to ARM.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 side-by-side diff with in-line comments
Download patch
« src/x64/ic-x64.cc ('K') | « src/x64/ic-x64.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-api.cc
===================================================================
--- test/cctest/test-api.cc (revision 4253)
+++ test/cctest/test-api.cc (working copy)
@@ -2644,6 +2644,36 @@
}
+THREADED_TEST(NamedInterceptorDictionaryIC) {
+ v8::HandleScope scope;
+ Local<ObjectTemplate> templ = ObjectTemplate::New();
+ templ->SetNamedPropertyHandler(XPropertyGetter);
+ LocalContext context;
+ // Create an object with a named interceptor.
+ context->Global()->Set(v8_str("interceptor_obj"), templ->NewInstance());
+ Local<Script> script = Script::Compile(v8_str("interceptor_obj.x"));
+ for (int i = 0; i < 10; i++) {
+ Local<Value> result = script->Run();
+ CHECK_EQ(result, v8_str("x"));
+ }
+ // Create a slow case object and a function accessing a property in
+ // that slow case object (with dictionary probing in generated
+ // code). Then force object with a named interceptor into slow-case,
+ // pass it to the function, and check that the interceptor is called
+ // instead of accessing the local property.
+ Local<Value> result =
+ CompileRun("function get_x(o) { return o.x; };"
+ "var obj = { x : 42, y : 0 };"
+ "delete obj.y;"
+ "for (var i = 0; i < 10; i++) get_x(obj);"
+ "interceptor_obj.x = 42;"
+ "interceptor_obj.y = 10;"
+ "delete interceptor_obj.y;"
+ "get_x(interceptor_obj)");
+ CHECK_EQ(result, v8_str("x"));
+}
+
+
static v8::Handle<Value> SetXOnPrototypeGetter(Local<String> property,
const AccessorInfo& info) {
// Set x on the prototype object and do not handle the get request.
« src/x64/ic-x64.cc ('K') | « src/x64/ic-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698