| 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 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 ASSERT(fun != NULL); | 948 ASSERT(fun != NULL); |
| 949 CustomArguments custom_args(isolate, | 949 CustomArguments custom_args(isolate, |
| 950 callback->data(), | 950 callback->data(), |
| 951 JSObject::cast(args[0]), | 951 JSObject::cast(args[0]), |
| 952 JSObject::cast(args[1])); | 952 JSObject::cast(args[1])); |
| 953 v8::AccessorInfo info(custom_args.end()); | 953 v8::AccessorInfo info(custom_args.end()); |
| 954 HandleScope scope(isolate); | 954 HandleScope scope(isolate); |
| 955 v8::Handle<v8::Value> result; | 955 v8::Handle<v8::Value> result; |
| 956 { | 956 { |
| 957 // Leaving JavaScript. | 957 // Leaving JavaScript. |
| 958 VMState state(EXTERNAL); | 958 VMState state(isolate, EXTERNAL); |
| 959 #ifdef ENABLE_LOGGING_AND_PROFILING | 959 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 960 state.set_external_callback(getter_address); | 960 state.set_external_callback(getter_address); |
| 961 #endif | 961 #endif |
| 962 result = fun(v8::Utils::ToLocal(args.at<String>(4)), info); | 962 result = fun(v8::Utils::ToLocal(args.at<String>(4)), info); |
| 963 } | 963 } |
| 964 RETURN_IF_SCHEDULED_EXCEPTION(); | 964 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 965 if (result.IsEmpty()) return HEAP->undefined_value(); | 965 if (result.IsEmpty()) return HEAP->undefined_value(); |
| 966 return *v8::Utils::OpenHandle(*result); | 966 return *v8::Utils::OpenHandle(*result); |
| 967 } | 967 } |
| 968 | 968 |
| 969 | 969 |
| 970 MaybeObject* StoreCallbackProperty(RUNTIME_CALLING_CONVENTION) { | 970 MaybeObject* StoreCallbackProperty(RUNTIME_CALLING_CONVENTION) { |
| 971 RUNTIME_GET_ISOLATE; | 971 RUNTIME_GET_ISOLATE; |
| 972 JSObject* recv = JSObject::cast(args[0]); | 972 JSObject* recv = JSObject::cast(args[0]); |
| 973 AccessorInfo* callback = AccessorInfo::cast(args[1]); | 973 AccessorInfo* callback = AccessorInfo::cast(args[1]); |
| 974 Address setter_address = v8::ToCData<Address>(callback->setter()); | 974 Address setter_address = v8::ToCData<Address>(callback->setter()); |
| 975 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address); | 975 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address); |
| 976 ASSERT(fun != NULL); | 976 ASSERT(fun != NULL); |
| 977 Handle<String> name = args.at<String>(2); | 977 Handle<String> name = args.at<String>(2); |
| 978 Handle<Object> value = args.at<Object>(3); | 978 Handle<Object> value = args.at<Object>(3); |
| 979 HandleScope scope(isolate); | 979 HandleScope scope(isolate); |
| 980 LOG(ApiNamedPropertyAccess("store", recv, *name)); | 980 LOG(ApiNamedPropertyAccess("store", recv, *name)); |
| 981 CustomArguments custom_args(isolate, callback->data(), recv, recv); | 981 CustomArguments custom_args(isolate, callback->data(), recv, recv); |
| 982 v8::AccessorInfo info(custom_args.end()); | 982 v8::AccessorInfo info(custom_args.end()); |
| 983 { | 983 { |
| 984 // Leaving JavaScript. | 984 // Leaving JavaScript. |
| 985 VMState state(EXTERNAL); | 985 VMState state(isolate, EXTERNAL); |
| 986 #ifdef ENABLE_LOGGING_AND_PROFILING | 986 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 987 state.set_external_callback(setter_address); | 987 state.set_external_callback(setter_address); |
| 988 #endif | 988 #endif |
| 989 fun(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); | 989 fun(v8::Utils::ToLocal(name), v8::Utils::ToLocal(value), info); |
| 990 } | 990 } |
| 991 RETURN_IF_SCHEDULED_EXCEPTION(); | 991 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 992 return *value; | 992 return *value; |
| 993 } | 993 } |
| 994 | 994 |
| 995 | 995 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1018 ASSERT(getter != NULL); | 1018 ASSERT(getter != NULL); |
| 1019 | 1019 |
| 1020 { | 1020 { |
| 1021 // Use the interceptor getter. | 1021 // Use the interceptor getter. |
| 1022 v8::AccessorInfo info(args.arguments() - | 1022 v8::AccessorInfo info(args.arguments() - |
| 1023 kAccessorInfoOffsetInInterceptorArgs); | 1023 kAccessorInfoOffsetInInterceptorArgs); |
| 1024 HandleScope scope; | 1024 HandleScope scope; |
| 1025 v8::Handle<v8::Value> r; | 1025 v8::Handle<v8::Value> r; |
| 1026 { | 1026 { |
| 1027 // Leaving JavaScript. | 1027 // Leaving JavaScript. |
| 1028 VMState state(EXTERNAL); | 1028 VMState state(isolate, EXTERNAL); |
| 1029 r = getter(v8::Utils::ToLocal(name_handle), info); | 1029 r = getter(v8::Utils::ToLocal(name_handle), info); |
| 1030 } | 1030 } |
| 1031 RETURN_IF_SCHEDULED_EXCEPTION(); | 1031 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 1032 if (!r.IsEmpty()) { | 1032 if (!r.IsEmpty()) { |
| 1033 return *v8::Utils::OpenHandle(*r); | 1033 return *v8::Utils::OpenHandle(*r); |
| 1034 } | 1034 } |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 return HEAP->no_interceptor_result_sentinel(); | 1037 return HEAP->no_interceptor_result_sentinel(); |
| 1038 } | 1038 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1058 | 1058 |
| 1059 static MaybeObject* LoadWithInterceptor(Arguments* args, | 1059 static MaybeObject* LoadWithInterceptor(Arguments* args, |
| 1060 PropertyAttributes* attrs) { | 1060 PropertyAttributes* attrs) { |
| 1061 Handle<String> name_handle = args->at<String>(0); | 1061 Handle<String> name_handle = args->at<String>(0); |
| 1062 Handle<InterceptorInfo> interceptor_info = args->at<InterceptorInfo>(1); | 1062 Handle<InterceptorInfo> interceptor_info = args->at<InterceptorInfo>(1); |
| 1063 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2); | 1063 ASSERT(kAccessorInfoOffsetInInterceptorArgs == 2); |
| 1064 Handle<JSObject> receiver_handle = args->at<JSObject>(2); | 1064 Handle<JSObject> receiver_handle = args->at<JSObject>(2); |
| 1065 Handle<JSObject> holder_handle = args->at<JSObject>(3); | 1065 Handle<JSObject> holder_handle = args->at<JSObject>(3); |
| 1066 ASSERT(args->length() == 5); // Last arg is data object. | 1066 ASSERT(args->length() == 5); // Last arg is data object. |
| 1067 | 1067 |
| 1068 Isolate* isolate = receiver_handle->GetIsolate(); |
| 1069 |
| 1068 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); | 1070 Address getter_address = v8::ToCData<Address>(interceptor_info->getter()); |
| 1069 v8::NamedPropertyGetter getter = | 1071 v8::NamedPropertyGetter getter = |
| 1070 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); | 1072 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); |
| 1071 ASSERT(getter != NULL); | 1073 ASSERT(getter != NULL); |
| 1072 | 1074 |
| 1073 { | 1075 { |
| 1074 // Use the interceptor getter. | 1076 // Use the interceptor getter. |
| 1075 v8::AccessorInfo info(args->arguments() - | 1077 v8::AccessorInfo info(args->arguments() - |
| 1076 kAccessorInfoOffsetInInterceptorArgs); | 1078 kAccessorInfoOffsetInInterceptorArgs); |
| 1077 HandleScope scope; | 1079 HandleScope scope(isolate); |
| 1078 v8::Handle<v8::Value> r; | 1080 v8::Handle<v8::Value> r; |
| 1079 { | 1081 { |
| 1080 // Leaving JavaScript. | 1082 // Leaving JavaScript. |
| 1081 VMState state(EXTERNAL); | 1083 VMState state(isolate, EXTERNAL); |
| 1082 r = getter(v8::Utils::ToLocal(name_handle), info); | 1084 r = getter(v8::Utils::ToLocal(name_handle), info); |
| 1083 } | 1085 } |
| 1084 RETURN_IF_SCHEDULED_EXCEPTION(); | 1086 RETURN_IF_SCHEDULED_EXCEPTION(); |
| 1085 if (!r.IsEmpty()) { | 1087 if (!r.IsEmpty()) { |
| 1086 *attrs = NONE; | 1088 *attrs = NONE; |
| 1087 return *v8::Utils::OpenHandle(*r); | 1089 return *v8::Utils::OpenHandle(*r); |
| 1088 } | 1090 } |
| 1089 } | 1091 } |
| 1090 | 1092 |
| 1091 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( | 1093 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 expected_receiver_type_ = | 1529 expected_receiver_type_ = |
| 1528 FunctionTemplateInfo::cast(signature->receiver()); | 1530 FunctionTemplateInfo::cast(signature->receiver()); |
| 1529 } | 1531 } |
| 1530 } | 1532 } |
| 1531 | 1533 |
| 1532 is_simple_api_call_ = true; | 1534 is_simple_api_call_ = true; |
| 1533 } | 1535 } |
| 1534 | 1536 |
| 1535 | 1537 |
| 1536 } } // namespace v8::internal | 1538 } } // namespace v8::internal |
| OLD | NEW |