| 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 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 if (accessors->IsAccessorPair()) { | 1045 if (accessors->IsAccessorPair()) { |
| 1046 if (!holder->HasFastProperties()) break; | 1046 if (!holder->HasFastProperties()) break; |
| 1047 // When debugging we need to go the slow path to flood the accessor. | 1047 // When debugging we need to go the slow path to flood the accessor. |
| 1048 if (GetSharedFunctionInfo()->HasDebugInfo()) break; | 1048 if (GetSharedFunctionInfo()->HasDebugInfo()) break; |
| 1049 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), | 1049 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), |
| 1050 isolate()); | 1050 isolate()); |
| 1051 CallOptimization call_optimization(getter); | 1051 CallOptimization call_optimization(getter); |
| 1052 NamedLoadHandlerCompiler compiler(isolate(), map, holder, | 1052 NamedLoadHandlerCompiler compiler(isolate(), map, holder, |
| 1053 cache_holder); | 1053 cache_holder); |
| 1054 if (call_optimization.is_simple_api_call()) { | 1054 if (call_optimization.is_simple_api_call()) { |
| 1055 if (FLAG_runtime_call_stats) break; |
| 1055 int index = lookup->GetAccessorIndex(); | 1056 int index = lookup->GetAccessorIndex(); |
| 1056 return compiler.CompileLoadCallback(lookup->name(), | 1057 return compiler.CompileLoadCallback(lookup->name(), |
| 1057 call_optimization, index); | 1058 call_optimization, index); |
| 1058 } | 1059 } |
| 1059 int expected_arguments = Handle<JSFunction>::cast(getter) | 1060 int expected_arguments = Handle<JSFunction>::cast(getter) |
| 1060 ->shared() | 1061 ->shared() |
| 1061 ->internal_formal_parameter_count(); | 1062 ->internal_formal_parameter_count(); |
| 1062 return compiler.CompileLoadViaGetter( | 1063 return compiler.CompileLoadViaGetter( |
| 1063 lookup->name(), lookup->GetAccessorIndex(), expected_arguments); | 1064 lookup->name(), lookup->GetAccessorIndex(), expected_arguments); |
| 1064 } else if (accessors->IsAccessorInfo()) { | 1065 } else if (accessors->IsAccessorInfo()) { |
| 1065 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); | 1066 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); |
| 1066 if (v8::ToCData<Address>(info->getter()) == nullptr) break; | 1067 if (v8::ToCData<Address>(info->getter()) == nullptr) break; |
| 1067 if (!AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map)) { | 1068 if (!AccessorInfo::IsCompatibleReceiverMap(isolate(), info, map)) { |
| 1068 // This case should be already handled in LoadIC::UpdateCaches. | 1069 // This case should be already handled in LoadIC::UpdateCaches. |
| 1069 UNREACHABLE(); | 1070 UNREACHABLE(); |
| 1070 break; | 1071 break; |
| 1071 } | 1072 } |
| 1072 if (!holder->HasFastProperties()) break; | 1073 if (!holder->HasFastProperties()) break; |
| 1074 if (FLAG_runtime_call_stats) break; |
| 1073 if (receiver_is_holder) { | 1075 if (receiver_is_holder) { |
| 1074 int index = lookup->GetAccessorIndex(); | 1076 int index = lookup->GetAccessorIndex(); |
| 1075 LoadApiGetterStub stub(isolate(), true, index); | 1077 LoadApiGetterStub stub(isolate(), true, index); |
| 1076 return stub.GetCode(); | 1078 return stub.GetCode(); |
| 1077 } | 1079 } |
| 1078 NamedLoadHandlerCompiler compiler(isolate(), map, holder, | 1080 NamedLoadHandlerCompiler compiler(isolate(), map, holder, |
| 1079 cache_holder); | 1081 cache_holder); |
| 1080 return compiler.CompileLoadCallback(lookup->name(), info); | 1082 return compiler.CompileLoadCallback(lookup->name(), info); |
| 1081 } | 1083 } |
| 1082 } | 1084 } |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 TRACE_GENERIC_IC(isolate(), "StoreIC", | 1547 TRACE_GENERIC_IC(isolate(), "StoreIC", |
| 1546 "special data property in prototype chain"); | 1548 "special data property in prototype chain"); |
| 1547 break; | 1549 break; |
| 1548 } | 1550 } |
| 1549 if (!AccessorInfo::IsCompatibleReceiverMap(isolate(), info, | 1551 if (!AccessorInfo::IsCompatibleReceiverMap(isolate(), info, |
| 1550 receiver_map())) { | 1552 receiver_map())) { |
| 1551 TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver type"); | 1553 TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver type"); |
| 1552 break; | 1554 break; |
| 1553 } | 1555 } |
| 1554 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); | 1556 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); |
| 1557 if (FLAG_runtime_call_stats) break; |
| 1555 return compiler.CompileStoreCallback(receiver, lookup->name(), info, | 1558 return compiler.CompileStoreCallback(receiver, lookup->name(), info, |
| 1556 language_mode()); | 1559 language_mode()); |
| 1557 } else if (accessors->IsAccessorPair()) { | 1560 } else if (accessors->IsAccessorPair()) { |
| 1558 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), | 1561 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), |
| 1559 isolate()); | 1562 isolate()); |
| 1560 if (!setter->IsJSFunction() && !setter->IsFunctionTemplateInfo()) { | 1563 if (!setter->IsJSFunction() && !setter->IsFunctionTemplateInfo()) { |
| 1561 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function"); | 1564 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function"); |
| 1562 break; | 1565 break; |
| 1563 } | 1566 } |
| 1564 CallOptimization call_optimization(setter); | 1567 CallOptimization call_optimization(setter); |
| 1565 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); | 1568 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); |
| 1566 if (call_optimization.is_simple_api_call()) { | 1569 if (call_optimization.is_simple_api_call()) { |
| 1567 if (call_optimization.IsCompatibleReceiver(receiver, holder)) { | 1570 if (call_optimization.IsCompatibleReceiver(receiver, holder)) { |
| 1571 if (FLAG_runtime_call_stats) break; |
| 1568 return compiler.CompileStoreCallback(receiver, lookup->name(), | 1572 return compiler.CompileStoreCallback(receiver, lookup->name(), |
| 1569 call_optimization, | 1573 call_optimization, |
| 1570 lookup->GetAccessorIndex()); | 1574 lookup->GetAccessorIndex()); |
| 1571 } | 1575 } |
| 1572 TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver"); | 1576 TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver"); |
| 1573 break; | 1577 break; |
| 1574 } | 1578 } |
| 1575 int expected_arguments = JSFunction::cast(*setter) | 1579 int expected_arguments = JSFunction::cast(*setter) |
| 1576 ->shared() | 1580 ->shared() |
| 1577 ->internal_formal_parameter_count(); | 1581 ->internal_formal_parameter_count(); |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2744 KeyedLoadICNexus nexus(vector, vector_slot); | 2748 KeyedLoadICNexus nexus(vector, vector_slot); |
| 2745 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2749 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
| 2746 ic.UpdateState(receiver, key); | 2750 ic.UpdateState(receiver, key); |
| 2747 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 2751 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
| 2748 } | 2752 } |
| 2749 | 2753 |
| 2750 return *result; | 2754 return *result; |
| 2751 } | 2755 } |
| 2752 } // namespace internal | 2756 } // namespace internal |
| 2753 } // namespace v8 | 2757 } // namespace v8 |
| OLD | NEW |