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

Side by Side Diff: src/ic/ic.cc

Issue 1883533006: Properly create the store handler for lazy accessor pair setters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 Handle<Object> accessors = lookup->GetAccessors(); 838 Handle<Object> accessors = lookup->GetAccessors();
839 if (accessors->IsAccessorInfo()) { 839 if (accessors->IsAccessorInfo()) {
840 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors); 840 Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(accessors);
841 if (info->getter() != NULL && 841 if (info->getter() != NULL &&
842 !AccessorInfo::IsCompatibleReceiverMap(isolate, info, receiver_map)) { 842 !AccessorInfo::IsCompatibleReceiverMap(isolate, info, receiver_map)) {
843 return false; 843 return false;
844 } 844 }
845 } else if (accessors->IsAccessorPair()) { 845 } else if (accessors->IsAccessorPair()) {
846 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(), 846 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
847 isolate); 847 isolate);
848 if (!getter->IsJSFunction() && !getter->IsFunctionTemplateInfo()) 848 if (!getter->IsJSFunction() && !getter->IsFunctionTemplateInfo()) {
849 return false; 849 return false;
850 }
850 Handle<JSObject> holder = lookup->GetHolder<JSObject>(); 851 Handle<JSObject> holder = lookup->GetHolder<JSObject>();
851 Handle<Object> receiver = lookup->GetReceiver(); 852 Handle<Object> receiver = lookup->GetReceiver();
852 if (holder->HasFastProperties()) { 853 if (holder->HasFastProperties()) {
853 if (getter->IsJSFunction()) { 854 if (getter->IsJSFunction()) {
854 Handle<JSFunction> function = Handle<JSFunction>::cast(getter); 855 Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
855 if (!receiver->IsJSObject() && !function->shared()->IsBuiltin() && 856 if (!receiver->IsJSObject() && !function->shared()->IsBuiltin() &&
856 is_sloppy(function->shared()->language_mode())) { 857 is_sloppy(function->shared()->language_mode())) {
857 // Calling sloppy non-builtins with a value as the receiver 858 // Calling sloppy non-builtins with a value as the receiver
858 // requires boxing. 859 // requires boxing.
859 return false; 860 return false;
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 receiver_map())) { 1546 receiver_map())) {
1546 TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver type"); 1547 TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver type");
1547 break; 1548 break;
1548 } 1549 }
1549 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); 1550 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder);
1550 return compiler.CompileStoreCallback(receiver, lookup->name(), info, 1551 return compiler.CompileStoreCallback(receiver, lookup->name(), info,
1551 language_mode()); 1552 language_mode());
1552 } else if (accessors->IsAccessorPair()) { 1553 } else if (accessors->IsAccessorPair()) {
1553 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), 1554 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(),
1554 isolate()); 1555 isolate());
1555 if (!setter->IsJSFunction()) { 1556 if (!setter->IsJSFunction() && !setter->IsFunctionTemplateInfo()) {
1556 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function"); 1557 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function");
1557 break; 1558 break;
1558 } 1559 }
1559 Handle<JSFunction> function = Handle<JSFunction>::cast(setter); 1560 CallOptimization call_optimization(setter);
1560 CallOptimization call_optimization(function);
1561 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); 1561 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder);
1562 if (call_optimization.is_simple_api_call() && 1562 if (call_optimization.is_simple_api_call()) {
1563 call_optimization.IsCompatibleReceiver(receiver, holder)) { 1563 if (call_optimization.IsCompatibleReceiver(receiver, holder)) {
1564 return compiler.CompileStoreCallback(receiver, lookup->name(), 1564 return compiler.CompileStoreCallback(receiver, lookup->name(),
1565 call_optimization, 1565 call_optimization,
1566 lookup->GetAccessorIndex()); 1566 lookup->GetAccessorIndex());
1567 }
1568 TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver");
1569 break;
1567 } 1570 }
1568 int expected_arguments = 1571 int expected_arguments = JSFunction::cast(*setter)
1569 function->shared()->internal_formal_parameter_count(); 1572 ->shared()
1573 ->internal_formal_parameter_count();
1570 return compiler.CompileStoreViaSetter(receiver, lookup->name(), 1574 return compiler.CompileStoreViaSetter(receiver, lookup->name(),
1571 lookup->GetAccessorIndex(), 1575 lookup->GetAccessorIndex(),
1572 expected_arguments); 1576 expected_arguments);
1573 } 1577 }
1574 break; 1578 break;
1575 } 1579 }
1576 1580
1577 case LookupIterator::DATA: { 1581 case LookupIterator::DATA: {
1578 if (lookup->is_dictionary_holder()) { 1582 if (lookup->is_dictionary_holder()) {
1579 if (holder->IsJSGlobalObject()) { 1583 if (holder->IsJSGlobalObject()) {
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2738 KeyedLoadICNexus nexus(vector, vector_slot); 2742 KeyedLoadICNexus nexus(vector, vector_slot);
2739 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2743 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2740 ic.UpdateState(receiver, key); 2744 ic.UpdateState(receiver, key);
2741 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); 2745 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key));
2742 } 2746 }
2743 2747
2744 return *result; 2748 return *result;
2745 } 2749 }
2746 } // namespace internal 2750 } // namespace internal
2747 } // namespace v8 2751 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698