@@ -1112,7 +1112,39 @@ void LoadIC::UpdateCaches(LookupIterator* lookup) {
1112
1112
code = slow_stub();
1113
1113
}
1114
1114
} else {
1115
- code = ComputeHandler(lookup);
1115
+ if (lookup->state() == LookupIterator::ACCESSOR) {
1116
+ Handle<Object> accessors = lookup->GetAccessors();
1117
+ Handle<Map> map = receiver_map();
1118
+ if (accessors->IsExecutableAccessorInfo()) {
1119
+ Handle<ExecutableAccessorInfo> info =
1120
+ Handle<ExecutableAccessorInfo>::cast(accessors);
1121
+ if ((v8::ToCData<Address>(info->getter()) != 0) &&
1122
+ !ExecutableAccessorInfo::IsCompatibleReceiverMap(isolate(), info,
1123
+ map)) {
1124
+ TRACE_GENERIC_IC(isolate(), "LoadIC", "incompatible receiver type");
1125
+ code = slow_stub();
1126
+ }
1127
+ } else if (accessors->IsAccessorPair()) {
1128
+ Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
1129
+ isolate());
1130
+ Handle<JSObject> holder = lookup->GetHolder<JSObject>();
1131
+ Handle<Object> receiver = lookup->GetReceiver();
1132
+ if (getter->IsJSFunction() && holder->HasFastProperties()) {
1133
+ Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
1134
+ if (receiver->IsJSObject() || function->IsBuiltin() ||
1135
+ !is_sloppy(function->shared()->language_mode())) {
1136
+ CallOptimization call_optimization(function);
1137
+ if (call_optimization.is_simple_api_call() &&
1138
+ !call_optimization.IsCompatibleReceiver(receiver, holder)) {
1139
+ TRACE_GENERIC_IC(isolate(), "LoadIC",
1140
+ "incompatible receiver type");
1141
+ code = slow_stub();
1142
+ }
1143
+ }
1144
+ }
1145
+ }
1146
+ }
1147
+ if (code.is_null()) code = ComputeHandler(lookup);
1116
1148
}
1117
1149
1118
1150
PatchCache(lookup->name(), code);
@@ -1242,6 +1274,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
1242
1274
if (v8::ToCData<Address>(info->getter()) == 0) break;
1243
1275
if (!ExecutableAccessorInfo::IsCompatibleReceiverMap(isolate(), info,
1244
1276
map)) {
1277
+ // This case should be already handled in LoadIC::UpdateCaches.
1278
+ UNREACHABLE();
1245
1279
break;
1246
1280
}
1247
1281
if (!holder->HasFastProperties()) break;
@@ -1262,10 +1296,14 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
1262
1296
}
1263
1297
CallOptimization call_optimization(function);
1264
1298
NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder);
1265
- if (call_optimization.is_simple_api_call() &&
1266
- call_optimization.IsCompatibleReceiver(receiver, holder)) {
1267
- return compiler.CompileLoadCallback(lookup->name(), call_optimization,
1268
- lookup->GetAccessorIndex());
1299
+ if (call_optimization.is_simple_api_call()) {
1300
+ if (call_optimization.IsCompatibleReceiver(receiver, holder)) {
1301
+ return compiler.CompileLoadCallback(
1302
+ lookup->name(), call_optimization, lookup->GetAccessorIndex());
1303
+ } else {
1304
+ // This case should be already handled in LoadIC::UpdateCaches.
1305
+ UNREACHABLE();
1306
+ }
1269
1307
}
1270
1308
int expected_arguments =
1271
1309
function->shared()->internal_formal_parameter_count();
0 commit comments