| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 | 728 |
| 729 | 729 |
| 730 // Support function for computing call IC miss stubs. | 730 // Support function for computing call IC miss stubs. |
| 731 Handle<Code> ComputeCallMiss(int argc) { | 731 Handle<Code> ComputeCallMiss(int argc) { |
| 732 CALL_HEAP_FUNCTION(StubCache::ComputeCallMiss(argc), Code); | 732 CALL_HEAP_FUNCTION(StubCache::ComputeCallMiss(argc), Code); |
| 733 } | 733 } |
| 734 | 734 |
| 735 | 735 |
| 736 | 736 |
| 737 Object* LoadCallbackProperty(Arguments args) { | 737 Object* LoadCallbackProperty(Arguments args) { |
| 738 Handle<JSObject> recv = args.at<JSObject>(0); | |
| 739 Handle<JSObject> holder = args.at<JSObject>(1); | |
| 740 AccessorInfo* callback = AccessorInfo::cast(args[2]); | 738 AccessorInfo* callback = AccessorInfo::cast(args[2]); |
| 741 Handle<Object> data = args.at<Object>(3); | |
| 742 Address getter_address = v8::ToCData<Address>(callback->getter()); | 739 Address getter_address = v8::ToCData<Address>(callback->getter()); |
| 743 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); | 740 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); |
| 744 ASSERT(fun != NULL); | 741 ASSERT(fun != NULL); |
| 745 Handle<String> name = args.at<String>(4); | 742 v8::AccessorInfo info(args.arguments()); |
| 746 // NOTE: If we can align the structure of an AccessorInfo with the | |
| 747 // locations of the arguments to this function maybe we don't have | |
| 748 // to explicitly create the structure but can just pass a pointer | |
| 749 // into the stack. | |
| 750 LOG(ApiNamedPropertyAccess("load", *recv, *name)); | |
| 751 v8::AccessorInfo info(v8::Utils::ToLocal(recv), | |
| 752 v8::Utils::ToLocal(data), | |
| 753 v8::Utils::ToLocal(holder)); | |
| 754 HandleScope scope; | 743 HandleScope scope; |
| 755 v8::Handle<v8::Value> result; | 744 v8::Handle<v8::Value> result; |
| 756 { | 745 { |
| 757 // Leaving JavaScript. | 746 // Leaving JavaScript. |
| 758 VMState state(EXTERNAL); | 747 VMState state(EXTERNAL); |
| 759 result = fun(v8::Utils::ToLocal(name), info); | 748 result = fun(v8::Utils::ToLocal(args.at<String>(4)), info); |
| 760 } | 749 } |
| 761 RETURN_IF_SCHEDULED_EXCEPTION(); | 750 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 762 if (result.IsEmpty()) return Heap::undefined_value(); | 751 if (result.IsEmpty()) return Heap::undefined_value(); |
| 763 return *v8::Utils::OpenHandle(*result); | 752 return *v8::Utils::OpenHandle(*result); |
| 764 } | 753 } |
| 765 | 754 |
| 766 | 755 |
| 767 Object* StoreCallbackProperty(Arguments args) { | 756 Object* StoreCallbackProperty(Arguments args) { |
| 768 Handle<JSObject> recv = args.at<JSObject>(0); | 757 JSObject* recv = JSObject::cast(args[0]); |
| 769 AccessorInfo* callback = AccessorInfo::cast(args[1]); | 758 AccessorInfo* callback = AccessorInfo::cast(args[1]); |
| 770 Address setter_address = v8::ToCData<Address>(callback->setter()); | 759 Address setter_address = v8::ToCData<Address>(callback->setter()); |
| 771 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address); | 760 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address); |
| 772 ASSERT(fun != NULL); | 761 ASSERT(fun != NULL); |
| 773 Handle<String> name = args.at<String>(2); | 762 Handle<String> name = args.at<String>(2); |
| 774 Handle<Object> value = args.at<Object>(3); | 763 Handle<Object> value = args.at<Object>(3); |
| 775 HandleScope scope; | 764 HandleScope scope; |
| 776 Handle<Object> data(callback->data()); | 765 LOG(ApiNamedPropertyAccess("store", recv, *name)); |
| 777 LOG(ApiNamedPropertyAccess("store", *recv, *name)); | 766 CustomArguments custom_args(callback->data(), recv, recv); |
| 778 v8::AccessorInfo info(v8::Utils::ToLocal(recv), | 767 v8::AccessorInfo info(custom_args.end()); |
| 779 v8::Utils::ToLocal(data), | |
| 780 v8::Utils::ToLocal(recv)); | |
| 781 { | 768 { |
| 782 // Leaving JavaScript. | 769 // Leaving JavaScript. |
| 783 VMState state(EXTERNAL); | 770 VMState state(EXTERNAL); |
| 784 fun(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); | 771 fun(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); |
| 785 } | 772 } |
| 786 RETURN_IF_SCHEDULED_EXCEPTION(); | 773 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 787 return *value; | 774 return *value; |
| 788 } | 775 } |
| 789 | 776 |
| 790 /** | 777 /** |
| 791 * Attempts to load a property with an interceptor (which must be present), | 778 * Attempts to load a property with an interceptor (which must be present), |
| 792 * but doesn't search the prototype chain. | 779 * but doesn't search the prototype chain. |
| 793 * | 780 * |
| 794 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't | 781 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't |
| 795 * provide any value for the given name. | 782 * provide any value for the given name. |
| 796 */ | 783 */ |
| 797 Object* LoadPropertyWithInterceptorOnly(Arguments args) { | 784 Object* LoadPropertyWithInterceptorOnly(Arguments args) { |
| 798 Handle<JSObject> receiver_handle = args.at<JSObject>(0); | 785 JSObject* receiver_handle = JSObject::cast(args[0]); |
| 799 Handle<JSObject> holder_handle = args.at<JSObject>(1); | 786 JSObject* holder_handle = JSObject::cast(args[1]); |
| 800 Handle<String> name_handle = args.at<String>(2); | 787 Handle<String> name_handle = args.at<String>(2); |
| 801 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>(3); | 788 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>(3); |
| 802 Handle<Object> data_handle = args.at<Object>(4); | 789 Object* data_handle = args[4]; |
| 803 | 790 |
| 804 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); | 791 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); |
| 805 v8::NamedPropertyGetter getter = | 792 v8::NamedPropertyGetter getter = |
| 806 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); | 793 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); |
| 807 ASSERT(getter != NULL); | 794 ASSERT(getter != NULL); |
| 808 | 795 |
| 809 { | 796 { |
| 810 // Use the interceptor getter. | 797 // Use the interceptor getter. |
| 811 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), | 798 CustomArguments args(data_handle, receiver_handle, holder_handle); |
| 812 v8::Utils::ToLocal(data_handle), | 799 v8::AccessorInfo info(args.end()); |
| 813 v8::Utils::ToLocal(holder_handle)); | |
| 814 HandleScope scope; | 800 HandleScope scope; |
| 815 v8::Handle<v8::Value> r; | 801 v8::Handle<v8::Value> r; |
| 816 { | 802 { |
| 817 // Leaving JavaScript. | 803 // Leaving JavaScript. |
| 818 VMState state(EXTERNAL); | 804 VMState state(EXTERNAL); |
| 819 r = getter(v8::Utils::ToLocal(name_handle), info); | 805 r = getter(v8::Utils::ToLocal(name_handle), info); |
| 820 } | 806 } |
| 821 RETURN_IF_SCHEDULED_EXCEPTION(); | 807 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 822 if (!r.IsEmpty()) { | 808 if (!r.IsEmpty()) { |
| 823 return *v8::Utils::OpenHandle(*r); | 809 return *v8::Utils::OpenHandle(*r); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 854 Handle<InterceptorInfo> interceptor_info = args->at<InterceptorInfo>(3); | 840 Handle<InterceptorInfo> interceptor_info = args->at<InterceptorInfo>(3); |
| 855 Handle<Object> data_handle = args->at<Object>(4); | 841 Handle<Object> data_handle = args->at<Object>(4); |
| 856 | 842 |
| 857 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); | 843 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); |
| 858 v8::NamedPropertyGetter getter = | 844 v8::NamedPropertyGetter getter = |
| 859 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); | 845 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); |
| 860 ASSERT(getter != NULL); | 846 ASSERT(getter != NULL); |
| 861 | 847 |
| 862 { | 848 { |
| 863 // Use the interceptor getter. | 849 // Use the interceptor getter. |
| 864 v8::AccessorInfo info(v8::Utils::ToLocal(receiver_handle), | 850 CustomArguments args(*data_handle, *receiver_handle, *holder_handle); |
| 865 v8::Utils::ToLocal(data_handle), | 851 v8::AccessorInfo info(args.end()); |
| 866 v8::Utils::ToLocal(holder_handle)); | |
| 867 HandleScope scope; | 852 HandleScope scope; |
| 868 v8::Handle<v8::Value> r; | 853 v8::Handle<v8::Value> r; |
| 869 { | 854 { |
| 870 // Leaving JavaScript. | 855 // Leaving JavaScript. |
| 871 VMState state(EXTERNAL); | 856 VMState state(EXTERNAL); |
| 872 r = getter(v8::Utils::ToLocal(name_handle), info); | 857 r = getter(v8::Utils::ToLocal(name_handle), info); |
| 873 } | 858 } |
| 874 RETURN_IF_SCHEDULED_EXCEPTION(); | 859 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 875 if (!r.IsEmpty()) { | 860 if (!r.IsEmpty()) { |
| 876 *attrs = NONE; | 861 *attrs = NONE; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 if (!result->IsFailure()) { | 1088 if (!result->IsFailure()) { |
| 1104 Code* code = Code::cast(result); | 1089 Code* code = Code::cast(result); |
| 1105 USE(code); | 1090 USE(code); |
| 1106 LOG(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); | 1091 LOG(CodeCreateEvent(Logger::STUB_TAG, code, "ConstructStub")); |
| 1107 } | 1092 } |
| 1108 return result; | 1093 return result; |
| 1109 } | 1094 } |
| 1110 | 1095 |
| 1111 | 1096 |
| 1112 } } // namespace v8::internal | 1097 } } // namespace v8::internal |
| OLD | NEW |