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

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

Issue 885763004: follow up named interceptor miss with api callback getter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « src/ic/handler-compiler.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
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index a043b364992dfd953eb2990f94c2a15e1af2c3ac..599bb7427376ab8faefd9c2489c04b601cd70bdd 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -117,6 +117,11 @@ static void IncrementingSignatureCallback(
}
+static void Returns42(const v8::FunctionCallbackInfo<v8::Value>& info) {
+ info.GetReturnValue().Set(42);
+}
+
+
// Tests that call v8::V8::Dispose() cannot be threaded.
UNINITIALIZED_TEST(InitializeAndDisposeOnce) {
CHECK(v8::V8::Initialize());
@@ -2225,6 +2230,33 @@ THREADED_TEST(EmptyInterceptorDoesNotShadowJSAccessors) {
}
+THREADED_TEST(EmptyInterceptorDoesNotShadowApiAccessors) {
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate);
+ auto returns_42 = FunctionTemplate::New(isolate, Returns42);
+ parent->PrototypeTemplate()->SetAccessorProperty(v8_str("age"), returns_42);
+ Handle<FunctionTemplate> child = FunctionTemplate::New(isolate);
+ child->Inherit(parent);
+ AddInterceptor(child, EmptyInterceptorGetter, EmptyInterceptorSetter);
+ LocalContext env;
+ env->Global()->Set(v8_str("Child"), child->GetFunction());
+ CompileRun(
+ "var child = new Child;"
+ "var parent = child.__proto__;");
+ ExpectBoolean("child.hasOwnProperty('age')", false);
+ ExpectInt32("child.age", 42);
+ // Check interceptor followup.
+ ExpectInt32(
+ "var result;"
+ "for (var i = 0; i < 4; ++i) {"
+ " result = child.age;"
+ "}"
+ "result",
+ 42);
+}
+
+
THREADED_TEST(EmptyInterceptorDoesNotAffectJSProperties) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
@@ -23456,11 +23488,6 @@ TEST(FunctionCallOptimization) {
}
-static void Returns42(const v8::FunctionCallbackInfo<v8::Value>& info) {
- info.GetReturnValue().Set(42);
-}
-
-
TEST(FunctionCallOptimizationMultipleArgs) {
i::FLAG_allow_natives_syntax = true;
LocalContext context;
« no previous file with comments | « src/ic/handler-compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698