| 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 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1713 if (v8::ToCData<Address>(info->setter()) == 0) { | 1713 if (v8::ToCData<Address>(info->setter()) == 0) { |
| 1714 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter == 0"); | 1714 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter == 0"); |
| 1715 break; | 1715 break; |
| 1716 } | 1716 } |
| 1717 if (!ExecutableAccessorInfo::IsCompatibleReceiverType( | 1717 if (!ExecutableAccessorInfo::IsCompatibleReceiverType( |
| 1718 isolate(), info, receiver_type())) { | 1718 isolate(), info, receiver_type())) { |
| 1719 TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver type"); | 1719 TRACE_GENERIC_IC(isolate(), "StoreIC", "incompatible receiver type"); |
| 1720 break; | 1720 break; |
| 1721 } | 1721 } |
| 1722 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder); | 1722 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder); |
| 1723 return compiler.CompileStoreCallback(receiver, lookup->name(), info); | 1723 return compiler.CompileStoreCallback(receiver, lookup->name(), |
| 1724 lookup->GetAccessorIndex()); |
| 1724 } else if (accessors->IsAccessorPair()) { | 1725 } else if (accessors->IsAccessorPair()) { |
| 1725 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), | 1726 Handle<Object> setter(Handle<AccessorPair>::cast(accessors)->setter(), |
| 1726 isolate()); | 1727 isolate()); |
| 1727 if (!setter->IsJSFunction()) { | 1728 if (!setter->IsJSFunction()) { |
| 1728 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function"); | 1729 TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function"); |
| 1729 break; | 1730 break; |
| 1730 } | 1731 } |
| 1731 Handle<JSFunction> function = Handle<JSFunction>::cast(setter); | 1732 Handle<JSFunction> function = Handle<JSFunction>::cast(setter); |
| 1732 CallOptimization call_optimization(function); | 1733 CallOptimization call_optimization(function); |
| 1733 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder); | 1734 NamedStoreHandlerCompiler compiler(isolate(), receiver_type(), holder); |
| (...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2801 HandleScope scope(isolate); | 2802 HandleScope scope(isolate); |
| 2802 Handle<Object> object = args.at<Object>(0); | 2803 Handle<Object> object = args.at<Object>(0); |
| 2803 ToBooleanIC ic(isolate); | 2804 ToBooleanIC ic(isolate); |
| 2804 return *ic.ToBoolean(object); | 2805 return *ic.ToBoolean(object); |
| 2805 } | 2806 } |
| 2806 | 2807 |
| 2807 | 2808 |
| 2808 RUNTIME_FUNCTION(StoreCallbackProperty) { | 2809 RUNTIME_FUNCTION(StoreCallbackProperty) { |
| 2809 Handle<JSObject> receiver = args.at<JSObject>(0); | 2810 Handle<JSObject> receiver = args.at<JSObject>(0); |
| 2810 Handle<JSObject> holder = args.at<JSObject>(1); | 2811 Handle<JSObject> holder = args.at<JSObject>(1); |
| 2811 Handle<ExecutableAccessorInfo> callback = args.at<ExecutableAccessorInfo>(2); | 2812 Handle<Smi> accessor_index = args.at<Smi>(2); |
| 2812 Handle<Name> name = args.at<Name>(3); | 2813 Handle<Name> name = args.at<Name>(3); |
| 2813 Handle<Object> value = args.at<Object>(4); | 2814 Handle<Object> value = args.at<Object>(4); |
| 2814 HandleScope scope(isolate); | 2815 HandleScope scope(isolate); |
| 2815 | 2816 |
| 2817 Handle<ExecutableAccessorInfo> callback(ExecutableAccessorInfo::cast( |
| 2818 holder->map()->instance_descriptors()->GetCallbacksObject( |
| 2819 accessor_index->value()))); |
| 2820 |
| 2816 DCHECK(callback->IsCompatibleReceiver(*receiver)); | 2821 DCHECK(callback->IsCompatibleReceiver(*receiver)); |
| 2817 | 2822 |
| 2818 Address setter_address = v8::ToCData<Address>(callback->setter()); | 2823 Address setter_address = v8::ToCData<Address>(callback->setter()); |
| 2819 v8::AccessorNameSetterCallback fun = | 2824 v8::AccessorNameSetterCallback fun = |
| 2820 FUNCTION_CAST<v8::AccessorNameSetterCallback>(setter_address); | 2825 FUNCTION_CAST<v8::AccessorNameSetterCallback>(setter_address); |
| 2821 DCHECK(fun != NULL); | 2826 DCHECK(fun != NULL); |
| 2822 | 2827 |
| 2823 LOG(isolate, ApiNamedPropertyAccess("store", *receiver, *name)); | 2828 LOG(isolate, ApiNamedPropertyAccess("store", *receiver, *name)); |
| 2824 PropertyCallbackArguments custom_args(isolate, callback->data(), *receiver, | 2829 PropertyCallbackArguments custom_args(isolate, callback->data(), *receiver, |
| 2825 *holder); | 2830 *holder); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3000 static const Address IC_utilities[] = { | 3005 static const Address IC_utilities[] = { |
| 3001 #define ADDR(name) FUNCTION_ADDR(name), | 3006 #define ADDR(name) FUNCTION_ADDR(name), |
| 3002 IC_UTIL_LIST(ADDR) NULL | 3007 IC_UTIL_LIST(ADDR) NULL |
| 3003 #undef ADDR | 3008 #undef ADDR |
| 3004 }; | 3009 }; |
| 3005 | 3010 |
| 3006 | 3011 |
| 3007 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3012 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
| 3008 } | 3013 } |
| 3009 } // namespace v8::internal | 3014 } // namespace v8::internal |
| OLD | NEW |