| 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/v8.h" | 5 #include "src/v8.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/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1683 if (v8::ToCData<Address>(info->setter()) == 0) { | 1683 if (v8::ToCData<Address>(info->setter()) == 0) { |
| 1684 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter == 0"); | 1684 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter == 0"); |
| 1685 break; | 1685 break; |
| 1686 } | 1686 } |
| 1687 if (!ExecutableAccessorInfo::IsCompatibleReceiverMap(isolate(), info, | 1687 if (!ExecutableAccessorInfo::IsCompatibleReceiverMap(isolate(), info, |
| 1688 receiver_map())) { | 1688 receiver_map())) { |
| 1689 TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver type"); | 1689 TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver type"); |
| 1690 break; | 1690 break; |
| 1691 } | 1691 } |
| 1692 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); | 1692 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); |
| 1693 return compiler.CompileStoreCallback(receiver, lookup->name(), | 1693 return compiler.CompileStoreCallback(receiver, lookup->name(), info); |
| 1694 lookup->GetAccessorIndex()); | |
| 1695 } else if (accessors->IsAccessorPair()) { | 1694 } else if (accessors->IsAccessorPair()) { |
| 1696 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), | 1695 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), |
| 1697 isolate()); | 1696 isolate()); |
| 1698 if (!setter->IsJSFunction()) { | 1697 if (!setter->IsJSFunction()) { |
| 1699 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function"); | 1698 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function"); |
| 1700 break; | 1699 break; |
| 1701 } | 1700 } |
| 1702 Handle<JSFunction> function = Handle<JSFunction>::cast(setter); | 1701 Handle<JSFunction> function = Handle<JSFunction>::cast(setter); |
| 1703 CallOptimization call_optimization(function); | 1702 CallOptimization call_optimization(function); |
| 1704 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); | 1703 NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder); |
| (...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2756 HandleScope scope(isolate); | 2755 HandleScope scope(isolate); |
| 2757 Handle<Object> object = args.at<Object>(0); | 2756 Handle<Object> object = args.at<Object>(0); |
| 2758 ToBooleanIC ic(isolate); | 2757 ToBooleanIC ic(isolate); |
| 2759 return *ic.ToBoolean(object); | 2758 return *ic.ToBoolean(object); |
| 2760 } | 2759 } |
| 2761 | 2760 |
| 2762 | 2761 |
| 2763 RUNTIME_FUNCTION(StoreCallbackProperty) { | 2762 RUNTIME_FUNCTION(StoreCallbackProperty) { |
| 2764 Handle<JSObject> receiver = args.at<JSObject>(0); | 2763 Handle<JSObject> receiver = args.at<JSObject>(0); |
| 2765 Handle<JSObject> holder = args.at<JSObject>(1); | 2764 Handle<JSObject> holder = args.at<JSObject>(1); |
| 2766 Handle<Smi> accessor_index = args.at<Smi>(2); | 2765 Handle<HeapObject> callback_or_cell = args.at<HeapObject>(2); |
| 2767 Handle<Name> name = args.at<Name>(3); | 2766 Handle<Name> name = args.at<Name>(3); |
| 2768 Handle<Object> value = args.at<Object>(4); | 2767 Handle<Object> value = args.at<Object>(4); |
| 2769 HandleScope scope(isolate); | 2768 HandleScope scope(isolate); |
| 2770 | 2769 |
| 2771 Handle<ExecutableAccessorInfo> callback(ExecutableAccessorInfo::cast( | 2770 Handle<ExecutableAccessorInfo> callback( |
| 2772 holder->map()->instance_descriptors()->GetCallbacksObject( | 2771 callback_or_cell->IsWeakCell() |
| 2773 accessor_index->value()))); | 2772 ? ExecutableAccessorInfo::cast( |
| 2773 WeakCell::cast(*callback_or_cell)->value()) |
| 2774 : ExecutableAccessorInfo::cast(*callback_or_cell)); |
| 2774 | 2775 |
| 2775 DCHECK(callback->IsCompatibleReceiver(*receiver)); | 2776 DCHECK(callback->IsCompatibleReceiver(*receiver)); |
| 2776 | 2777 |
| 2777 Address setter_address = v8::ToCData<Address>(callback->setter()); | 2778 Address setter_address = v8::ToCData<Address>(callback->setter()); |
| 2778 v8::AccessorNameSetterCallback fun = | 2779 v8::AccessorNameSetterCallback fun = |
| 2779 FUNCTION_CAST<v8::AccessorNameSetterCallback>(setter_address); | 2780 FUNCTION_CAST<v8::AccessorNameSetterCallback>(setter_address); |
| 2780 DCHECK(fun != NULL); | 2781 DCHECK(fun != NULL); |
| 2781 | 2782 |
| 2782 LOG(isolate, ApiNamedPropertyAccess("store", *receiver, *name)); | 2783 LOG(isolate, ApiNamedPropertyAccess("store", *receiver, *name)); |
| 2783 PropertyCallbackArguments custom_args(isolate, callback->data(), *receiver, | 2784 PropertyCallbackArguments custom_args(isolate, callback->data(), *receiver, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2958 static const Address IC_utilities[] = { | 2959 static const Address IC_utilities[] = { |
| 2959 #define ADDR(name) FUNCTION_ADDR(name), | 2960 #define ADDR(name) FUNCTION_ADDR(name), |
| 2960 IC_UTIL_LIST(ADDR) NULL | 2961 IC_UTIL_LIST(ADDR) NULL |
| 2961 #undef ADDR | 2962 #undef ADDR |
| 2962 }; | 2963 }; |
| 2963 | 2964 |
| 2964 | 2965 |
| 2965 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 2966 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
| 2966 } | 2967 } |
| 2967 } // namespace v8::internal | 2968 } // namespace v8::internal |
| OLD | NEW |