| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/ic/ic.h" | 5 #include "src/ic/ic.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/api-arguments.h" | 9 #include "src/api-arguments.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 if (accessors->IsAccessorPair()) { | 1037 if (accessors->IsAccessorPair()) { |
| 1038 if (!holder->HasFastProperties()) break; | 1038 if (!holder->HasFastProperties()) break; |
| 1039 // When debugging we need to go the slow path to flood the accessor. | 1039 // When debugging we need to go the slow path to flood the accessor. |
| 1040 if (GetSharedFunctionInfo()->HasDebugInfo()) break; | 1040 if (GetSharedFunctionInfo()->HasDebugInfo()) break; |
| 1041 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), | 1041 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), |
| 1042 isolate()); | 1042 isolate()); |
| 1043 CallOptimization call_optimization(getter); | 1043 CallOptimization call_optimization(getter); |
| 1044 NamedLoadHandlerCompiler compiler(isolate(), map, holder, | 1044 NamedLoadHandlerCompiler compiler(isolate(), map, holder, |
| 1045 cache_holder); | 1045 cache_holder); |
| 1046 if (call_optimization.is_simple_api_call()) { | 1046 if (call_optimization.is_simple_api_call()) { |
| 1047 return compiler.CompileLoadCallback( | 1047 int index = lookup->GetAccessorIndex(); |
| 1048 lookup->name(), call_optimization, lookup->GetAccessorIndex()); | 1048 return compiler.CompileLoadCallback(lookup->name(), |
| 1049 call_optimization, index); |
| 1049 } | 1050 } |
| 1050 int expected_arguments = Handle<JSFunction>::cast(getter) | 1051 int expected_arguments = Handle<JSFunction>::cast(getter) |
| 1051 ->shared() | 1052 ->shared() |
| 1052 ->internal_formal_parameter_count(); | 1053 ->internal_formal_parameter_count(); |
| 1053 return compiler.CompileLoadViaGetter( | 1054 return compiler.CompileLoadViaGetter( |
| 1054 lookup->name(), lookup->GetAccessorIndex(), expected_arguments); | 1055 lookup->name(), lookup->GetAccessorIndex(), expected_arguments); |
| 1055 } else if (accessors->IsAccessorInfo()) { | 1056 } else if (accessors->IsAccessorInfo()) { |
| 1056 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); | 1057 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); |
| 1057 if (v8::ToCData<Address>(info->getter()) == 0) break; | 1058 if (v8::ToCData<Address>(info->getter()) == nullptr) break; |
| 1058 if (!AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map)) { | 1059 if (!AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map)) { |
| 1059 // This case should be already handled in LoadIC::UpdateCaches. | 1060 // This case should be already handled in LoadIC::UpdateCaches. |
| 1060 UNREACHABLE(); | 1061 UNREACHABLE(); |
| 1061 break; | 1062 break; |
| 1062 } | 1063 } |
| 1063 if (!holder->HasFastProperties()) break; | 1064 if (!holder->HasFastProperties()) break; |
| 1065 if (receiver_is_holder) { |
| 1066 int index = lookup->GetAccessorIndex(); |
| 1067 LoadApiGetterStub stub(isolate(), true, index); |
| 1068 return stub.GetCode(); |
| 1069 } |
| 1064 NamedLoadHandlerCompiler compiler(isolate(), map, holder, | 1070 NamedLoadHandlerCompiler compiler(isolate(), map, holder, |
| 1065 cache_holder); | 1071 cache_holder); |
| 1066 return compiler.CompileLoadCallback(lookup->name(), info); | 1072 return compiler.CompileLoadCallback(lookup->name(), info); |
| 1067 } | 1073 } |
| 1068 } | 1074 } |
| 1069 break; | 1075 break; |
| 1070 } | 1076 } |
| 1071 | 1077 |
| 1072 case LookupIterator::DATA: { | 1078 case LookupIterator::DATA: { |
| 1073 if (lookup->is_dictionary_holder()) { | 1079 if (lookup->is_dictionary_holder()) { |
| (...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2743 KeyedLoadICNexus nexus(vector, vector_slot); | 2749 KeyedLoadICNexus nexus(vector, vector_slot); |
| 2744 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2750 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
| 2745 ic.UpdateState(receiver, key); | 2751 ic.UpdateState(receiver, key); |
| 2746 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 2752 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
| 2747 } | 2753 } |
| 2748 | 2754 |
| 2749 return *result; | 2755 return *result; |
| 2750 } | 2756 } |
| 2751 } // namespace internal | 2757 } // namespace internal |
| 2752 } // namespace v8 | 2758 } // namespace v8 |
| OLD | NEW |