Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 46eaccd5395f9590526393bdbbdae4340615a987..6254eaa708a7dff85c1c2447821b702688939ab4 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -6245,12 +6245,25 @@ THREADED_TEST(InterceptorLoadICWithCallbackOnHolder) { |
templ->SetAccessor(v8_str("y"), Return239); |
LocalContext context; |
context->Global()->Set(v8_str("o"), templ->NewInstance()); |
+ |
+ // Check the case when receiver and interceptor's holder |
+ // are the same objects. |
v8::Handle<Value> value = CompileRun( |
"var result = 0;" |
"for (var i = 0; i < 7; i++) {" |
" result = o.y;" |
"}"); |
CHECK_EQ(239, value->Int32Value()); |
+ |
+ // Check the case when interceptor's holder is in proto chain |
+ // of receiver. |
+ value = CompileRun( |
+ "r = { __proto__: o };" |
+ "var result = 0;" |
+ "for (var i = 0; i < 7; i++) {" |
+ " result = r.y;" |
+ "}"); |
+ CHECK_EQ(239, value->Int32Value()); |
} |
@@ -6265,6 +6278,8 @@ THREADED_TEST(InterceptorLoadICWithCallbackOnProto) { |
context->Global()->Set(v8_str("o"), templ_o->NewInstance()); |
context->Global()->Set(v8_str("p"), templ_p->NewInstance()); |
+ // Check the case when receiver and interceptor's holder |
+ // are the same objects. |
v8::Handle<Value> value = CompileRun( |
"o.__proto__ = p;" |
"var result = 0;" |
@@ -6272,6 +6287,16 @@ THREADED_TEST(InterceptorLoadICWithCallbackOnProto) { |
" result = o.x + o.y;" |
"}"); |
CHECK_EQ(239 + 42, value->Int32Value()); |
+ |
+ // Check the case when interceptor's holder is in proto chain |
+ // of receiver. |
+ value = CompileRun( |
+ "r = { __proto__: o };" |
+ "var result = 0;" |
+ "for (var i = 0; i < 7; i++) {" |
+ " result = r.x + r.y;" |
+ "}"); |
+ CHECK_EQ(239 + 42, value->Int32Value()); |
} |