OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 921 matching lines...) Loading... |
932 } | 932 } |
933 | 933 |
934 | 934 |
935 // ------------------------------------------------------------------------ | 935 // ------------------------------------------------------------------------ |
936 // StubCompiler implementation. | 936 // StubCompiler implementation. |
937 | 937 |
938 | 938 |
939 RUNTIME_FUNCTION(MaybeObject*, LoadCallbackProperty) { | 939 RUNTIME_FUNCTION(MaybeObject*, LoadCallbackProperty) { |
940 ASSERT(args[0]->IsJSObject()); | 940 ASSERT(args[0]->IsJSObject()); |
941 ASSERT(args[1]->IsJSObject()); | 941 ASSERT(args[1]->IsJSObject()); |
942 AccessorInfo* callback = AccessorInfo::cast(args[3]); | 942 ASSERT(args[3]->IsSmi()); |
| 943 AccessorInfo* callback = AccessorInfo::cast(args[4]); |
943 Address getter_address = v8::ToCData<Address>(callback->getter()); | 944 Address getter_address = v8::ToCData<Address>(callback->getter()); |
944 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); | 945 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); |
945 ASSERT(fun != NULL); | 946 ASSERT(fun != NULL); |
946 v8::AccessorInfo info(&args[0]); | 947 v8::AccessorInfo info(&args[0]); |
947 HandleScope scope(isolate); | 948 HandleScope scope(isolate); |
948 v8::Handle<v8::Value> result; | 949 v8::Handle<v8::Value> result; |
949 { | 950 { |
950 // Leaving JavaScript. | 951 // Leaving JavaScript. |
951 VMState state(isolate, EXTERNAL); | 952 VMState state(isolate, EXTERNAL); |
952 ExternalCallbackScope call_scope(isolate, getter_address); | 953 ExternalCallbackScope call_scope(isolate, getter_address); |
953 result = fun(v8::Utils::ToLocal(args.at<String>(4)), info); | 954 result = fun(v8::Utils::ToLocal(args.at<String>(5)), info); |
954 } | 955 } |
955 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 956 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
956 if (result.IsEmpty()) return HEAP->undefined_value(); | 957 if (result.IsEmpty()) return HEAP->undefined_value(); |
957 return *v8::Utils::OpenHandle(*result); | 958 return *v8::Utils::OpenHandle(*result); |
958 } | 959 } |
959 | 960 |
960 | 961 |
961 RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) { | 962 RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) { |
962 JSObject* recv = JSObject::cast(args[0]); | 963 JSObject* recv = JSObject::cast(args[0]); |
963 AccessorInfo* callback = AccessorInfo::cast(args[1]); | 964 AccessorInfo* callback = AccessorInfo::cast(args[1]); |
(...skipping 26 matching lines...) Loading... |
990 * | 991 * |
991 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't | 992 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't |
992 * provide any value for the given name. | 993 * provide any value for the given name. |
993 */ | 994 */ |
994 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorOnly) { | 995 RUNTIME_FUNCTION(MaybeObject*, LoadPropertyWithInterceptorOnly) { |
995 Handle<String> name_handle = args.at<String>(0); | 996 Handle<String> name_handle = args.at<String>(0); |
996 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>(1); | 997 Handle<InterceptorInfo> interceptor_info = args.at<InterceptorInfo>(1); |
997 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2); | 998 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2); |
998 ASSERT(args[2]->IsJSObject()); // Receiver. | 999 ASSERT(args[2]->IsJSObject()); // Receiver. |
999 ASSERT(args[3]->IsJSObject()); // Holder. | 1000 ASSERT(args[3]->IsJSObject()); // Holder. |
1000 ASSERT(args.length() == 5); // Last arg is data object. | 1001 ASSERT(args[5]->IsSmi()); // Isolate. |
| 1002 ASSERT(args.length() == 6); |
1001 | 1003 |
1002 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); | 1004 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); |
1003 v8::NamedPropertyGetter getter = | 1005 v8::NamedPropertyGetter getter = |
1004 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); | 1006 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); |
1005 ASSERT(getter != NULL); | 1007 ASSERT(getter != NULL); |
1006 | 1008 |
1007 { | 1009 { |
1008 // Use the interceptor getter. | 1010 // Use the interceptor getter. |
1009 v8::AccessorInfo info(args.arguments() - | 1011 v8::AccessorInfo info(args.arguments() - |
1010 kAccessorInfoOffsetInInterceptorArgs); | 1012 kAccessorInfoOffsetInInterceptorArgs); |
(...skipping 32 matching lines...) Loading... |
1043 } | 1045 } |
1044 | 1046 |
1045 | 1047 |
1046 static MaybeObject* LoadWithInterceptor(Arguments* args, | 1048 static MaybeObject* LoadWithInterceptor(Arguments* args, |
1047 PropertyAttributes* attrs) { | 1049 PropertyAttributes* attrs) { |
1048 Handle<String> name_handle = args->at<String>(0); | 1050 Handle<String> name_handle = args->at<String>(0); |
1049 Handle<InterceptorInfo> interceptor_info = args->at<InterceptorInfo>(1); | 1051 Handle<InterceptorInfo> interceptor_info = args->at<InterceptorInfo>(1); |
1050 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2); | 1052 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2); |
1051 Handle<JSObject> receiver_handle = args->at<JSObject>(2); | 1053 Handle<JSObject> receiver_handle = args->at<JSObject>(2); |
1052 Handle<JSObject> holder_handle = args->at<JSObject>(3); | 1054 Handle<JSObject> holder_handle = args->at<JSObject>(3); |
1053 ASSERT(args->length() == 5); // Last arg is data object. | 1055 ASSERT(args->length() == 6); |
1054 | 1056 |
1055 Isolate* isolate = receiver_handle->GetIsolate(); | 1057 Isolate* isolate = receiver_handle->GetIsolate(); |
1056 | 1058 |
1057 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); | 1059 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); |
1058 v8::NamedPropertyGetter getter = | 1060 v8::NamedPropertyGetter getter = |
1059 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); | 1061 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); |
1060 ASSERT(getter != NULL); | 1062 ASSERT(getter != NULL); |
1061 | 1063 |
1062 { | 1064 { |
1063 // Use the interceptor getter. | 1065 // Use the interceptor getter. |
(...skipping 459 matching lines...) Loading... |
1523 Handle<FunctionTemplateInfo>( | 1525 Handle<FunctionTemplateInfo>( |
1524 FunctionTemplateInfo::cast(signature->receiver())); | 1526 FunctionTemplateInfo::cast(signature->receiver())); |
1525 } | 1527 } |
1526 } | 1528 } |
1527 | 1529 |
1528 is_simple_api_call_ = true; | 1530 is_simple_api_call_ = true; |
1529 } | 1531 } |
1530 | 1532 |
1531 | 1533 |
1532 } } // namespace v8::internal | 1534 } } // namespace v8::internal |
OLD | NEW |