| 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 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 Handle<Object> value = args.at<Object>(3); | 1106 Handle<Object> value = args.at<Object>(3); |
| 1107 HandleScope scope(isolate); | 1107 HandleScope scope(isolate); |
| 1108 | 1108 |
| 1109 // TODO(rossberg): Support symbols in the API. | 1109 // TODO(rossberg): Support symbols in the API. |
| 1110 if (name->IsSymbol()) return *value; | 1110 if (name->IsSymbol()) return *value; |
| 1111 Handle<String> str = Handle<String>::cast(name); | 1111 Handle<String> str = Handle<String>::cast(name); |
| 1112 | 1112 |
| 1113 LOG(isolate, ApiNamedPropertyAccess("store", recv, *name)); | 1113 LOG(isolate, ApiNamedPropertyAccess("store", recv, *name)); |
| 1114 PropertyCallbackArguments | 1114 PropertyCallbackArguments |
| 1115 custom_args(isolate, callback->data(), recv, recv); | 1115 custom_args(isolate, callback->data(), recv, recv); |
| 1116 { | 1116 custom_args.Call(fun, v8::Utils::ToLocal(str), v8::Utils::ToLocal(value)); |
| 1117 // Leaving JavaScript. | |
| 1118 VMState<EXTERNAL> state(isolate); | |
| 1119 ExternalCallbackScope call_scope(isolate, setter_address); | |
| 1120 custom_args.Call(fun, v8::Utils::ToLocal(str), v8::Utils::ToLocal(value)); | |
| 1121 } | |
| 1122 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1117 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1123 return *value; | 1118 return *value; |
| 1124 } | 1119 } |
| 1125 | 1120 |
| 1126 | 1121 |
| 1127 static const int kAccessorInfoOffsetInInterceptorArgs = 2; | 1122 static const int kAccessorInfoOffsetInInterceptorArgs = 2; |
| 1128 | 1123 |
| 1129 | 1124 |
| 1130 /** | 1125 /** |
| 1131 * Attempts to load a property with an interceptor (which must be present), | 1126 * Attempts to load a property with an interceptor (which must be present), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1157 args.at<JSObject>(kArgsOffset - PCA::kThisIndex); | 1152 args.at<JSObject>(kArgsOffset - PCA::kThisIndex); |
| 1158 Handle<JSObject> holder = | 1153 Handle<JSObject> holder = |
| 1159 args.at<JSObject>(kArgsOffset - PCA::kHolderIndex); | 1154 args.at<JSObject>(kArgsOffset - PCA::kHolderIndex); |
| 1160 PropertyCallbackArguments callback_args(isolate, | 1155 PropertyCallbackArguments callback_args(isolate, |
| 1161 interceptor_info->data(), | 1156 interceptor_info->data(), |
| 1162 *receiver, | 1157 *receiver, |
| 1163 *holder); | 1158 *holder); |
| 1164 { | 1159 { |
| 1165 // Use the interceptor getter. | 1160 // Use the interceptor getter. |
| 1166 HandleScope scope(isolate); | 1161 HandleScope scope(isolate); |
| 1167 v8::Handle<v8::Value> r; | 1162 v8::Handle<v8::Value> r = |
| 1168 { | 1163 callback_args.Call(getter, v8::Utils::ToLocal(name)); |
| 1169 // Leaving JavaScript. | |
| 1170 VMState<EXTERNAL> state(isolate); | |
| 1171 r = callback_args.Call(getter, v8::Utils::ToLocal(name)); | |
| 1172 } | |
| 1173 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1164 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1174 if (!r.IsEmpty()) { | 1165 if (!r.IsEmpty()) { |
| 1175 Handle<Object> result = v8::Utils::OpenHandle(*r); | 1166 Handle<Object> result = v8::Utils::OpenHandle(*r); |
| 1176 result->VerifyApiCallResultType(); | 1167 result->VerifyApiCallResultType(); |
| 1177 return *v8::Utils::OpenHandle(*r); | 1168 return *v8::Utils::OpenHandle(*r); |
| 1178 } | 1169 } |
| 1179 } | 1170 } |
| 1180 | 1171 |
| 1181 return isolate->heap()->no_interceptor_result_sentinel(); | 1172 return isolate->heap()->no_interceptor_result_sentinel(); |
| 1182 } | 1173 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); | 1218 FUNCTION_CAST<v8::NamedPropertyGetter>(getter_address); |
| 1228 ASSERT(getter != NULL); | 1219 ASSERT(getter != NULL); |
| 1229 | 1220 |
| 1230 PropertyCallbackArguments callback_args(isolate, | 1221 PropertyCallbackArguments callback_args(isolate, |
| 1231 interceptor_info->data(), | 1222 interceptor_info->data(), |
| 1232 *receiver_handle, | 1223 *receiver_handle, |
| 1233 *holder_handle); | 1224 *holder_handle); |
| 1234 { | 1225 { |
| 1235 // Use the interceptor getter. | 1226 // Use the interceptor getter. |
| 1236 HandleScope scope(isolate); | 1227 HandleScope scope(isolate); |
| 1237 v8::Handle<v8::Value> r; | 1228 v8::Handle<v8::Value> r = |
| 1238 { | 1229 callback_args.Call(getter, v8::Utils::ToLocal(name)); |
| 1239 // Leaving JavaScript. | |
| 1240 VMState<EXTERNAL> state(isolate); | |
| 1241 r = callback_args.Call(getter, v8::Utils::ToLocal(name)); | |
| 1242 } | |
| 1243 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1230 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 1244 if (!r.IsEmpty()) { | 1231 if (!r.IsEmpty()) { |
| 1245 *attrs = NONE; | 1232 *attrs = NONE; |
| 1246 Handle<Object> result = v8::Utils::OpenHandle(*r); | 1233 Handle<Object> result = v8::Utils::OpenHandle(*r); |
| 1247 result->VerifyApiCallResultType(); | 1234 result->VerifyApiCallResultType(); |
| 1248 return *result; | 1235 return *result; |
| 1249 } | 1236 } |
| 1250 } | 1237 } |
| 1251 | 1238 |
| 1252 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( | 1239 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2112 Handle<FunctionTemplateInfo>( | 2099 Handle<FunctionTemplateInfo>( |
| 2113 FunctionTemplateInfo::cast(signature->receiver())); | 2100 FunctionTemplateInfo::cast(signature->receiver())); |
| 2114 } | 2101 } |
| 2115 } | 2102 } |
| 2116 | 2103 |
| 2117 is_simple_api_call_ = true; | 2104 is_simple_api_call_ = true; |
| 2118 } | 2105 } |
| 2119 | 2106 |
| 2120 | 2107 |
| 2121 } } // namespace v8::internal | 2108 } } // namespace v8::internal |
| OLD | NEW |