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

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

Issue 2081143002: [ic] Don't compile load interceptor handlers for LoadGlobalIC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup Created 4 years, 6 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/runtime/runtime-object.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-interceptors.cc
diff --git a/test/cctest/test-api-interceptors.cc b/test/cctest/test-api-interceptors.cc
index 7cedf398c854392ea9c7d70758b066f10654a813..1108c878594d1a1afc1d5c6e730da0247014725b 100644
--- a/test/cctest/test-api-interceptors.cc
+++ b/test/cctest/test-api-interceptors.cc
@@ -854,6 +854,52 @@ THREADED_TEST(InterceptorLoadICInvalidatedCallbackViaGlobal) {
CHECK_EQ(42 * 10, value->Int32Value(context.local()).FromJust());
}
+// Test load of a non-existing global when a global object has an interceptor.
+THREADED_TEST(InterceptorLoadGlobalICGlobalWithInterceptor) {
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::ObjectTemplate> templ_global = v8::ObjectTemplate::New(isolate);
+ templ_global->SetHandler(v8::NamedPropertyHandlerConfiguration(
+ EmptyInterceptorGetter, EmptyInterceptorSetter));
+
+ LocalContext context(nullptr, templ_global);
+ i::Handle<i::JSReceiver> global_proxy =
+ v8::Utils::OpenHandle<Object, i::JSReceiver>(context->Global());
+ CHECK(global_proxy->IsJSGlobalProxy());
+ i::Handle<i::JSGlobalObject> global(
+ i::JSGlobalObject::cast(global_proxy->map()->prototype()));
+ CHECK(global->map()->has_named_interceptor());
+
+ v8::Local<Value> value = CompileRun(
+ "var f = function() { "
+ " try {"
+ " x;"
+ " return false;"
+ " } catch(e) {"
+ " return true;"
+ " }"
+ "};"
+ "for (var i = 0; i < 10; i++) {"
+ " f();"
+ "};"
+ "f();");
+ CHECK_EQ(true, value->BooleanValue(context.local()).FromJust());
+
+ value = CompileRun(
+ "var f = function() { "
+ " try {"
+ " typeof(x);"
+ " return true;"
+ " } catch(e) {"
+ " return false;"
+ " }"
+ "};"
+ "for (var i = 0; i < 10; i++) {"
+ " f();"
+ "};"
+ "f();");
+ CHECK_EQ(true, value->BooleanValue(context.local()).FromJust());
+}
mvstanton 2016/06/23 16:09:28 Nice unit test +1.
static void InterceptorLoadICGetter0(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698