Chromium Code Reviews| Index: src/ic/ic.cc |
| diff --git a/src/ic/ic.cc b/src/ic/ic.cc |
| index 52c4732e81ee7866bd2d49550a55cf330d79c123..4f58ec6a0e6c1b3b26dcff699e015ae3436d85e8 100644 |
| --- a/src/ic/ic.cc |
| +++ b/src/ic/ic.cc |
| @@ -1098,6 +1098,41 @@ Handle<Code> IC::ComputeHandler(LookupIterator* lookup, Handle<Object> value) { |
| } |
| +Handle<Code> LoadIC::ComputeHandler(LookupIterator* lookup, |
| + Handle<Object> value) { |
|
Toon Verwaest
2015/07/06 11:49:18
Just move this code into LoadIC::UpdateCaches, tha
|
| + if (lookup->state() == LookupIterator::ACCESSOR) { |
| + Handle<Object> accessors = lookup->GetAccessors(); |
| + Handle<Map> map = receiver_map(); |
| + if (accessors->IsExecutableAccessorInfo()) { |
| + Handle<ExecutableAccessorInfo> info = |
| + Handle<ExecutableAccessorInfo>::cast(accessors); |
| + if ((v8::ToCData<Address>(info->getter()) != 0) && |
| + !ExecutableAccessorInfo::IsCompatibleReceiverMap(isolate(), info, |
| + map)) { |
| + return slow_stub(); |
| + } |
| + } else if (accessors->IsAccessorPair()) { |
| + Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), |
| + isolate()); |
| + Handle<JSObject> holder = lookup->GetHolder<JSObject>(); |
| + Handle<Object> receiver = lookup->GetReceiver(); |
| + if (getter->IsJSFunction() && holder->HasFastProperties()) { |
| + Handle<JSFunction> function = Handle<JSFunction>::cast(getter); |
| + if (receiver->IsJSObject() || function->IsBuiltin() || |
| + !is_sloppy(function->shared()->language_mode())) { |
| + CallOptimization call_optimization(function); |
| + if (call_optimization.is_simple_api_call() && |
| + !call_optimization.IsCompatibleReceiver(receiver, holder)) { |
| + return slow_stub(); |
| + } |
| + } |
| + } |
| + } |
| + } |
| + return IC::ComputeHandler(lookup, value); |
| +} |
| + |
| + |
| Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup, |
| Handle<Object> unused, |
| CacheHolderFlag cache_holder) { |
| @@ -1165,6 +1200,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup, |
| if (v8::ToCData<Address>(info->getter()) == 0) break; |
| if (!ExecutableAccessorInfo::IsCompatibleReceiverMap(isolate(), info, |
| map)) { |
| + // This case should be already handled in LoadIC::ComputeHandler. |
| + UNREACHABLE(); |
| break; |
| } |
| if (!holder->HasFastProperties()) break; |
| @@ -1185,10 +1222,14 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup, |
| } |
| CallOptimization call_optimization(function); |
| NamedLoadHandlerCompiler compiler(isolate(), map, holder, cache_holder); |
| - if (call_optimization.is_simple_api_call() && |
| - call_optimization.IsCompatibleReceiver(receiver, holder)) { |
| - return compiler.CompileLoadCallback(lookup->name(), call_optimization, |
| - lookup->GetAccessorIndex()); |
| + if (call_optimization.is_simple_api_call()) { |
| + if (call_optimization.IsCompatibleReceiver(receiver, holder)) { |
| + return compiler.CompileLoadCallback( |
| + lookup->name(), call_optimization, lookup->GetAccessorIndex()); |
| + } else { |
| + // This case should be already handled in LoadIC::ComputeHandler. |
| + UNREACHABLE(); |
| + } |
| } |
| int expected_arguments = |
| function->shared()->internal_formal_parameter_count(); |